
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Simple JavaScript utilities for working with arrays.
Install with npm:
npm i arr --save-dev
var utils = require('arr');
Filter array, returning only the values of the given type.
array {Array}type {String}: Native type, e.g. string, objectreturns: {Boolean}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
utils.filterType(arr, 'object');
//=> [{a: 'b'}, {c: 'd'}]
array {Array}index {Array}: Optionally specify the index of the number to return, otherwise all numbers are returned.returns: {Array}Filter array, returning only the numbers.
array {Array}index {Array}: Optionally specify the index of the string to return, otherwise all strings are returned.returns: {Array}Filter array, returning only the strings.
array {Array}index {Array}: Optionally specify the index of the object to return, otherwise all objects are returned.returns: {Array}Filter array, returning only the objects.
array {Array}index {Array}: Optionally specify the index of the function to return, otherwise all functions are returned.returns: {Array}Filter array, returning only the functions.
array {Array}index {Array}: Optionally specify the index of the array to return, otherwise all arrays are returned.returns: {Array}Filter array, returning only the arrays.
array {Array}returns: {*}Get the first element in array. Included for completeness.
array {Array}returns: {*}Get the last element in array.
Get the last element in array of the given type.
array {Array}type {String}: The native type to get.returns: {*}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
lastOf(arr, 'number');
//=> 2
Get the first element in array of the given type.
array {Array}type {String}: The native type to get.returns: {*}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
firstOf(arr, 'number');
//=> 1
Returns true if the last element in array is the given type.
array {Array}type {String}: The native type to check.returns: {Boolean}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
lastIs(arr, 'number');
//=> false
Returns true if the first element in array is the given type.
array {Array}type {String}: The native type to check.returns: {Boolean}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
firstIs(arr, 'string');
//=> true
Get the first string in array.
array {Array}returns: {String}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
firstStr(arr, 'string');
//=> 'a'
Get the last string in array.
array {Array}returns: {String}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
lastStr(arr, 'string');
//=> 'c'
Get the first function in array.
array {Array}returns: {Function}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
firstFn(arr, 'function');
//=> 'a'
Get the last function in array.
array {Array}returns: {Function}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
lastFn(arr, 'function');
//=> 'a'
Get the first object in array.
array {Array}returns: {Object}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
firstObj(arr);
//=> {a: 'b'}
Get the last object in array.
array {Array}returns: {Object}var arr = ['a', {a: 'b'}, 1, 'b', 2, {c: 'd'}, 'c'];
lastObj(arr);
//=> {c: 'd'}
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on September 30, 2014.
FAQs
JavaScript utilities for arrays.
The npm package arr receives a total of 13 weekly downloads. As such, arr popularity was classified as not popular.
We found that arr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.