util-ex
Version:
Browser-friendly enhanced util fully compatible with standard node.js
27 lines (26 loc) • 987 B
TypeScript
/**
* Returns an array containing the values of all enumerable or non-enumerable properties of an object.
*
* @param {Object} aObject - The object to map properties from.
* @param {Object} [aOptions] - Optional parameter to specify options for mapping.
* @param {boolean} [aOptions.enumerable=true] - If true, enumerable properties are included in the mapping.
* @param {boolean} [aOptions.nonEnumerable=false] - If true, non-enumerable properties are included in the mapping.
* @returns {Array} An array containing the mapped property values.
* @example
* const myObj = {a: 1, b: 2, c: 3};
* Object.defineProperty(myObj, 'p', {
* value: 'value2',
* enumerable: false
* });
*
* // Returns [1, 2, 3]
* const result1 = map(myObj);
*
* // Returns ['value2']
* const result2 = map(myObj, {enumerable: false, nonEnumerable: true});
*/
export function map(aObject: any, aOptions?: {
enumerable?: boolean;
nonEnumerable?: boolean;
}): any[];
export default map;