helpful-functions
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -6,3 +6,12 @@ /** | ||
* @returns true or false answering the question -> isEmpty? | ||
* | ||
*/ | ||
export declare const isEmpty: (array: any[]) => boolean; | ||
/** | ||
* Creates a deep copy of an array | ||
* | ||
* @param array given any type of array | ||
* @returns new copy of the array with value semantics | ||
* | ||
*/ | ||
export declare const copyArray: (array: any[]) => any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEmpty = void 0; | ||
exports.copyArray = exports.isEmpty = void 0; | ||
/** | ||
@@ -9,5 +9,15 @@ * Function that returns if the array is empty or not | ||
* @returns true or false answering the question -> isEmpty? | ||
* | ||
*/ | ||
const isEmpty = (array) => !(array.length > 0); | ||
exports.isEmpty = isEmpty; | ||
/** | ||
* Creates a deep copy of an array | ||
* | ||
* @param array given any type of array | ||
* @returns new copy of the array with value semantics | ||
* | ||
*/ | ||
const copyArray = (array) => JSON.parse(JSON.stringify(array)); | ||
exports.copyArray = copyArray; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "helpful-functions", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/", |
@@ -6,3 +6,18 @@ /** | ||
* @returns true or false answering the question -> isEmpty? | ||
* | ||
*/ | ||
export const isEmpty = (array: any[]): boolean => !(array.length > 0); | ||
export const isEmpty = <T>(array: T[]): boolean => !(array.length > 0); | ||
/** | ||
* Creates a deep copy of an array | ||
* | ||
* @param array given any type of array | ||
* @returns new copy of the array with value semantics | ||
* | ||
*/ | ||
export const copyArray = <T>(array: T[]): T[] => | ||
JSON.parse(JSON.stringify(array)); | ||
// const main = () => { | ||
// }; | ||
// main(); |
Sorry, the diff of this file is not supported yet
10103
122