@bemoje/arr-any

1.0.1 • Public • Published

@bemoje/arr-any

Check whether a condition is true for any element of an array. The condition check is in the form of a callback.

Version

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

Installation

npm install @bemoje/arr-any
npm install --save @bemoje/arr-any
npm install --save-dev @bemoje/arr-any

Usage

import arrAny from '@bemoje/arr-any'

const arr = ['hi', 'there']

arrAny(arr, (element) => {
	return element === 'there'
})
//=> true

arrAny(arr, (element) => {
	return element.length === 5
})
//=> true

arrAny(arr, (element) => {
	return element.length > 5
})
//=> false

Tests

Uses Jest to test module functionality. Run tests to get coverage details.

npm run test

API

arrAny

Check whether a condition is true for any element of an array. The condition check is in the form of a callback.

Parameters
  • arr Array The array to iterate

  • callback callback callback(element, index, array): boolean

Returns

boolean

callback

Type: Function

Parameters
Returns

boolean

Package Sidebar

Install

npm i @bemoje/arr-any

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

8.97 kB

Total Files

5

Last publish

Collaborators

  • bemoje