Skip to content

Commit

Permalink
Fix/dv 645 data formats (#40)
Browse files Browse the repository at this point in the history
* fix: arrays vulnerability
* fix encoding vulnerability
* fix hashes vulnerability
  • Loading branch information
ivegabr authored Dec 23, 2024
1 parent a60c73d commit d489aba
Show file tree
Hide file tree
Showing 19 changed files with 419 additions and 111 deletions.
11 changes: 11 additions & 0 deletions dist/cjs/arrays.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
/**
* @description Validates if the provided argument is an array.
* @param {any} value - The value to validate.
* @throws {TypeError} - If the value is not an array.
*/
export declare function validateArray(value: any, paramName: string): void;
/**
* @description Computes the intersection of two arrays. The intersection is a new array containing
* all elements that are present in both input arrays.
*
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are present in both `a` and `b`.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arrayIntersection<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -14,6 +21,7 @@ export declare function arrayIntersection<T>(a: T[], b: T[]): T[];
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are in `a` but not in `b`.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arrayDifference<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -23,6 +31,7 @@ export declare function arrayDifference<T>(a: T[], b: T[]): T[];
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are in `a` or `b`, but not both.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arraySymmetricDifference<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -31,6 +40,7 @@ export declare function arraySymmetricDifference<T>(a: T[], b: T[]): T[];
* @param {T[]} haystack - The array to search within.
* @param {T[]} needle - The array of items to search for.
* @returns {boolean} - Returns true if any element of `needle` is found in `haystack`, false otherwise.
* @throws {TypeError} - If either `haystack` or `needle` is not an array.
*/
export declare function hasValue<T>(haystack: T[], needle: T[]): boolean;
/**
Expand All @@ -39,5 +49,6 @@ export declare function hasValue<T>(haystack: T[], needle: T[]): boolean;
* @param {T[]} haystack - The array to search within.
* @param {T[]} needle - The array of items to search for.
* @returns {boolean} - Returns true if all elements of `needle` are found in `haystack`, false otherwise.
* @throws {TypeError} - If either `haystack` or `needle` is not an array.
*/
export declare function includesAll<T>(haystack: T[], needle: T[]): boolean;
28 changes: 27 additions & 1 deletion dist/cjs/arrays.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/arrays.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 41 additions & 5 deletions dist/cjs/encoding.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/encoding.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dist/cjs/hashes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/hashes.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions dist/esm/arrays.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
/**
* @description Validates if the provided argument is an array.
* @param {any} value - The value to validate.
* @throws {TypeError} - If the value is not an array.
*/
export declare function validateArray(value: any, paramName: string): void;
/**
* @description Computes the intersection of two arrays. The intersection is a new array containing
* all elements that are present in both input arrays.
*
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are present in both `a` and `b`.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arrayIntersection<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -14,6 +21,7 @@ export declare function arrayIntersection<T>(a: T[], b: T[]): T[];
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are in `a` but not in `b`.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arrayDifference<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -23,6 +31,7 @@ export declare function arrayDifference<T>(a: T[], b: T[]): T[];
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @returns {T[]} - An array containing elements that are in `a` or `b`, but not both.
* @throws {TypeError} - If either `a` or `b` is not an array.
*/
export declare function arraySymmetricDifference<T>(a: T[], b: T[]): T[];
/**
Expand All @@ -31,6 +40,7 @@ export declare function arraySymmetricDifference<T>(a: T[], b: T[]): T[];
* @param {T[]} haystack - The array to search within.
* @param {T[]} needle - The array of items to search for.
* @returns {boolean} - Returns true if any element of `needle` is found in `haystack`, false otherwise.
* @throws {TypeError} - If either `haystack` or `needle` is not an array.
*/
export declare function hasValue<T>(haystack: T[], needle: T[]): boolean;
/**
Expand All @@ -39,5 +49,6 @@ export declare function hasValue<T>(haystack: T[], needle: T[]): boolean;
* @param {T[]} haystack - The array to search within.
* @param {T[]} needle - The array of items to search for.
* @returns {boolean} - Returns true if all elements of `needle` are found in `haystack`, false otherwise.
* @throws {TypeError} - If either `haystack` or `needle` is not an array.
*/
export declare function includesAll<T>(haystack: T[], needle: T[]): boolean;
Loading

0 comments on commit d489aba

Please sign in to comment.