Gathering detailed insights and metrics for iftype
Gathering detailed insights and metrics for iftype
Gathering detailed insights and metrics for iftype
Gathering detailed insights and metrics for iftype
npm install iftype
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
27 Commits
1 Forks
2 Watching
8 Branches
1 Contributors
Updated on 30 Jul 2020
JavaScript (91.97%)
HTML (8.03%)
Cumulative downloads
Total Downloads
Last day
-6.9%
1,161
Compared to previous day
Last week
55.8%
9,718
Compared to previous week
Last month
41.4%
33,644
Compared to previous month
Last year
9.7%
290,672
Compared to previous year
Check types
1$ npm install iftype --save
1'use strict' 2 3const iftype = require('iftype') 4 5function CustomType(){ 6} 7 8//---------------------------- 9// Check if type is 'string' 10//---------------------------- 11iftype(123).is('string') // => false 12iftype(function foo(){}).is('string') // => false 13iftype(new CustomType()).is('string') // => false 14iftype(["foo", "bar"]).is('string') // => false 15iftype("bar").is('string') // => true 16iftype(null).is('string') // => false 17iftype(undefined).is('string') // => false 18 19 20//---------------------------- 21// Check if type is 'number' 22//---------------------------- 23iftype(123).is('number') // => true 24iftype(function foo(){}).is('number') // => false 25iftype(new CustomType()).is('number') // => false 26iftype(["foo", "bar"]).is('number') // => false 27iftype("bar").is('number') // => false 28iftype(null).is('number') // => false 29iftype(undefined).is('number') // => false 30 31 32//---------------------------- 33// Check if type is 'object' 34//---------------------------- 35iftype(123).is('object') // => false 36iftype(function foo(){}).is('object') // => false 37iftype(new CustomType()).is('object') // => true 38iftype(["foo", "bar"]).is('object') // => true 39iftype("bar").is('object') // => false 40iftype(null).is('object') // => false 41iftype(undefined).is('object') // => false 42 43 44//---------------------------- 45// Check if type is 'array' 46//---------------------------- 47iftype(123).is('array') // => false 48iftype(function foo(){}).is('array') // => false 49iftype(new CustomType()).is('array') // => false 50iftype(["foo", "bar"]).is('array') // => true 51iftype("bar").is('array') // => false 52iftype(null).is('array') // => false 53iftype(undefined).is('array') // => false 54 55 56//---------------------------- 57// Check if type is 'function' 58//---------------------------- 59iftype(123).is('function') // => false 60iftype(function foo(){}).is('function') // => true 61iftype(new CustomType()).is('function') // => false 62iftype(["foo", "bar"]).is('function') // => false 63iftype("bar").is('function') // => false 64iftype(null).is('function') // => false 65iftype(undefined).is('function') // => false 66 67 68//---------------------------- 69// Check if type is CustomType 70//---------------------------- 71iftype(123).is(CustomType) // => false 72iftype(function foo(){}).is(CustomType) // => false 73iftype(new CustomType()).is(CustomType) // => true 74iftype(["foo", "bar"]).is(CustomType) // => false 75iftype("bar").is(CustomType) // => false 76iftype(null).is(CustomType) // => false 77iftype(undefined).is(CustomType) // => false 78 79 80
Signature | Description |
---|---|
iftype(val).is(type) | Check if type match. |
iftype(val).isString() | Check if string. |
iftype(val).isNumber() | Check if number. |
iftype(val).isObject() | Check if object. |
iftype(val).isArray() | Check if array. |
iftype.is(type, val) | Check if type match. |
iftype.isString(val) | Check if string. |
iftype.isNumber(val) | Check if number. |
iftype.isObject(val) | Check if object. |
iftype.isArray(val) | Check if array. |
This software is released under the MIT License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More