array-fp-utils
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -9,1 +9,3 @@ export { groupBy } from './groupBy'; | ||
export { uniqueBy } from './uniqueBy'; | ||
export { isSameValueSet } from './isSameValueSet'; | ||
export { isSameValueSetWith } from './isSameValueSetWith'; |
@@ -9,1 +9,3 @@ export { groupBy } from './groupBy'; | ||
export { uniqueBy } from './uniqueBy'; | ||
export { isSameValueSet } from './isSameValueSet'; | ||
export { isSameValueSetWith } from './isSameValueSetWith'; |
@@ -1,1 +0,2 @@ | ||
export declare const intersect: (otherArr: Readonly<Array<unknown>>) => <ValueType>(arr: readonly ValueType[]) => ValueType[]; | ||
import { Primitive } from '../types'; | ||
export declare const intersect: (otherArr: Readonly<Array<Primitive>>) => (arr: Readonly<Array<Primitive>>) => Array<Primitive>; |
@@ -1,1 +0,2 @@ | ||
export declare function isDistinctArray<ValueType>(arr: Readonly<Array<ValueType>>): boolean; | ||
import { Primitive } from '../types'; | ||
export declare function isDistinctArray(arr: Readonly<Array<Primitive>>): boolean; |
@@ -1,1 +0,2 @@ | ||
export declare const isSubsetOf: <ValueType>(otherArr: readonly ValueType[]) => (arr: readonly ValueType[]) => boolean; | ||
import { Primitive } from '../types'; | ||
export declare const isSubsetOf: (otherArr: Readonly<Array<Primitive>>) => (arr: Readonly<Array<Primitive>>) => boolean; |
@@ -19,3 +19,5 @@ "use strict"; | ||
unique: ()=>_unique.unique, | ||
uniqueBy: ()=>_uniqueBy.uniqueBy | ||
uniqueBy: ()=>_uniqueBy.uniqueBy, | ||
isSameValueSet: ()=>_isSameValueSet.isSameValueSet, | ||
isSameValueSetWith: ()=>_isSameValueSetWith.isSameValueSetWith | ||
}); | ||
@@ -30,1 +32,3 @@ const _groupBy = require("./groupBy"); | ||
const _uniqueBy = require("./uniqueBy"); | ||
const _isSameValueSet = require("./isSameValueSet"); | ||
const _isSameValueSetWith = require("./isSameValueSetWith"); |
@@ -9,1 +9,3 @@ export { groupBy } from './groupBy'; | ||
export { uniqueBy } from './uniqueBy'; | ||
export { isSameValueSet } from './isSameValueSet'; | ||
export { isSameValueSetWith } from './isSameValueSetWith'; |
export declare type NonEmptyArray<T> = [T, ...T[]]; | ||
export declare type Primitive = string | number | boolean | bigint | symbol | null | undefined; |
@@ -1,1 +0,2 @@ | ||
export declare const unique: <ValueType>(arr: readonly ValueType[]) => ValueType[]; | ||
import { Primitive } from '../types'; | ||
export declare const unique: (arr: Readonly<Array<Primitive>>) => Array<Primitive>; |
# array-fp-utils | ||
## 0.3.0 | ||
### Minor Changes | ||
- c8e3e4a: Add isSameValueSet() function to determine whether an array contains the same set of values with another array. | ||
### Patch Changes | ||
- abc7ad7: Contraint functions use Set internally to primitive types only. | ||
## 0.2.0 | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "array-fp-utils", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Array utilities for functional programming in TypeScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -25,12 +25,14 @@ # array-fp-utils | ||
- [groupBy](#groupBy) | ||
- [groupBy](#groupby) | ||
- [intersect](#intersect) | ||
- [intersectWith](#intersectWith) | ||
- [isDistinctArray](#isDistinctArray) | ||
- [isSubsetOf](#isSubsetOf) | ||
- [isSubsetOfWith](#isSubsetOfWith) | ||
- [intersectWith](#intersectwith) | ||
- [isDistinctArray](#isdistinctarray) | ||
- [isSameValueSet](#issamevalueset) | ||
- [isSameValueSetWith](#issamevaluesewith) | ||
- [isSubsetOf](#issubsetof) | ||
- [isSubsetOfWith](#issubsetofwith) | ||
- [unique](#unique) | ||
- [uniqueBy](#uniqueBy) | ||
- [uniqueBy](#uniqueby) | ||
### <a id="groupBy"></a>groupBy | ||
### groupBy | ||
@@ -83,3 +85,3 @@ ```typescript | ||
### <a id="intersect"></a>intersect | ||
### intersect | ||
@@ -97,3 +99,3 @@ ```typescript | ||
### <a id="intersectWith"></a>intersectWith | ||
### intersectWith | ||
@@ -123,3 +125,3 @@ ```typescript | ||
### <a id="isDistinctArray"></a>isDistinctArray | ||
### isDistinctArray | ||
@@ -134,6 +136,40 @@ ```typescript | ||
### <a id="isSubsetOf"></a>isSubsetOf | ||
### isSameValueSet | ||
Indicates whether an array contains the same set of items with another array, irrelevant of position (sorting). | ||
Note: only accepts arrays of [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive) values. | ||
#### Example | ||
```typescript | ||
import { pipe } from 'fp-ts/lib/function'; | ||
import { isSameValueSet } from 'array-fp-utils'; | ||
pipe([1, 2, 3], isSameValueSet([3, 2, 1])); // returns true | ||
pipe([1, 2], isSameValueSet([1, 2, 3])); // returns false | ||
pipe([1, 2, 3], isSameValueSet([1, 2, 4])); // returns false | ||
``` | ||
### isSameValueSetWith | ||
Indicates whether an array contains the same set of items with another array, irrelevant of position (sorting), using a comparator function. | ||
#### Example | ||
```typescript | ||
import { pipe } from 'fp-ts/lib/function'; | ||
import { isSameValueSetWith } from 'array-fp-utils'; | ||
pipe( | ||
[{ key: 1 }, { key: 2 }, { key: 3 }], | ||
isSameValueSetWith([3, 2, 1], (value, otherValue) => value.key === otherValue) | ||
); // returns true | ||
``` | ||
### isSubsetOf | ||
```typescript | ||
import { pipe } from 'fp-ts/lib/function'; | ||
import { isSubsetOf } from 'array-fp-utils'; | ||
@@ -147,3 +183,3 @@ | ||
### <a id="isSubsetOfWith"></a>isSubsetOfWith | ||
### isSubsetOfWith | ||
@@ -169,3 +205,3 @@ ```typescript | ||
### <a id="unique"></a>unique | ||
### unique | ||
@@ -189,3 +225,3 @@ ```typescript | ||
### <a id="uniqueBy"></a>uniqueBy | ||
### uniqueBy | ||
@@ -192,0 +228,0 @@ ```typescript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28779
92
523
265