Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Easy and reliable type detection with ES6+ support.
Desktop Browsers:
Mobile Browsers:
using npm
npm i ee-types
using bower
bower i ee-types
node
let types = require('ee-types');
require.js
you have to configure require.js to point the bower prefix to the bower_components folder.
requirejs.config({
paths: {
'bower': '/js/bower_components/'
}
});
and finally load the component
require(['bower/ee-types/dist/ee-types.min'], function(types) {
});
Browser & Vanilla
<script src="bower/ee-types/dist/ee-types.min" />
var types = window.ee.types;
Explicity test for a type
types.array([]) // true
Get the type of some input
types(/[a-z]+/gi) // regexp
Since many of the types defined by javascript are just special objects that also can be treated as normal objects ee-types has are a bunch of methods that allow you to handle that correctly.
For example Map
is an object too. Or custom class where you
define a getter that returns a specific name for your object:
const X = class {
get [Symbol.toStringTag]() {
return 'AQL query';;
}
};
console.log(Object.prototype.toString.call(new X()));
// prints: [object AQL Query]
types.object({}); // true
types.object(new Map()); // false
// be aware that if you are not explicitly testing
// for an object any obecjt will be treated as one
types({}) // 'object'
types(new Map()) // 'object'
types.someObject({}); // true
types.someObject(new Map()); // false
types(new Map()) // 'object'
var types = require('ee-types');
types.string('nope'); // true
types.strign(new String('yeah')); // true
types(2) // number
types([]]) // array
types(new Array()]) // array
types(new Int8Array()]) // int8Array
types.promise(Promise.all()) // true
FAQs
Reliable & easy Js & ES Type detection
We found that ee-types 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.