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

@xylabs/platform

Package Overview
Dependencies
Maintainers
5
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/platform - npm Package Compare versions

Comparing version 4.0.10 to 4.1.0

1

dist/browser/index.d.ts
import type { subtle as subtleType } from 'node:crypto';
export declare const isBrowser: () => boolean;
export declare const isWebworker: () => boolean;
export declare const getGlobal: <T extends object>() => typeof globalThis | T;
export declare const subtle: typeof subtleType;
//# sourceMappingURL=index.d.ts.map
export { subtle } from 'node:crypto';
export declare const isBrowser: () => boolean;
export declare const isWebworker: () => boolean;
export declare const getGlobal: <T extends object>() => typeof globalThis | T;
//# sourceMappingURL=index.d.ts.map

10

package.json
{
"name": "@xylabs/platform",
"version": "4.0.10",
"version": "4.1.0",
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",

@@ -49,6 +49,6 @@ "keywords": [

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"@xylabs/tsconfig-dom": "^4.0.7",
"typescript": "^5.5.4"
"@xylabs/ts-scripts-yarn3": "^4.1.0",
"@xylabs/tsconfig": "^4.1.0",
"@xylabs/tsconfig-dom": "^4.1.0",
"typescript": "^5.6.2"
},

@@ -55,0 +55,0 @@ "engines": {

import type { subtle as subtleType } from 'node:crypto'
export const isBrowser = () => {
return !isWebworker() && self.constructor?.name === 'Window'
return !isWebworker() && globalThis.constructor?.name === 'Window'
}
export const isWebworker = () => {
return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'
return typeof globalThis === 'object' && globalThis.constructor?.name === 'DedicatedWorkerGlobalScope'
}
export const getGlobal = <T extends object>() =>
isWebworker()
? (self as unknown as T)
: isBrowser()
? (window as unknown as T)
: globalThis
export const subtle = getGlobal<Window>().crypto.subtle as typeof subtleType
export const subtle = globalThis.crypto.subtle as typeof subtleType

@@ -10,8 +10,1 @@ export { subtle } from 'node:crypto'

}
export const getGlobal = <T extends object>() =>
isBrowser()
? (window as unknown as T)
: isWebworker()
? (self as unknown as T)
: globalThis

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