Package Exports
- filter-type
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (filter-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
filter-type

Filter an array or arguments by JavaScript native type (e.g. functions, strings, etc).
Install with npm
npm i filter-type --saveUsage
var filter = require('filter-type');
filter(array, type);Params
arrayThe array to filtertypeNative JavaScript type to filter by (e.g.string,functionetc)
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(){}]Similar projects
- kind-of: Get the native type of a value.
- filter-keys: Filter the keys of an object using glob patterns.
- filter-object: Return a copy of an object, filtered to have only keys that match the given glob patterns.
- filter-values: Filter an object to have only the
ownproperties for which acallbackfunction returns true.
Running tests
Install dev dependencies.
npm i -d && npm testContributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 22, 2015.