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

@blocksuite/global

Package Overview
Dependencies
Maintainers
5
Versions
1176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/global - npm Package Compare versions

Comparing version 0.4.0-20230114163139-bef702b to 0.4.0-20230115125610-fb61886

3

dist/utils.d.ts

@@ -10,2 +10,5 @@ export declare const SYS_KEYS: Set<string>;

}, expected: Key[]): boolean;
type Allowed = null | undefined | boolean | number | string | Record<string, unknown> | unknown[];
export declare function assertEquals<T extends Allowed, U extends T>(val: T, expected: U): asserts val is U;
export {};
//# sourceMappingURL=utils.d.ts.map

@@ -19,2 +19,30 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']);

}
export function assertEquals(val, expected) {
const a = isPrimitive(val);
const b = isPrimitive(expected);
if (a && b) {
if (!Object.is(a, b)) {
throw new Error('val is not same as expected');
}
}
else if (a !== b) {
throw new Error('val is not same as expected');
}
else {
if (Array.isArray(val) && Array.isArray(expected)) {
if (val.length !== expected.length) {
throw new Error('val is not same as expected');
}
val.every((x, i) => assertEquals(x, expected[i]));
}
else if (typeof val === 'object' && typeof expected === 'object') {
const obj1 = Object.entries(val);
const obj2 = Object.entries(expected);
if (obj1.length !== obj2.length) {
throw new Error('val is not same as expected');
}
obj1.every((x, i) => assertEquals(x, obj2[i]));
}
}
}
//# sourceMappingURL=utils.js.map

@@ -22,2 +22,3 @@ declare module 'quill' {

enable_drag_handle: boolean;
enable_surface: boolean;
readonly: Record<string, boolean>;

@@ -24,0 +25,0 @@ };

2

package.json
{
"name": "@blocksuite/global",
"version": "0.4.0-20230114163139-bef702b",
"version": "0.4.0-20230115125610-fb61886",
"types": "./index.d.ts",

@@ -5,0 +5,0 @@ "type": "module",

@@ -31,1 +31,38 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']);

}
type Allowed =
| null
| undefined
| boolean
| number
| string
| Record<string, unknown>
| unknown[];
export function assertEquals<T extends Allowed, U extends T>(
val: T,
expected: U
): asserts val is U {
const a = isPrimitive(val);
const b = isPrimitive(expected);
if (a && b) {
if (!Object.is(a, b)) {
throw new Error('val is not same as expected');
}
} else if (a !== b) {
throw new Error('val is not same as expected');
} else {
if (Array.isArray(val) && Array.isArray(expected)) {
if (val.length !== expected.length) {
throw new Error('val is not same as expected');
}
val.every((x, i) => assertEquals(x, expected[i]));
} else if (typeof val === 'object' && typeof expected === 'object') {
const obj1 = Object.entries(val as Record<string, unknown>);
const obj2 = Object.entries(expected as Record<string, unknown>);
if (obj1.length !== obj2.length) {
throw new Error('val is not same as expected');
}
obj1.every((x, i) => assertEquals(x, obj2[i]));
}
}
}

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