diff --git a/helpers/index.ts b/helpers/index.ts index 64afbb9..a827cc2 100644 --- a/helpers/index.ts +++ b/helpers/index.ts @@ -13,6 +13,7 @@ export { isVisible } from './isVisible'; export { queryElement } from './queryElement'; export { removeChildElements } from './removeChildElements'; export { removeSpaces } from './removeSpaces'; +export { sameValues } from './sameValues'; export { selectInputElement } from './selectInputElement'; export { setFormFieldValue } from './setFormFieldValue'; export { simulateEvent } from './simulateEvent'; diff --git a/helpers/sameValues.ts b/helpers/sameValues.ts new file mode 100644 index 0000000..89120a5 --- /dev/null +++ b/helpers/sameValues.ts @@ -0,0 +1,7 @@ +/** + * Compares if two arrays have the same exact values. + * @param array1 + * @param array2 + */ +// prettier-ignore +export const sameValues = (array1: unknown[], array2: unknown[]): boolean => array1.every((key) => array2.includes(key)) && array2.every((key) => array1.includes(key)); diff --git a/package.json b/package.json index 0f8853f..1230ef7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@finsweet/ts-utils", - "version": "0.20.2", + "version": "0.21.0", "description": "Typescript utils for custom Webflow projects.", "main": "index.ts", "module": "index.ts",