@xylabs/object
Advanced tools
Comparing version 3.6.7 to 3.6.8
@@ -14,9 +14,9 @@ { | ||
"dependencies": { | ||
"@xylabs/assert": "^3.6.7", | ||
"@xylabs/logger": "^3.6.7", | ||
"@xylabs/promise": "^3.6.7" | ||
"@xylabs/assert": "^3.6.8", | ||
"@xylabs/logger": "^3.6.8", | ||
"@xylabs/promise": "^3.6.8" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^3.15.4", | ||
"@xylabs/tsconfig": "^3.15.4", | ||
"@xylabs/ts-scripts-yarn3": "^3.15.5", | ||
"@xylabs/tsconfig": "^3.15.5", | ||
"typescript": "^5.5.4" | ||
@@ -62,4 +62,4 @@ }, | ||
"sideEffects": false, | ||
"version": "3.6.7", | ||
"version": "3.6.8", | ||
"type": "module" | ||
} |
@@ -138,4 +138,4 @@ import { assertEx } from '@xylabs/assert' | ||
private static gcClass(className: BaseClassName) { | ||
//remove all the weak refs that are now empty | ||
this.globalInstances[className] = this.globalInstances[className]?.filter((ref) => ref.deref() !== null) ?? [] | ||
// remove all the weak refs that are now empty | ||
this.globalInstances[className] = this.globalInstances[className]?.filter(ref => ref.deref() !== null) ?? [] | ||
} | ||
@@ -142,0 +142,0 @@ |
@@ -6,2 +6,3 @@ import { TypedObject } from '@xylabs/promise' | ||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
export interface ObjectTypeConfig extends TypeCheckConfig {} | ||
@@ -16,3 +17,3 @@ | ||
return ( | ||
//do primary check | ||
// do primary check | ||
Object.entries(shape ?? {}).filter(([key, type]) => { | ||
@@ -26,5 +27,5 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return !result | ||
}).length === 0 && | ||
//perform additional checks | ||
(additionalChecks?.reduce((prev, check) => prev && check(obj, { log }), true) ?? true) | ||
}).length === 0 | ||
// perform additional checks | ||
&& (additionalChecks?.reduce((prev, check) => prev && check(obj, { log }), true) ?? true) | ||
) | ||
@@ -31,0 +32,0 @@ } |
@@ -18,7 +18,7 @@ export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function' | ||
case 'object': { | ||
//nulls resolve to objects, so exclude them | ||
// nulls resolve to objects, so exclude them | ||
if (value === null) { | ||
return false | ||
} | ||
//arrays resolve to objects, so exclude them | ||
// arrays resolve to objects, so exclude them | ||
return typeofValue === 'object' && !Array.isArray(value) | ||
@@ -25,0 +25,0 @@ } |
@@ -21,3 +21,3 @@ import { isObject } from './isObject.ts' | ||
export const isJsonArray = (value: unknown): value is JsonArray => { | ||
return Array.isArray(value) && !value.some((item) => !isJsonValue(item)) | ||
return Array.isArray(value) && !value.some(item => !isJsonValue(item)) | ||
} | ||
@@ -31,6 +31,6 @@ | ||
return ( | ||
isObject(value) && | ||
//check if all keys are strings | ||
!Object.entries(value).some((item) => !isValidJsonFieldPair(item)) | ||
isObject(value) | ||
// check if all keys are strings | ||
&& !Object.entries(value).some(item => !isValidJsonFieldPair(item)) | ||
) | ||
} |
@@ -9,2 +9,3 @@ import { EmptyObject } from './EmptyObject.ts' | ||
} | ||
protected get stringKeyObj() { | ||
@@ -11,0 +12,0 @@ return this.obj as StringKeyObject |
import { JsonArray, JsonObject, JsonValue } from './JsonObject.ts' | ||
const toJsonArray = (value: unknown[], cycleList?: unknown[], maxDepth = 3): JsonArray => { | ||
return value.map((item) => toJsonValue(item, cycleList, maxDepth)) | ||
return value.map(item => toJsonValue(item, cycleList, maxDepth)) | ||
} | ||
@@ -6,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
403666
2905
Updated@xylabs/assert@^3.6.8
Updated@xylabs/logger@^3.6.8
Updated@xylabs/promise@^3.6.8