#psychology #api #psicometrics

mbti

A library to work with Myer-Briggs personality types

4 releases

0.1.3 May 29, 2019
0.1.2 May 28, 2019
0.1.1 May 28, 2019
0.1.0 May 28, 2019

#362 in Science

MIT license

22KB
640 lines

mbti

A library to work with Myer-Briggs personality types

Build Status Build status Coverage Status License: MIT

Myers-Briggs theory is an adaptation of the theory of psychological types produced by Carl Gustav Jung. It is based on 16 personality types, which Jung viewed as stereotypes. They act as useful reference points to understand your unique personality. At the heart of Myers Briggs theory are four preferences. Do you prefer to deal with:

  • People and things (Extraversion or E), or ideas and information (Introversion or I).
  • Facts and reality (Sensing or S), or possibilities and potential (Intuition or N).
  • Logic and truth (Thinking or T), or values and relationships (Feeling or F).
  • A lifestyle that is well-structured (Judgment or J), or one that goes with the flow (Perception or P).

Credits: Team Technology

Usage

Add this to your Cargo.toml

[dependencies]
mbti = ">=0.1.3"

Examples

Get a function from a MBTI type:

extern crate mbti;

use mbti::{get_function, Function, Role, Type};

fn main() {
    let primary = get_function(Type::INTP, Role::Primary);
    assert_eq!(primary, Function::Ti);
}

Get all the functions from a MBTI type:

extern crate mbti;

use mbti::{get_functions_from_type, Function, Type};

fn main() {
    let functions = get_functions_from_type(Type::INTP);
    assert_eq!(
        functions,
        vec![Function::Ti, Function::Ne, Function::Si, Function::Fe]
    );
}

Get all the MBTI types from a function role:

extern crate mbti;

use mbti::{get_types_from_function_role, Function, Role, Type};
use std::collections::HashSet;
#[macro_use]
extern crate maplit;

fn main() {
    let types = get_types_from_function_role(Function::Fe, Role::Primary);
    assert_eq!(types, hashset![Type::ESFJ, Type::ENFJ]);
}

Get a MBTI types from a set of functions:

extern crate mbti;

use mbti::{get_type_from_functions, Function, Type};

fn main() {
    let functions =
        get_type_from_functions(&[Function::Ti, Function::Ne, Function::Si, Function::Fe]);
    assert_eq!(functions, Some(Type::INTP));
}

Get compatibility between two MBTI types:

extern crate mbti;

use mbti::{check_compatibility, Compatibility, Type};

fn main() {
    let compatibility = check_compatibility(Type::INTP, Type::INFP);
    assert_eq!(compatibility, Compatibility::Positive);
}

License

The MIT License (MIT)

Copyright © 2019 Giorgio Pomettini

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Dependencies

~310–780KB
~18K SLoC