1.0.0 • Published 1 year ago
@bigfive-org/score v1.0.0
bigfive-score
Calculate score for big five tests.
Installation
$ npm i @bigfive-org/score
Usage
Pass an object with property answers. Answers have to be an Array with domain and score. Facet is optional.
import { processAnswers } from '@bigfive-org/score'
const result = {
"timeElapsed": 51,
"lang": "en",
"test": "50-IPIP-NEO-PI-R",
"totalQuestions": 50,
"answers": [
{
"domain": "A",
"facet": "1",
"score": "3"
},
{
"domain": "A",
"facet": "1",
"score": "3"
},
{
"domain": "E",
"facet": "1",
"score": "3"
},
{
"domain": "E",
"facet": "2",
"score": "3"
}
]
}
processAnswers(result)
returns score for each factor
{
'A': {
'score': 6,
'count': 2,
'result': 'neutral',
'facet': {
'1': {
'score': 6,
'count': 2,
'result': 'neutral'
}
}
},
'E': {
'score': 6,
'count': 2,
'result': 'neutral',
'facet': {
'1': {
'score': 3,
'count': 1,
'result': 'neutral'
},
'2': {
'score': 3,
'count': 1,
'result': 'neutral'
}
}
}
}