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

ee-types

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-types - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

src/types.mjs

19

package.json
{
"name": "ee-types",
"version": "2.2.1",
"version": "3.0.0",
"description": "Reliable & easy Js & ES Type detection",
"main": "index.js",
"main": "./src/types.mjs",
"directories": {
"example": "example",
"test": "test"
},
"scripts": {
"test": "./node_modules/mocha/bin/_mocha --reporter spec",
"posttest": "npm run js",
"js": "./node_modules/gulp/bin/gulp.js js js-min"
"test": "node --no-warnings --experimental-modules ./node_modules/.bin/section ./test/*.mjs --dev --log-level=error+ --log-module=*"
},

@@ -31,12 +28,4 @@ "repository": {

"devDependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-expect-file": "^1.0.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.1",
"mocha": "^5.2.0"
},
"dependencies": {
"ee-class": "^1.4.0"
"section-tests": "^2.2.0"
}
}

@@ -8,88 +8,56 @@ # ee-types

[![Travis](https://img.shields.io/travis/eventEmitter/ee-types.svg?style=flat-square)](https://travis-ci.org/eventEmitter/ee-types)
[![node](https://img.shields.io/node/v/ee-types.svg?style=flat-square)](https://nodejs.org/)
## Compatibility
For a versions supporting older browsers and node version please use ee-types version < 3.0.0.
Compatible with node 10+ (--experimental-modules flag) and browsers supporting es modules.
## Browser compatibility
Desktop Browsers:
- Chrome 7+
- Firefox 4+
- Safari 5.1+
- IE 9+
- Edge 25+
Mobile Browsers:
- Safari iOS 6+
- Chrome for Android 38+
- Android Browser 4.4.4+
## Installation
using npm
npm i ee-types
using bower
bower i ee-types
## Importing
node
***node***
```javascript
import types from 'ee-types';
```
let types = require('ee-types');
***browser***
from html
```
<script type="module" src="node_modules/ee-types/src/types.mjs"></script>
```
require.js
from within a module
you have to configure require.js to point the bower prefix
to the bower_components folder.
requirejs.config({
paths: {
'bower': '/js/bower_components/'
}
});
```javascript
import types from 'node_modules/ee-types/src/types.mjs';
```
and finally load the component
## API
require(['bower/ee-types/dist/ee-types.min'], function(types) {
});
Be aware that the different object types like Maps, Promises and so on are not
detected as objects but as their respective type. If you need to detect them as
objects please use the `types.someObject()` method instead of the `types.object()`
method.
Explicitly test for a type.
```javascript
types.array([]) // true
```
Browser & Vanilla
<script src="bower/ee-types/dist/ee-types.min" />
var types = window.ee.types;
Get the type of some variable
```javascript
types(/[a-z]+/gi) // regexp
```
## API
Explicity test for a type
types.array([]) // true
Get the type of some input
types(/[a-z]+/gi) // regexp
## Supported Types

@@ -136,5 +104,5 @@

objects that also can be treated as normal objects ee-types has
are a bunch of methods that allow you to handle that correctly.
a bunch of methods that allow you to handle that correctly.
For example `Map` is an object too. Or custom class where you
For example, `Map` is an object, or a custom class where you
define a getter that returns a specific name for your object:

@@ -160,3 +128,3 @@

// be aware that if you are not explicitly testing
// for an object any obecjt will be treated as one
// for an object any object will be treated as one
types({}) // 'object'

@@ -163,0 +131,0 @@ types(new Map()) // 'object'

Sorry, the diff of this file is not supported yet

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