$ cnpm install filter-type
Filter an array or arguments by JavaScript native type (e.g. functions, strings, etc).
npm i filter-type --save
var filter = require('filter-type');
filter(array, type);
Params
array The array to filtertype Native JavaScript type to filter by (e.g. string, function etc)Example
var arr = [1, 'a', {aaa: 'bbb'}, 3, 'b', 'c', 7, ['foo', 'bar'], function one(){}];
filter(arr, 'object');
//=> [{aaa: 'bbb'}]
filter(arr, 'array');
//=> [['foo', 'bar']]
filter(arr, 'number');
//=> [1, 3, 7]
filter(arr, 'string');
//=> ['a', 'b', 'c']
filter(arr, 'function');
//=> [function one(){}]
own properties for which a callback function returns true.Install dev dependencies.
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 22, 2015.
Copyright 2013 - present © cnpmjs.org | Home |