oberknecht-utils
Advanced tools
Comparing version 1.7.8 to 1.7.9
@@ -1,1 +0,1 @@ | ||
export declare function convertToArray<returnundefinedBoolean extends boolean>(arr: Array<any> | any, returnundefined?: returnundefinedBoolean | undefined): returnundefinedBoolean extends true ? Array<any> | undefined : Array<any>; | ||
export declare function convertToArray<returnundefinedBoolean extends boolean>(arr: Array<any> | any, returnundefined?: returnundefinedBoolean | undefined, noRecreate?: boolean): returnundefinedBoolean extends true ? Array<any> | undefined : Array<any>; |
@@ -6,4 +6,4 @@ "use strict"; | ||
const recreate_1 = require("../recreate"); | ||
function convertToArray(arr, returnundefined) { | ||
let arr_ = (0, recreate_1.recreate)(arr); | ||
function convertToArray(arr, returnundefined, noRecreate) { | ||
let arr_ = !noRecreate ? (0, recreate_1.recreate)(arr) : arr; | ||
if ((0, __1.isNullUndefined)(arr_)) | ||
@@ -10,0 +10,0 @@ return returnundefined ? undefined : []; |
@@ -78,3 +78,3 @@ "use strict"; | ||
let cte = tco.time; | ||
if (((i !== Object.keys(t).length - 1 || !noMS) && | ||
if (((i > Object.keys(t).length - 1 || !noMS) && | ||
["auto"].includes(timedigits_) && | ||
@@ -81,0 +81,0 @@ u < autonum) || |
@@ -14,9 +14,9 @@ "use strict"; | ||
let byPattern_ = !(0, _1.isNullUndefined)(byPattern) ? byPattern : false; | ||
patternIDs = patternID_ ?? patternIDs; | ||
chars = chars_ ?? defaultChars; | ||
usedIDs = usedIDs_ ?? usedIDs; | ||
patternIDs = (0, _1.extendedTypeof)(patternID_) === "array" ? patternID_ : patternIDs; | ||
chars = (0, _1.extendedTypeof)(chars_) === "string" ? chars_ : defaultChars; | ||
usedIDs = (0, _1.extendedTypeof)(usedIDs_) === "array" ? usedIDs_ : usedIDs; | ||
let length_ = length ?? 5; | ||
let r = ""; | ||
function actualCreateID() { | ||
if (usedIDs.length > (chars.length ^ length_)) | ||
if ((usedIDs?.length ?? 0) > (chars.length ^ length_)) | ||
length_++; | ||
@@ -27,6 +27,8 @@ let r2 = ""; | ||
} | ||
if (preventDuplicates_ && usedIDs.includes(r2)) | ||
if ((0, _1.extendedTypeof)(usedIDs) !== "array") | ||
usedIDs = []; | ||
if (preventDuplicates_ && usedIDs?.includes(r2)) | ||
return actualCreateID(); | ||
if (!usedIDs.includes(r2)) | ||
usedIDs.push(r2); | ||
if (!usedIDs?.includes(r2)) | ||
usedIDs?.push(r2); | ||
r = r2; | ||
@@ -33,0 +35,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
function go(o2, arr) { | ||
Object.keys(o2).forEach((a) => { | ||
Object.keys(o2 ?? {})?.forEach((a) => { | ||
if ((0, __1.extendedTypeof)(o2[a]) === "json" && | ||
@@ -11,0 +11,0 @@ (Object.keys(o2[a]).length ?? 0) > 0) { |
@@ -6,7 +6,8 @@ import { isNullUndefined } from ".."; | ||
arr: Array<any> | any, | ||
returnundefined?: returnundefinedBoolean | undefined | ||
returnundefined?: returnundefinedBoolean | undefined, | ||
noRecreate?: boolean | ||
): returnundefinedBoolean extends true ? Array<any> | undefined : Array<any> { | ||
let arr_ = recreate(arr); | ||
let arr_ = !noRecreate ? recreate(arr) : arr; | ||
if (isNullUndefined(arr_)) return returnundefined ? (undefined as any) : []; | ||
return !Array.isArray(arr_) ? [arr_] : arr_; | ||
} |
@@ -89,3 +89,3 @@ import { extendedTypeof } from "./extendedTypeof"; | ||
if ( | ||
((i !== Object.keys(t).length - 1 || !noMS) && | ||
((i > Object.keys(t).length - 1 || !noMS) && | ||
["auto"].includes(timedigits_) && | ||
@@ -92,0 +92,0 @@ u < autonum) || |
@@ -1,2 +0,2 @@ | ||
import { isNullUndefined } from "."; | ||
import { extendedTypeof, isNullUndefined } from "."; | ||
const defaultChars = | ||
@@ -21,5 +21,5 @@ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; | ||
let byPattern_ = !isNullUndefined(byPattern) ? byPattern : false; | ||
patternIDs = patternID_ ?? patternIDs; | ||
chars = chars_ ?? defaultChars; | ||
usedIDs = usedIDs_ ?? usedIDs; | ||
patternIDs = extendedTypeof(patternID_) === "array" ? patternID_ : patternIDs; | ||
chars = extendedTypeof(chars_) === "string" ? chars_ : defaultChars; | ||
usedIDs = extendedTypeof(usedIDs_) === "array" ? usedIDs_ : usedIDs; | ||
@@ -30,3 +30,3 @@ let length_ = length ?? 5; | ||
function actualCreateID() { | ||
if (usedIDs.length > (chars.length ^ length_)) length_++; | ||
if ((usedIDs?.length ?? 0) > (chars.length ^ length_)) length_++; | ||
@@ -38,4 +38,5 @@ let r2 = ""; | ||
if (preventDuplicates_ && usedIDs.includes(r2)) return actualCreateID(); | ||
if (!usedIDs.includes(r2)) usedIDs.push(r2); | ||
if (extendedTypeof(usedIDs) !== "array") usedIDs = []; | ||
if (preventDuplicates_ && usedIDs?.includes(r2)) return actualCreateID(); | ||
if (!usedIDs?.includes(r2)) usedIDs?.push(r2); | ||
r = r2; | ||
@@ -42,0 +43,0 @@ } |
@@ -10,3 +10,3 @@ import { getKeyArraysFromObjectReturn } from "../../types/getKeyArraysFromObject"; | ||
function go(o2: Record<string, any>, arr: string[]) { | ||
Object.keys(o2).forEach((a) => { | ||
Object.keys(o2 ?? {})?.forEach((a) => { | ||
if ( | ||
@@ -13,0 +13,0 @@ extendedTypeof(o2[a]) === "json" && |
{ | ||
"name": "oberknecht-utils", | ||
"version": "1.7.8", | ||
"version": "1.7.9", | ||
"description": "Utils for oberknecht packages", | ||
@@ -5,0 +5,0 @@ "main": "./lib-ts/utils/index", |
173614
4744