@openmbti/core
v1.0.1
Published
Core OEJTS (Open Extended Jungian Type Scales) MBTI personality test questions and scoring logic
Maintainers
Readme
@openmbti/core
Core OEJTS (Open Extended Jungian Type Scales) MBTI personality test questions and scoring logic.
Based on the Open Extended Jungian Type Scales 1.2 by Open Psychometrics.
Installation
npm install @openmbti/coreUsage
import {
questions,
sortedQuestions,
generateResult,
isTestComplete,
type TestAnswers,
type TestResult,
} from '@openmbti/core';
// Get all questions sorted by ID
console.log(sortedQuestions.length); // 32
// Record user answers (questionId -> score 1-5)
const answers: TestAnswers = {
1: 4, // Question 1, leaning right
2: 2, // Question 2, leaning left
// ... all 32 questions
};
// Check if test is complete
if (isTestComplete(answers)) {
// Generate result
const result: TestResult = generateResult(answers);
console.log(result.type); // e.g., "ENFP"
console.log(result.scores); // { EI: 28, SN: 30, TF: 18, JP: 32 }
console.log(result.percentages); // { E: 38, I: 62, S: 31, N: 69, ... }
}API
Data Exports
questions- Array of all 32 question pairssortedQuestions- Questions sorted by ID (for test presentation)dimensionQuestions- Question IDs grouped by dimensionTOTAL_QUESTIONS- Total number of questions (32)QUESTIONS_PER_DIMENSION- Questions per dimension (8)
Functions
generateResult(answers)- Generate complete test result from answerscalculateScores(answers)- Calculate raw dimension scoresdetermineType(scores)- Determine MBTI type from scorescalculatePercentages(scores)- Calculate percentage preferencesisTestComplete(answers)- Check if all questions are answered
Types
TestAnswers- Map of question ID to answer (1-5)TestResult- Complete result with type, scores, and percentagesDimensionScores- Raw scores for EI, SN, TF, JP dimensionsDimensionPercentages- Percentage for each trait poleQuestionPair- Question with bipolar traitsBilingualText- Multilingual text (en, zh, ja, ko, zh-tw)Dimension- Dimension type ('EI' | 'SN' | 'TF' | 'JP')
Question Format
Each question is a bipolar trait pair:
{
id: 1,
dimension: 'JP',
leftTrait: { en: 'Makes lists', zh: '制定清单' },
rightTrait: { en: 'Relies on memory', zh: '依靠记忆' }
}Users answer on a 1-5 scale:
- 1 = Strongly agree with left trait
- 3 = Neutral
- 5 = Strongly agree with right trait
Scoring
- Each dimension has 8 questions
- Raw scores range from 8 (all 1s) to 40 (all 5s)
- Threshold of 24 determines type preference
- Percentages normalized from 0-100%
License
MIT
