From 22b2fc9a65a6e8be90f41511b24cf998674fa72e Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Sat, 5 Feb 2022 09:39:39 +0100 Subject: [PATCH] Update inc --- dist/fn-tools.js | 18 ++++++++++-------- fn-tools.ts | 17 +++++++++++------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/dist/fn-tools.js b/dist/fn-tools.js index 0a8e3be..9fbb6e0 100644 --- a/dist/fn-tools.js +++ b/dist/fn-tools.js @@ -32,8 +32,14 @@ function updateJSON(key, newValue, json) { * @return {Array} Sequence. * @example * - * range(1, 4) - * // => [1, 2, 3, 4] + * range(4) + * // => [0, 1, 2, 3, 4] + * + * range(2, 4) + * // => [2, 3, 4] + * + * range(0, 9, 3) + * // => [0, 3, 6, 9] */ function range(start, stop = null, step = 1) { const startArray = stop === null ? 0 : start; @@ -51,9 +57,7 @@ function range(start, stop = null, step = 1) { * // => [2, 1] */ function uniqValuesArray(array) { - return (array != null && array.length) - ? Array.from(new Set(array)) - : []; + return Array.from(new Set(array)); } /** * Increase the value of a `number`. @@ -74,13 +78,11 @@ function uniqValuesArray(array) { * */ function inc(number, increase = 1) { - return number - increase; + return number + increase; } /** * Decrease the value of a `number`. * - * @since 4.17.15 - * @category Math * @param {number} number - The number to decrease. * @param {number} number - Decrease. * @return {number} Returns the decrease. diff --git a/fn-tools.ts b/fn-tools.ts index 8e515f7..0afc54c 100644 --- a/fn-tools.ts +++ b/fn-tools.ts @@ -27,6 +27,7 @@ function updateJSON(key: string, newValue: any, json: JSON): JSON { }, {}); } + /** * Returns an array with a sequence. * @@ -36,8 +37,14 @@ function updateJSON(key: string, newValue: any, json: JSON): JSON { * @return {Array} Sequence. * @example * - * range(1, 4) - * // => [1, 2, 3, 4] + * range(4) + * // => [0, 1, 2, 3, 4] + * + * range(2, 4) + * // => [2, 3, 4] + * + * range(0, 9, 3) + * // => [0, 3, 6, 9] */ function range(start: number, stop: number | null=null, step: number=1): number[] { const startArray = stop === null ? 0 : start; @@ -57,9 +64,7 @@ function range(start: number, stop: number | null=null, step: number=1): number[ * // => [2, 1] */ function uniqValuesArray(array: any[]): any[] { - return (array != null && array.length) - ? Array.from(new Set(array)) - : []; + return Array.from(new Set(array)); } @@ -82,7 +87,7 @@ function uniqValuesArray(array: any[]): any[] { * */ function inc(number: number, increase: number=1): number { - return number - increase; + return number + increase; }