Socket
Socket
Sign inDemoInstall

@xylabs/object

Package Overview
Dependencies
Maintainers
7
Versions
92
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.1.10 to 3.1.11

1

dist/browser/globallyUnique.d.ts

@@ -0,2 +1,3 @@

export declare const disableGloballyUnique: () => void;
export declare const globallyUnique: (name: string, value: unknown, domain?: string) => string;
//# sourceMappingURL=globallyUnique.d.ts.map

27

dist/browser/index.js

@@ -77,13 +77,21 @@ // src/AsTypeFactory.ts

// src/globallyUnique.ts
var xyoGlobal = () => {
return globalThis.xylabs = globalThis.xylabs ?? {};
};
var disableGloballyUnique = () => {
xyoGlobal().uniqueDisabled = true;
};
var globallyUnique = (name, value, domain = "global") => {
const uniqueName = [domain, name].join(":");
const xyo = globalThis.xylabs = globalThis.xylabs ?? {};
const unique = xyo.unique = xyo.unique ?? {};
if (unique[uniqueName] === void 0) {
unique[uniqueName] = value;
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`
);
if (!xyoGlobal().uniqueDisabled) {
const xyo = globalThis.xylabs = globalThis.xylabs ?? {};
const unique = xyo.unique = xyo.unique ?? {};
if (unique[uniqueName] === void 0) {
unique[uniqueName] = value;
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`
);
}
}

@@ -329,2 +337,3 @@ }

asAnyObject,
disableGloballyUnique,
globallyUnique,

@@ -331,0 +340,0 @@ isJsonArray,

@@ -0,2 +1,3 @@

export declare const disableGloballyUnique: () => void;
export declare const globallyUnique: (name: string, value: unknown, domain?: string) => string;
//# sourceMappingURL=globallyUnique.d.ts.map

@@ -77,13 +77,21 @@ // src/AsTypeFactory.ts

// src/globallyUnique.ts
var xyoGlobal = () => {
return globalThis.xylabs = globalThis.xylabs ?? {};
};
var disableGloballyUnique = () => {
xyoGlobal().uniqueDisabled = true;
};
var globallyUnique = (name, value, domain = "global") => {
const uniqueName = [domain, name].join(":");
const xyo = globalThis.xylabs = globalThis.xylabs ?? {};
const unique = xyo.unique = xyo.unique ?? {};
if (unique[uniqueName] === void 0) {
unique[uniqueName] = value;
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`
);
if (!xyoGlobal().uniqueDisabled) {
const xyo = globalThis.xylabs = globalThis.xylabs ?? {};
const unique = xyo.unique = xyo.unique ?? {};
if (unique[uniqueName] === void 0) {
unique[uniqueName] = value;
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`
);
}
}

@@ -334,2 +342,3 @@ }

asAnyObject,
disableGloballyUnique,
globallyUnique,

@@ -336,0 +345,0 @@ isJsonArray,

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

"dependencies": {
"@xylabs/assert": "^3.1.10",
"@xylabs/logger": "^3.1.10",
"@xylabs/promise": "^3.1.10"
"@xylabs/assert": "^3.1.11",
"@xylabs/logger": "^3.1.11",
"@xylabs/promise": "^3.1.11"
},

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

"sideEffects": false,
"version": "3.1.10",
"version": "3.1.11",
"type": "module"
}
interface XylabsGlobalThis {
xylabs: {
unique: Record<string, unknown>
uniqueDisabled?: boolean
}
}
const xyoGlobal = () => {
return ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})
}
export const disableGloballyUnique = () => {
xyoGlobal().uniqueDisabled = true
}
export const globallyUnique = (name: string, value: unknown, domain = 'global') => {
const uniqueName = [domain, name].join(':')
const xyo = ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})
const unique = (xyo.unique = xyo.unique ?? {})
if (unique[uniqueName] === undefined) {
unique[uniqueName] = value
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,
)
if (!xyoGlobal().uniqueDisabled) {
const xyo = ((globalThis as unknown as XylabsGlobalThis).xylabs = (globalThis as unknown as XylabsGlobalThis).xylabs ?? {})
const unique = (xyo.unique = xyo.unique ?? {})
if (unique[uniqueName] === undefined) {
unique[uniqueName] = value
} else {
if (unique[uniqueName] !== value) {
throw new Error(
`Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,
)
}
}

@@ -19,0 +30,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

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