Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/array-includes-all
Check if an array includes all the elements of another array
https://github.com/shinnn/array-includes-all
Last synced: 27 days ago
JSON representation
Check if an array includes all the elements of another array
- Host: GitHub
- URL: https://github.com/shinnn/array-includes-all
- Owner: shinnn
- License: isc
- Created: 2016-03-16T11:12:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-06T19:05:24.000Z (almost 6 years ago)
- Last Synced: 2024-04-24T13:10:02.781Z (7 months ago)
- Language: JavaScript
- Homepage: https://npm.runkit.com/array-includes-all
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# array-includes-all
[![npm version](https://img.shields.io/npm/v/array-includes-all.svg)](https://www.npmjs.com/package/array-includes-all)
[![Build Status](https://travis-ci.com/shinnn/array-includes-all.svg?branch=master)](https://travis-ci.com/shinnn/array-includes-all)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/array-includes-all.svg)](https://coveralls.io/r/shinnn/array-includes-all)Check if an [`Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) includes all the elements of another array
```javascript
arrayIncludesAll(['a', 'b', 'c'], ['a', 'b']); //=> true
arrayIncludesAll(['a', 'b', 'c'], ['a', 'b', 'd']); //=> falsearrayIncludesAll([1, 2, NaN], [NaN]); //=> true
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install array-includes-all
```## API
```javascript
import arrayIncludesAll from 'array-includes-all';
```### arrayIncludesAll(*array*, *searchElements* [, *fromIndex*])
*array*: `Array`
*searchElements*: `Array` (the elements to search for)
*fromIndex*: `integer` (the position in the array at which to begin searching)
Return: `boolean`The API is similar to [`Array.prototype.includes.call`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes), except that the second argument takes an array of the elements to search for instead of a single element.
```javascript
arrayIncludesAll([1, 2], [1, 2]); //=> true
arrayIncludesAll([1, 2], [1, 2], 1); //=> false
```## License
[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe