diff --git a/dist/purify.cjs.js b/dist/purify.cjs.js index acb86c622..0e0eb7857 100644 --- a/dist/purify.cjs.js +++ b/dist/purify.cjs.js @@ -53,8 +53,8 @@ const typeErrorCreate = unconstruct(TypeError); /** * Creates a new function that calls the given function with a specified thisArg and arguments. * - * @param {(thisArg: any, ...args: any[]) => T} func - The function to be wrapped and called. - * @returns {(thisArg: any, ...args: any[]) => T} A new function that calls the given function with a specified thisArg and arguments. + * @param func - The function to be wrapped and called. + * @returns A new function that calls the given function with a specified thisArg and arguments. */ function unapply(func) { return function (thisArg) { @@ -67,8 +67,8 @@ function unapply(func) { /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * - * @param {(...args: any[]) => T} func - The constructor function to be wrapped and called. - * @returns { (...args: any[]) => T} A new function that constructs an instance of the given constructor function with the provided arguments. + * @param func - The constructor function to be wrapped and called. + * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ function unconstruct(func) { return function () { @@ -81,10 +81,10 @@ function unconstruct(func) { /** * Add properties to a lookup table * - * @param {Record} set - The set to which elements will be added. - * @param {readonly any[]} array - The array containing elements to be added to the set. - * @param {ReturnType>} transformCaseFunc - An optional function to transform the case of each element before adding to the set. - * @returns {Record} The modified set with added elements. + * @param set - The set to which elements will be added. + * @param array - The array containing elements to be added to the set. + * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns The modified set with added elements. */ function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; @@ -114,8 +114,8 @@ function addToSet(set, array) { /** * Clean up an array to harden against CSPP * - * @param {T[]} array - The array to be cleaned. - * @returns {Array} The cleaned version of the array + * @param array - The array to be cleaned. + * @returns The cleaned version of the array */ function cleanArray(array) { for (let index = 0; index < array.length; index++) { @@ -129,8 +129,8 @@ function cleanArray(array) { /** * Shallow clone an object * - * @param {T} object - The object to be cloned. - * @returns {T} A new object that copies the original. + * @param object - The object to be cloned. + * @returns A new object that copies the original. */ function clone(object) { const newObject = create(null); @@ -151,9 +151,9 @@ function clone(object) { /** * This method automatically checks if the prop is function or getter and behaves accordingly. * - * @param {T} object - The object to look up the getter function in its prototype chain. - * @param {string} prop - The property name for which to find the getter function. - * @returns {ReturnType> | (() => null)} The getter function found in the prototype chain or a fallback function. + * @param object - The object to look up the getter function in its prototype chain. + * @param prop - The property name for which to find the getter function. + * @returns The getter function found in the prototype chain or a fallback function. */ function lookupGetter(object, prop) { while (object !== null) { diff --git a/dist/purify.es.mjs b/dist/purify.es.mjs index d88e003bd..0af926b4d 100644 --- a/dist/purify.es.mjs +++ b/dist/purify.es.mjs @@ -51,8 +51,8 @@ const typeErrorCreate = unconstruct(TypeError); /** * Creates a new function that calls the given function with a specified thisArg and arguments. * - * @param {(thisArg: any, ...args: any[]) => T} func - The function to be wrapped and called. - * @returns {(thisArg: any, ...args: any[]) => T} A new function that calls the given function with a specified thisArg and arguments. + * @param func - The function to be wrapped and called. + * @returns A new function that calls the given function with a specified thisArg and arguments. */ function unapply(func) { return function (thisArg) { @@ -65,8 +65,8 @@ function unapply(func) { /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * - * @param {(...args: any[]) => T} func - The constructor function to be wrapped and called. - * @returns { (...args: any[]) => T} A new function that constructs an instance of the given constructor function with the provided arguments. + * @param func - The constructor function to be wrapped and called. + * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ function unconstruct(func) { return function () { @@ -79,10 +79,10 @@ function unconstruct(func) { /** * Add properties to a lookup table * - * @param {Record} set - The set to which elements will be added. - * @param {readonly any[]} array - The array containing elements to be added to the set. - * @param {ReturnType>} transformCaseFunc - An optional function to transform the case of each element before adding to the set. - * @returns {Record} The modified set with added elements. + * @param set - The set to which elements will be added. + * @param array - The array containing elements to be added to the set. + * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns The modified set with added elements. */ function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; @@ -112,8 +112,8 @@ function addToSet(set, array) { /** * Clean up an array to harden against CSPP * - * @param {T[]} array - The array to be cleaned. - * @returns {Array} The cleaned version of the array + * @param array - The array to be cleaned. + * @returns The cleaned version of the array */ function cleanArray(array) { for (let index = 0; index < array.length; index++) { @@ -127,8 +127,8 @@ function cleanArray(array) { /** * Shallow clone an object * - * @param {T} object - The object to be cloned. - * @returns {T} A new object that copies the original. + * @param object - The object to be cloned. + * @returns A new object that copies the original. */ function clone(object) { const newObject = create(null); @@ -149,9 +149,9 @@ function clone(object) { /** * This method automatically checks if the prop is function or getter and behaves accordingly. * - * @param {T} object - The object to look up the getter function in its prototype chain. - * @param {string} prop - The property name for which to find the getter function. - * @returns {ReturnType> | (() => null)} The getter function found in the prototype chain or a fallback function. + * @param object - The object to look up the getter function in its prototype chain. + * @param prop - The property name for which to find the getter function. + * @returns The getter function found in the prototype chain or a fallback function. */ function lookupGetter(object, prop) { while (object !== null) { diff --git a/dist/purify.js b/dist/purify.js index 3d8bb9f7e..a0dd99e6f 100644 --- a/dist/purify.js +++ b/dist/purify.js @@ -57,8 +57,8 @@ /** * Creates a new function that calls the given function with a specified thisArg and arguments. * - * @param {(thisArg: any, ...args: any[]) => T} func - The function to be wrapped and called. - * @returns {(thisArg: any, ...args: any[]) => T} A new function that calls the given function with a specified thisArg and arguments. + * @param func - The function to be wrapped and called. + * @returns A new function that calls the given function with a specified thisArg and arguments. */ function unapply(func) { return function (thisArg) { @@ -71,8 +71,8 @@ /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * - * @param {(...args: any[]) => T} func - The constructor function to be wrapped and called. - * @returns { (...args: any[]) => T} A new function that constructs an instance of the given constructor function with the provided arguments. + * @param func - The constructor function to be wrapped and called. + * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ function unconstruct(func) { return function () { @@ -85,10 +85,10 @@ /** * Add properties to a lookup table * - * @param {Record} set - The set to which elements will be added. - * @param {readonly any[]} array - The array containing elements to be added to the set. - * @param {ReturnType>} transformCaseFunc - An optional function to transform the case of each element before adding to the set. - * @returns {Record} The modified set with added elements. + * @param set - The set to which elements will be added. + * @param array - The array containing elements to be added to the set. + * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns The modified set with added elements. */ function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; @@ -118,8 +118,8 @@ /** * Clean up an array to harden against CSPP * - * @param {T[]} array - The array to be cleaned. - * @returns {Array} The cleaned version of the array + * @param array - The array to be cleaned. + * @returns The cleaned version of the array */ function cleanArray(array) { for (let index = 0; index < array.length; index++) { @@ -133,8 +133,8 @@ /** * Shallow clone an object * - * @param {T} object - The object to be cloned. - * @returns {T} A new object that copies the original. + * @param object - The object to be cloned. + * @returns A new object that copies the original. */ function clone(object) { const newObject = create(null); @@ -155,9 +155,9 @@ /** * This method automatically checks if the prop is function or getter and behaves accordingly. * - * @param {T} object - The object to look up the getter function in its prototype chain. - * @param {string} prop - The property name for which to find the getter function. - * @returns {ReturnType> | (() => null)} The getter function found in the prototype chain or a fallback function. + * @param object - The object to look up the getter function in its prototype chain. + * @param prop - The property name for which to find the getter function. + * @returns The getter function found in the prototype chain or a fallback function. */ function lookupGetter(object, prop) { while (object !== null) { diff --git a/dist/purify.min.js b/dist/purify.min.js index b57afd564..1d1e78ca7 100644 --- a/dist/purify.min.js +++ b/dist/purify.min.js @@ -57,8 +57,8 @@ /** * Creates a new function that calls the given function with a specified thisArg and arguments. * - * @param {(thisArg: any, ...args: any[]) => T} func - The function to be wrapped and called. - * @returns {(thisArg: any, ...args: any[]) => T} A new function that calls the given function with a specified thisArg and arguments. + * @param func - The function to be wrapped and called. + * @returns A new function that calls the given function with a specified thisArg and arguments. */ function unapply(func) { return function (thisArg) { @@ -71,8 +71,8 @@ /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * - * @param {(...args: any[]) => T} func - The constructor function to be wrapped and called. - * @returns { (...args: any[]) => T} A new function that constructs an instance of the given constructor function with the provided arguments. + * @param func - The constructor function to be wrapped and called. + * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ function unconstruct(func) { return function () { @@ -85,10 +85,10 @@ /** * Add properties to a lookup table * - * @param {Record} set - The set to which elements will be added. - * @param {readonly any[]} array - The array containing elements to be added to the set. - * @param {ReturnType>} transformCaseFunc - An optional function to transform the case of each element before adding to the set. - * @returns {Record} The modified set with added elements. + * @param set - The set to which elements will be added. + * @param array - The array containing elements to be added to the set. + * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns The modified set with added elements. */ function addToSet(set, array) { let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; @@ -118,8 +118,8 @@ /** * Clean up an array to harden against CSPP * - * @param {T[]} array - The array to be cleaned. - * @returns {Array} The cleaned version of the array + * @param array - The array to be cleaned. + * @returns The cleaned version of the array */ function cleanArray(array) { for (let index = 0; index < array.length; index++) { @@ -133,8 +133,8 @@ /** * Shallow clone an object * - * @param {T} object - The object to be cloned. - * @returns {T} A new object that copies the original. + * @param object - The object to be cloned. + * @returns A new object that copies the original. */ function clone(object) { const newObject = create(null); @@ -155,9 +155,9 @@ /** * This method automatically checks if the prop is function or getter and behaves accordingly. * - * @param {T} object - The object to look up the getter function in its prototype chain. - * @param {string} prop - The property name for which to find the getter function. - * @returns {ReturnType> | (() => null)} The getter function found in the prototype chain or a fallback function. + * @param object - The object to look up the getter function in its prototype chain. + * @param prop - The property name for which to find the getter function. + * @returns The getter function found in the prototype chain or a fallback function. */ function lookupGetter(object, prop) { while (object !== null) { diff --git a/src/utils.ts b/src/utils.ts index 6d93fb11e..fd2d1e0d9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -55,30 +55,32 @@ const typeErrorCreate = unconstruct(TypeError); /** * Creates a new function that calls the given function with a specified thisArg and arguments. * - * @param {(thisArg: any, ...args: any[]) => T} func - The function to be wrapped and called. - * @returns {(thisArg: any, ...args: any[]) => T} A new function that calls the given function with a specified thisArg and arguments. + * @param func - The function to be wrapped and called. + * @returns A new function that calls the given function with a specified thisArg and arguments. */ -function unapply(func: (thisArg: any, ...args: any[]) => T) { +function unapply( + func: (thisArg: any, ...args: any[]) => T +): (thisArg: any, ...args: any[]) => T { return (thisArg: any, ...args: any[]): T => apply(func, thisArg, args); } /** * Creates a new function that constructs an instance of the given constructor function with the provided arguments. * - * @param {(...args: any[]) => T} func - The constructor function to be wrapped and called. - * @returns { (...args: any[]) => T} A new function that constructs an instance of the given constructor function with the provided arguments. + * @param func - The constructor function to be wrapped and called. + * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ -function unconstruct(func: (...args: any[]) => T) { +function unconstruct(func: (...args: any[]) => T): (...args: any[]) => T { return (...args: any[]): T => construct(func, args); } /** * Add properties to a lookup table * - * @param {Record} set - The set to which elements will be added. - * @param {readonly any[]} array - The array containing elements to be added to the set. - * @param {ReturnType>} transformCaseFunc - An optional function to transform the case of each element before adding to the set. - * @returns {Record} The modified set with added elements. + * @param set - The set to which elements will be added. + * @param array - The array containing elements to be added to the set. + * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns The modified set with added elements. */ function addToSet( set: Record, @@ -116,8 +118,8 @@ function addToSet( /** * Clean up an array to harden against CSPP * - * @param {T[]} array - The array to be cleaned. - * @returns {Array} The cleaned version of the array + * @param array - The array to be cleaned. + * @returns The cleaned version of the array */ function cleanArray(array: T[]): Array { for (let index = 0; index < array.length; index++) { @@ -134,8 +136,8 @@ function cleanArray(array: T[]): Array { /** * Shallow clone an object * - * @param {T} object - The object to be cloned. - * @returns {T} A new object that copies the original. + * @param object - The object to be cloned. + * @returns A new object that copies the original. */ function clone>(object: T): T { const newObject = create(null); @@ -164,9 +166,9 @@ function clone>(object: T): T { /** * This method automatically checks if the prop is function or getter and behaves accordingly. * - * @param {T} object - The object to look up the getter function in its prototype chain. - * @param {string} prop - The property name for which to find the getter function. - * @returns {ReturnType> | (() => null)} The getter function found in the prototype chain or a fallback function. + * @param object - The object to look up the getter function in its prototype chain. + * @param prop - The property name for which to find the getter function. + * @returns The getter function found in the prototype chain or a fallback function. */ function lookupGetter>( object: T,