Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@alheimsins/bigfive-calculate-score
Advanced tools
Calculate score for big five tests
$ npm i @alheimsins/bigfive-calculate-score
Pass an object with property answers. Answers have to be an Array with domain and score. Facet is optional.
const calculateScore = require('@alheimsins/bigfive-calculate-score')
const result = {
"timeElapsed": -51,
"ip": "127.0.0.1",
"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"
}
]
}
calculateScore(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'
}
}
}
}
If you want to override result pass a function as the calculateResult property
The function signature must be
function (score, count) {
'use strict'
// Do something
return 'value'
}
Example
const calculateScore = require('@alheimsins/bigfive-calculate-score')
const calculateResult = (score, count) => {
const average = score / count
let result = 'nøytral'
if (average > 3) {
result = 'høy'
} else if (average < 3) {
result = 'lav'
}
return result
}
const result = {
"timeElapsed": -51,
"ip": "127.0.0.1",
"lang": "en",
"test": "50-IPIP-NEO-PI-R",
"totalQuestions": 50,
"calculateResult": calculateResult,
"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"
}
]
}
calculateScore(result)
Returns
{
'A': {
'score': 6,
'count': 2,
'result': 'nøytral',
'facet': {
'1': {
'score': 6,
'count': 2,
'result': 'nøytral'
}
}
},
'E': {
'score': 6,
'count': 2,
'result': 'nøytral',
'facet': {
'1': {
'score': 3,
'count': 1,
'result': 'nøytral'
},
'2': {
'score': 3,
'count': 1,
'result': 'nøytral'
}
}
}
}
Created with <3 by Alheimsins
FAQs
Calculate score for big five tests
The npm package @alheimsins/bigfive-calculate-score receives a total of 0 weekly downloads. As such, @alheimsins/bigfive-calculate-score popularity was classified as not popular.
We found that @alheimsins/bigfive-calculate-score demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.