Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xylabs/object

Package Overview
Dependencies
Maintainers
7
Versions
101
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 3.0.2 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc