Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-user

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-user - npm Package Compare versions

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
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc