indexed-filter
Advanced tools
Comparing version 1.0.2 to 1.0.3
'use strict'; | ||
var appendType = require('append-type'); | ||
/*! | ||
@@ -7,9 +9,10 @@ * indexed-filter | MIT (c) Shinnosuke Watanabe | ||
*/ | ||
function indexedFilter(arr, fn, thisObj) { | ||
if (!Array.isArray(arr)) { | ||
throw new TypeError(String(arr) + ' is not an array. Expected an array to be filtered.'); | ||
throw new TypeError('Expected an array to be filtered, but got a non-array value ' + appendType(arr) + '.'); | ||
} | ||
if (typeof fn !== 'function') { | ||
throw new TypeError(String(fn) + ' is not a function. Expected a filter function that returns Boolean value.'); | ||
throw new TypeError('Expected a filter function, but got a non-function value ' + appendType(fn) + '.'); | ||
} | ||
@@ -16,0 +19,0 @@ |
{ | ||
"name": "indexed-filter", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Array#filter() with also detecting indexes of filtered values", | ||
@@ -31,2 +31,5 @@ "repository": "shinnn/indexed-filter", | ||
], | ||
"dependencies": { | ||
"append-type": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
@@ -33,0 +36,0 @@ "@shinnn/eslint-config": "^5.4.0", |
Sorry, the diff of this file is not supported yet
4937
48
1
+ Addedappend-type@^1.0.1
+ Addedappend-type@1.0.2(transitive)