is 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/index.js +5 -1
- package/package.json +8 -6
- package/test/index.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
3.2.1 / 2017-02-27
|
|
2
|
+
==================
|
|
3
|
+
* [Fix] `is.fn`: recognize generator and async functions too (#28)
|
|
4
|
+
* [Tests] up to `node` `v7.5`, `v4.7`; improve test matrix
|
|
5
|
+
* [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `tape`
|
|
6
|
+
* [Docs] improve readme formatting (#27)
|
|
7
|
+
|
|
1
8
|
3.2.0 / 2016-10-24
|
|
2
9
|
==================
|
|
3
10
|
* [Fix] fix infinite loop when comparing two empty arrays + fix skipping first element (#24, #25)
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -409,7 +409,11 @@ is.error = function (value) {
|
|
|
409
409
|
|
|
410
410
|
is.fn = is['function'] = function (value) {
|
|
411
411
|
var isAlert = typeof window !== 'undefined' && value === window.alert;
|
|
412
|
-
|
|
412
|
+
if (isAlert) {
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
var str = toStr.call(value);
|
|
416
|
+
return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]';
|
|
413
417
|
};
|
|
414
418
|
|
|
415
419
|
/**
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
|
+
"prepublish": "safe-publish-latest",
|
|
6
7
|
"pretest": "npm run lint",
|
|
7
8
|
"test": "npm run --silent tests-only",
|
|
8
9
|
"tests-only": "node test/index.js",
|
|
@@ -36,12 +37,14 @@
|
|
|
36
37
|
],
|
|
37
38
|
"dependencies": {},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"
|
|
40
|
-
"foreach": "^2.0.5",
|
|
40
|
+
"@ljharb/eslint-config": "^11.0.0",
|
|
41
41
|
"covert": "^1.1.0",
|
|
42
|
+
"eslint": "^3.16.1",
|
|
43
|
+
"foreach": "^2.0.5",
|
|
42
44
|
"jscs": "^3.0.7",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
+
"make-generator-function": "^1.1.0",
|
|
46
|
+
"safe-publish-latest": "^1.1.1",
|
|
47
|
+
"tape": "^4.6.3"
|
|
45
48
|
},
|
|
46
49
|
"testling": {
|
|
47
50
|
"files": "test/index.js",
|
|
@@ -64,4 +67,3 @@
|
|
|
64
67
|
"node": "*"
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
|
package/test/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var is = require('../index.js');
|
|
|
8
8
|
var forEach = require('foreach');
|
|
9
9
|
var toStr = Object.prototype.toString;
|
|
10
10
|
|
|
11
|
+
var genFn = require('make-generator-function');
|
|
12
|
+
|
|
11
13
|
test('is.type', function (t) {
|
|
12
14
|
var booleans = [true, false];
|
|
13
15
|
forEach(booleans, function (boolean) {
|
|
@@ -335,6 +337,12 @@ test('is.fn', function (t) {
|
|
|
335
337
|
}
|
|
336
338
|
t.notOk(is.fn({}), 'object is not function');
|
|
337
339
|
t.notOk(is.fn(null), 'null is not function');
|
|
340
|
+
|
|
341
|
+
t.test('generator functions', { skip: !genFn }, function (st) {
|
|
342
|
+
t.ok(is.fn(genFn), 'generator function is function');
|
|
343
|
+
st.end();
|
|
344
|
+
});
|
|
345
|
+
|
|
338
346
|
t.end();
|
|
339
347
|
});
|
|
340
348
|
|