Comparing version 2.2.1 to 3.0.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
1
0
0
1
10567
5
78
164
- Removedee-class@^1.4.0
- Removedee-class@1.4.0(transitive)