Comparing version 1.1.0 to 1.2.0
23
index.js
'use strict'; | ||
const is = (userArr, input) => { | ||
const isUser = function () { | ||
const is = function (input) { | ||
const inputLowerCase = input.toLowerCase(); | ||
return this.roles.includes(inputLowerCase); | ||
}; | ||
const inputLowerCase = input.toLowerCase(); | ||
const userArrLowerCase = userArr.map( item => item.toLowerCase()); | ||
return userArrLowerCase.includes(inputLowerCase); | ||
const cache = function (roles) { | ||
const userArrLowerCase = roles.map(item => item.toLowerCase()); | ||
this.roles = userArrLowerCase; | ||
return this.roles; | ||
}; | ||
return { | ||
is, | ||
cache | ||
}; | ||
}; | ||
module.exports = { | ||
is | ||
}; | ||
module.exports = isUser(); |
{ | ||
"name": "is-user", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -9,5 +9,9 @@ ## Is-User | ||
const isUser = require('is-user'); | ||
const userArr = ['user', 'admin', 'manager', 'superadmin', 'ceo']; | ||
let isAdmin = isUser.is(userArr, 'admin'); //true | ||
let isManager = isUser.is(userArr, 'manager'); //true | ||
export.update = function(req, res){ | ||
//chaching the roles for future use in this function" | ||
const userArr = ['user', 'admin', 'manager', 'superadmin', 'ceo']; | ||
isUser.cache(userArr); | ||
let isAdmin = isUser.is('admin'); //true | ||
let isManager = isUser.is('manager'); //true | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2907
17
16
0