Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gfx/array-like-partial-equal
Comparesion of Subarrays of Two Arrays
https://github.com/gfx/array-like-partial-equal
typescript-library
Last synced: 26 days ago
JSON representation
Comparesion of Subarrays of Two Arrays
- Host: GitHub
- URL: https://github.com/gfx/array-like-partial-equal
- Owner: gfx
- Created: 2019-08-08T02:22:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-08T02:27:20.000Z (about 5 years ago)
- Last Synced: 2024-09-19T09:19:38.876Z (about 2 months ago)
- Topics: typescript-library
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@gfx/array-like-partial-equal
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## @gfx/array-like-partial-equal
This library checks equality for subarrays of two arrays, not only for `Array` but also for `ArrayLike` in TypeScript.
## Install
```
npm install @gfx/array-like-partial-equal
```## Synopsis
```typescript
import { arrayLikePartialEqual } from "@gfx/array-like-partial-equal";const a: ArrayLike = [99, 1, 2, 3, 98];
const b: ArrayLike = [10, 1, 2, 3, 20];// check if a.subarray(1, 1+3) === b.subarray(1, 1+3) for each item
console.log(arrayLikePartialEqual(a, 1, b, 1, 3)); // true// check if a.subarray(0, 0+3) === b.subarray(0, 0+3) for each item
console.log(arrayLikePartialEqual(a, 0, b, 0, 3)); // false
```## Copyright
Copyright (c) FUJI Goro.