
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
The javascript library to get or check the type of a given variable.
// node js
const Typifier = require('typifier');
// browser
<script type="text/javascript" src="js/lib/typifier.bundle.js"></script>
// code samples
Typifier.isArray([1,2,3]) // => true
Typifier.isArray("[1,2,3]") // => false
Typifier.isObject({ a: b }) // => true
Typifier.isObject([1,2,3]) // => false
Typifier.isString("superString") // => true
Typifier.isString(123) // => false
Typifier.isString(new String("string class")) // => false
Typifier.isStringClass(new String('abc')) // => true
Typifier.isStringClass("primitive String") // => false
Typifier.isNumber(123) // => true
Typifier.isNumber(123.45) // => true
Typifier.isNumber("123") // => false
Typifier.isNumber(new Number(123)) // => false
Typifier.isNumberClass(new Number(123)) // => true
Typifier.isNumberClass(123) // => false
Typifier.isNumberString("123") // => true
Typifier.isNumberString("123.55") // => true
Typifier.isNumberString("0x123") // => true
Typifier.isNumberString(123) // => false
Typifier.isDate(new Date()) // => true
Typifier.isDate(123) // => false
Typifier.isDate("2021-01-01T00:00:00Z") // => false (class check only)
Typifier.isRegExp(/abc/g) // => true
Typifier.isRegExp("/abc/g") // => false
Typifier.isNaN(NaN) // => true
Typifier.isNaN(123) // => false
Typifier.isInfinity(Infinity) // => true
Typifier.isInfinity(NaN) // => false
Typifier.isNegativeInfinity(-Infinity) // => true
Typifier.isNegativeInfinity(Infinity) // => false
Typifier.isUndefined(undefined) // => true
Typifier.isUndefined(0) // => false
Typifier.isNull(null) // => true
Typifier.isNull(false) // => false
Typifier.isBoolean(true) // => true
Typifier.isBoolean(false) // => true
Typifier.isBoolean("") // => false
Typifier.isBoolean(new Boolean(true)) // => false
Typifier.isBooleanClass(new Boolean(true)) // => true
Typifier.isBooleanClass(new Boolean(false)) // => true
Typifier.isBooleanClass(true) // => false
Typifier.isFunction((a) => {}) // => true
Typifier.isFunction("cool") // => false
Typifier.isClass(Typifier) // => true
Typifier.isClass("stringy") // => false
Typifier.is("Typifier", Typifier) // => true
Typifier.is("MyClass", MyClass) // => true
Typifier.is("String", "some string") // => true
Typifier.is("Array", [1,2,3]) // => true
Typifier.is("String", 123) // => false
Typifier.isSet("some string") // => true
Typifier.isSet("") // => true
Typifier.isSet(0) // => true
Typifier.isSet(false) // => true
Typifier.isSet(undefined) // => false
Typifier.isSet(null) // => false
Typifier.getType("some string") // => "string"
Typifier.getType(new String("some string")) // => "String"
Typifier.getType(123) // => "number"
Typifier.getType(new Number(123)) // => "Number"
Typifier.getType(Typifier) // => "class"
Typifier.getType({ a: 1}) // => "Object"
Typifier.getType([1,2,3]) // => "Array"
Typifier.getType(null) // => "null"
Typifier.getType(undefined) // => "undefined"
Typifier.getType(Infinity) // => "Infinity"
Typifier.getType(NaN) // => "NaN"
Typifier.getType(() => {}) // => "function"
Typifier.getType(true) // => "boolean"
Typifier.getType(new Boolean(true)) // => "Boolean"
Typifier.getType(/regex/g) // => "RegExp"
You can either use npm or yarn to install typifier.
In your project root directory execute the following command:
yarn add typifier
In your project root directory execute the following command:
npm install typifier
Download the latest release on Github or the from the folder dist and put it in an appropriate folder of your project, e.g. js/lib
and reference it by a script tag in your project:
<script type="text/javascript" src="js/lib/typifier.bundle.js"></script>
Optionally you may add the source file to your build pipeline, if you are using webpack, brunch or any other packager.
As typifier depends on LuckyCase, there is also a bundle release called typifier.bundle.js where the latter is included. If you already use LuckyCase separately, use the default version typifier.js without included dependencies. If you don't know what you should use, use the bundled release!
If you prefer minified builds, use the *.min.js version. Be aware that they do not contain any javascript documentation that may be very useful when working with a powerful IDE.
See JS doc here.
Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/typifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
FAQs
The javascript library to get or check the type of a given variable.
The npm package typifier receives a total of 955 weekly downloads. As such, typifier popularity was classified as not popular.
We found that typifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.