🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@xylabs/object

Package Overview
Dependencies
Maintainers
7
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/object - npm Package Compare versions

Comparing version

to
3.0.3

dist/browser/toJson.d.cts

1

dist/browser/index.d.ts

@@ -15,4 +15,5 @@ export * from './AnyObject';

export * from './StringKeyObject';
export * from './toJson';
export * from './Validator';
export * from './WithAdditional';
//# sourceMappingURL=index.d.ts.map

@@ -151,2 +151,40 @@ var __defProp = Object.defineProperty;

// src/toJson.ts
var toJsonArray = /* @__PURE__ */ __name((value, cycleList) => {
return value.map((item) => toJsonValue(item, cycleList));
}, "toJsonArray");
var toJsonObject = /* @__PURE__ */ __name((value, cycleList) => {
const result = {};
for (const [key, entry] of Object.entries(value)) {
result[key] = value === void 0 ? "[Undefined]" : toJsonValue(entry, cycleList);
}
return result;
}, "toJsonObject");
var toJsonValue = /* @__PURE__ */ __name((value, cycleList) => {
if (cycleList?.includes(value)) {
return "[Circular]";
}
switch (typeof value) {
case "string":
case "boolean":
case "number": {
return value;
}
case "object": {
if (value === null) {
return null;
}
const newCycleList = cycleList ?? [];
newCycleList.push(value);
return Array.isArray(value) ? toJsonArray(value) : toJsonObject(value);
}
default: {
return `[${typeof value}]`;
}
}
}, "toJsonValue");
var toJson = /* @__PURE__ */ __name((value) => {
return toJsonValue(value);
}, "toJson");
// src/Validator.ts

@@ -171,4 +209,5 @@ var ValidatorBase = class extends ObjectWrapper {

isType,
isValidJsonFieldPair
isValidJsonFieldPair,
toJson
};
//# sourceMappingURL=index.js.map

@@ -15,4 +15,5 @@ export * from './AnyObject';

export * from './StringKeyObject';
export * from './toJson';
export * from './Validator';
export * from './WithAdditional';
//# sourceMappingURL=index.d.ts.map

@@ -155,2 +155,40 @@ var __defProp = Object.defineProperty;

// src/toJson.ts
var toJsonArray = /* @__PURE__ */ __name((value, cycleList) => {
return value.map((item) => toJsonValue(item, cycleList));
}, "toJsonArray");
var toJsonObject = /* @__PURE__ */ __name((value, cycleList) => {
const result = {};
for (const [key, entry] of Object.entries(value)) {
result[key] = value === void 0 ? "[Undefined]" : toJsonValue(entry, cycleList);
}
return result;
}, "toJsonObject");
var toJsonValue = /* @__PURE__ */ __name((value, cycleList) => {
if (cycleList == null ? void 0 : cycleList.includes(value)) {
return "[Circular]";
}
switch (typeof value) {
case "string":
case "boolean":
case "number": {
return value;
}
case "object": {
if (value === null) {
return null;
}
const newCycleList = cycleList ?? [];
newCycleList.push(value);
return Array.isArray(value) ? toJsonArray(value) : toJsonObject(value);
}
default: {
return `[${typeof value}]`;
}
}
}, "toJsonValue");
var toJson = /* @__PURE__ */ __name((value) => {
return toJsonValue(value);
}, "toJson");
// src/Validator.ts

@@ -174,4 +212,5 @@ var _ValidatorBase = class _ValidatorBase extends ObjectWrapper {

isType,
isValidJsonFieldPair
isValidJsonFieldPair,
toJson
};
//# sourceMappingURL=index.js.map

8

package.json

@@ -14,5 +14,5 @@ {

"dependencies": {
"@xylabs/assert": "^3.0.2",
"@xylabs/logger": "^3.0.2",
"@xylabs/promise": "^3.0.2"
"@xylabs/assert": "^3.0.3",
"@xylabs/logger": "^3.0.3",
"@xylabs/promise": "^3.0.3"
},

@@ -62,4 +62,4 @@ "devDependencies": {

"sideEffects": false,
"version": "3.0.2",
"version": "3.0.3",
"type": "module"
}

@@ -15,3 +15,4 @@ export * from './AnyObject'

export * from './StringKeyObject'
export * from './toJson'
export * from './Validator'
export * from './WithAdditional'

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