@forklaunch/common
Advanced tools
+10
-1
@@ -184,2 +184,11 @@ /** | ||
| /** | ||
| * Deep clones an object while removing all undefined values. | ||
| * Preserves methods, getters/setters, non-enumerable properties, symbols, and prototype chains. | ||
| * @param {unknown} obj - The object to clone. | ||
| * @param {WeakMap} seen - Map to track circular references. | ||
| * @returns {unknown} The cloned object without undefined values. | ||
| */ | ||
| declare function deepCloneWithoutUndefined<T>(obj: T, seen?: WeakMap<WeakKey, any>): T; | ||
| /** | ||
| * An empty object literal constant. | ||
@@ -650,2 +659,2 @@ * | ||
| export { type CamelCaseIdentifier, type EmptyObject, type ExclusiveRecord, type Flatten, type FlattenKeys, type FlattenValues, type IdDto, type IdsDto, InMemoryBlob, type InstanceTypeRecord, type MakePropertyOptionalIfChildrenOptional, type MergeArrayOfMaps, type MergeUnionOnCollision, type MimeType, type Prettify, type PrettyCamelCase, type RecordTimingDto, type RemoveDoubleLeadingSlash, type RemoveTrailingSlash, type ReturnTypeRecord, type SanitizePathSlashes, type StringWithoutSlash, type TypeSafeFunction, type UnionToIntersection, type UnionToIntersectionChildren, type ValidIdentifier, capitalize, emptyObject, extractArgumentNames, getEnvVar, getTransformationInfo, hashString, isAsyncGenerator, isNever, isNodeJsWriteableStream, isRecord, isTrue, isValidIdentifier, noop, openApiCompliantPath, readableStreamToAsyncIterable, removeDoubleLeadingSlash, removeLeadingNumbers, removeLeadingSeparators, removeNonAlphanumeric, removeTrailingSlash, safeParse, safeStringify, sanitizePathSlashes, sortObjectKeys, splitBySeparators, stripUndefinedProperties, toCamelCaseIdentifier, toPrettyCamelCase, toRecord, toValidIdentifier, uncapitalize }; | ||
| export { type CamelCaseIdentifier, type EmptyObject, type ExclusiveRecord, type Flatten, type FlattenKeys, type FlattenValues, type IdDto, type IdsDto, InMemoryBlob, type InstanceTypeRecord, type MakePropertyOptionalIfChildrenOptional, type MergeArrayOfMaps, type MergeUnionOnCollision, type MimeType, type Prettify, type PrettyCamelCase, type RecordTimingDto, type RemoveDoubleLeadingSlash, type RemoveTrailingSlash, type ReturnTypeRecord, type SanitizePathSlashes, type StringWithoutSlash, type TypeSafeFunction, type UnionToIntersection, type UnionToIntersectionChildren, type ValidIdentifier, capitalize, deepCloneWithoutUndefined, emptyObject, extractArgumentNames, getEnvVar, getTransformationInfo, hashString, isAsyncGenerator, isNever, isNodeJsWriteableStream, isRecord, isTrue, isValidIdentifier, noop, openApiCompliantPath, readableStreamToAsyncIterable, removeDoubleLeadingSlash, removeLeadingNumbers, removeLeadingSeparators, removeNonAlphanumeric, removeTrailingSlash, safeParse, safeStringify, sanitizePathSlashes, sortObjectKeys, splitBySeparators, stripUndefinedProperties, toCamelCaseIdentifier, toPrettyCamelCase, toRecord, toValidIdentifier, uncapitalize }; |
+10
-1
@@ -184,2 +184,11 @@ /** | ||
| /** | ||
| * Deep clones an object while removing all undefined values. | ||
| * Preserves methods, getters/setters, non-enumerable properties, symbols, and prototype chains. | ||
| * @param {unknown} obj - The object to clone. | ||
| * @param {WeakMap} seen - Map to track circular references. | ||
| * @returns {unknown} The cloned object without undefined values. | ||
| */ | ||
| declare function deepCloneWithoutUndefined<T>(obj: T, seen?: WeakMap<WeakKey, any>): T; | ||
| /** | ||
| * An empty object literal constant. | ||
@@ -650,2 +659,2 @@ * | ||
| export { type CamelCaseIdentifier, type EmptyObject, type ExclusiveRecord, type Flatten, type FlattenKeys, type FlattenValues, type IdDto, type IdsDto, InMemoryBlob, type InstanceTypeRecord, type MakePropertyOptionalIfChildrenOptional, type MergeArrayOfMaps, type MergeUnionOnCollision, type MimeType, type Prettify, type PrettyCamelCase, type RecordTimingDto, type RemoveDoubleLeadingSlash, type RemoveTrailingSlash, type ReturnTypeRecord, type SanitizePathSlashes, type StringWithoutSlash, type TypeSafeFunction, type UnionToIntersection, type UnionToIntersectionChildren, type ValidIdentifier, capitalize, emptyObject, extractArgumentNames, getEnvVar, getTransformationInfo, hashString, isAsyncGenerator, isNever, isNodeJsWriteableStream, isRecord, isTrue, isValidIdentifier, noop, openApiCompliantPath, readableStreamToAsyncIterable, removeDoubleLeadingSlash, removeLeadingNumbers, removeLeadingSeparators, removeNonAlphanumeric, removeTrailingSlash, safeParse, safeStringify, sanitizePathSlashes, sortObjectKeys, splitBySeparators, stripUndefinedProperties, toCamelCaseIdentifier, toPrettyCamelCase, toRecord, toValidIdentifier, uncapitalize }; | ||
| export { type CamelCaseIdentifier, type EmptyObject, type ExclusiveRecord, type Flatten, type FlattenKeys, type FlattenValues, type IdDto, type IdsDto, InMemoryBlob, type InstanceTypeRecord, type MakePropertyOptionalIfChildrenOptional, type MergeArrayOfMaps, type MergeUnionOnCollision, type MimeType, type Prettify, type PrettyCamelCase, type RecordTimingDto, type RemoveDoubleLeadingSlash, type RemoveTrailingSlash, type ReturnTypeRecord, type SanitizePathSlashes, type StringWithoutSlash, type TypeSafeFunction, type UnionToIntersection, type UnionToIntersectionChildren, type ValidIdentifier, capitalize, deepCloneWithoutUndefined, emptyObject, extractArgumentNames, getEnvVar, getTransformationInfo, hashString, isAsyncGenerator, isNever, isNodeJsWriteableStream, isRecord, isTrue, isValidIdentifier, noop, openApiCompliantPath, readableStreamToAsyncIterable, removeDoubleLeadingSlash, removeLeadingNumbers, removeLeadingSeparators, removeNonAlphanumeric, removeTrailingSlash, safeParse, safeStringify, sanitizePathSlashes, sortObjectKeys, splitBySeparators, stripUndefinedProperties, toCamelCaseIdentifier, toPrettyCamelCase, toRecord, toValidIdentifier, uncapitalize }; |
+76
-0
@@ -25,2 +25,3 @@ "use strict"; | ||
| capitalize: () => capitalize, | ||
| deepCloneWithoutUndefined: () => deepCloneWithoutUndefined, | ||
| emptyObject: () => emptyObject, | ||
@@ -149,2 +150,76 @@ extractArgumentNames: () => extractArgumentNames, | ||
| // src/deepCloneWithoutUndefined.ts | ||
| function deepCloneWithoutUndefined(obj, seen = /* @__PURE__ */ new WeakMap()) { | ||
| if (obj === null || obj === void 0) { | ||
| return obj; | ||
| } | ||
| if (typeof obj !== "object" && typeof obj !== "function") { | ||
| return obj; | ||
| } | ||
| if (seen.has(obj)) { | ||
| return seen.get(obj); | ||
| } | ||
| if (obj instanceof Date) { | ||
| return new Date(obj.getTime()); | ||
| } | ||
| if (obj instanceof RegExp) { | ||
| return new RegExp(obj.source, obj.flags); | ||
| } | ||
| if (obj instanceof Map) { | ||
| const clonedMap = /* @__PURE__ */ new Map(); | ||
| seen.set(obj, clonedMap); | ||
| obj.forEach((value, key) => { | ||
| if (value !== void 0) { | ||
| clonedMap.set(key, deepCloneWithoutUndefined(value, seen)); | ||
| } | ||
| }); | ||
| return clonedMap; | ||
| } | ||
| if (obj instanceof Set) { | ||
| const clonedSet = /* @__PURE__ */ new Set(); | ||
| seen.set(obj, clonedSet); | ||
| obj.forEach((value) => { | ||
| if (value !== void 0) { | ||
| clonedSet.add(deepCloneWithoutUndefined(value, seen)); | ||
| } | ||
| }); | ||
| return clonedSet; | ||
| } | ||
| if (Array.isArray(obj)) { | ||
| const clonedArray = []; | ||
| seen.set(obj, clonedArray); | ||
| for (const item of obj) { | ||
| if (item !== void 0) { | ||
| clonedArray.push(deepCloneWithoutUndefined(item, seen)); | ||
| } | ||
| } | ||
| return clonedArray; | ||
| } | ||
| if (typeof obj === "function") { | ||
| return obj; | ||
| } | ||
| const proto = Object.getPrototypeOf(obj); | ||
| const cloned = Object.create(proto); | ||
| seen.set(obj, cloned); | ||
| const allKeys = [ | ||
| ...Object.getOwnPropertyNames(obj), | ||
| ...Object.getOwnPropertySymbols(obj) | ||
| ]; | ||
| for (const key of allKeys) { | ||
| const descriptor = Object.getOwnPropertyDescriptor(obj, key); | ||
| if (!descriptor) continue; | ||
| if ("value" in descriptor) { | ||
| if (descriptor.value !== void 0) { | ||
| Object.defineProperty(cloned, key, { | ||
| ...descriptor, | ||
| value: deepCloneWithoutUndefined(descriptor.value, seen) | ||
| }); | ||
| } | ||
| } else { | ||
| Object.defineProperty(cloned, key, descriptor); | ||
| } | ||
| } | ||
| return cloned; | ||
| } | ||
| // src/emptyObject.ts | ||
@@ -378,2 +453,3 @@ var emptyObject = {}; | ||
| capitalize, | ||
| deepCloneWithoutUndefined, | ||
| emptyObject, | ||
@@ -380,0 +456,0 @@ extractArgumentNames, |
+75
-0
@@ -91,2 +91,76 @@ // src/camelCase.ts | ||
| // src/deepCloneWithoutUndefined.ts | ||
| function deepCloneWithoutUndefined(obj, seen = /* @__PURE__ */ new WeakMap()) { | ||
| if (obj === null || obj === void 0) { | ||
| return obj; | ||
| } | ||
| if (typeof obj !== "object" && typeof obj !== "function") { | ||
| return obj; | ||
| } | ||
| if (seen.has(obj)) { | ||
| return seen.get(obj); | ||
| } | ||
| if (obj instanceof Date) { | ||
| return new Date(obj.getTime()); | ||
| } | ||
| if (obj instanceof RegExp) { | ||
| return new RegExp(obj.source, obj.flags); | ||
| } | ||
| if (obj instanceof Map) { | ||
| const clonedMap = /* @__PURE__ */ new Map(); | ||
| seen.set(obj, clonedMap); | ||
| obj.forEach((value, key) => { | ||
| if (value !== void 0) { | ||
| clonedMap.set(key, deepCloneWithoutUndefined(value, seen)); | ||
| } | ||
| }); | ||
| return clonedMap; | ||
| } | ||
| if (obj instanceof Set) { | ||
| const clonedSet = /* @__PURE__ */ new Set(); | ||
| seen.set(obj, clonedSet); | ||
| obj.forEach((value) => { | ||
| if (value !== void 0) { | ||
| clonedSet.add(deepCloneWithoutUndefined(value, seen)); | ||
| } | ||
| }); | ||
| return clonedSet; | ||
| } | ||
| if (Array.isArray(obj)) { | ||
| const clonedArray = []; | ||
| seen.set(obj, clonedArray); | ||
| for (const item of obj) { | ||
| if (item !== void 0) { | ||
| clonedArray.push(deepCloneWithoutUndefined(item, seen)); | ||
| } | ||
| } | ||
| return clonedArray; | ||
| } | ||
| if (typeof obj === "function") { | ||
| return obj; | ||
| } | ||
| const proto = Object.getPrototypeOf(obj); | ||
| const cloned = Object.create(proto); | ||
| seen.set(obj, cloned); | ||
| const allKeys = [ | ||
| ...Object.getOwnPropertyNames(obj), | ||
| ...Object.getOwnPropertySymbols(obj) | ||
| ]; | ||
| for (const key of allKeys) { | ||
| const descriptor = Object.getOwnPropertyDescriptor(obj, key); | ||
| if (!descriptor) continue; | ||
| if ("value" in descriptor) { | ||
| if (descriptor.value !== void 0) { | ||
| Object.defineProperty(cloned, key, { | ||
| ...descriptor, | ||
| value: deepCloneWithoutUndefined(descriptor.value, seen) | ||
| }); | ||
| } | ||
| } else { | ||
| Object.defineProperty(cloned, key, descriptor); | ||
| } | ||
| } | ||
| return cloned; | ||
| } | ||
| // src/emptyObject.ts | ||
@@ -319,2 +393,3 @@ var emptyObject = {}; | ||
| capitalize, | ||
| deepCloneWithoutUndefined, | ||
| emptyObject, | ||
@@ -321,0 +396,0 @@ extractArgumentNames, |
+1
-1
| { | ||
| "name": "@forklaunch/common", | ||
| "version": "0.6.15", | ||
| "version": "0.6.16", | ||
| "description": "Common package for base types, interfaces, implementations.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/forklaunch/forklaunch-js#readme", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
80117
6.68%1493
11.75%