@blocksuite/global
Advanced tools
Comparing version 0.5.0-20230303194346-1eb65e7 to 0.5.0-20230304183717-8ea9932
@@ -10,2 +10,3 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
export declare function assertExists<T>(val: T | null | undefined, message?: string): asserts val is T; | ||
export declare function assertNotExists<T>(val: T | null | undefined, message?: string): asserts val is null | undefined; | ||
export declare function assertFlavours(model: { | ||
@@ -12,0 +13,0 @@ flavour: string; |
@@ -14,2 +14,7 @@ export { DisposableGroup, flattenDisposable } from './utils/disposable.js'; | ||
} | ||
export function assertNotExists(val, message = 'val exists') { | ||
if (val !== null && val !== undefined) { | ||
throw new Error(message); | ||
} | ||
} | ||
export function assertFlavours(model, allowed) { | ||
@@ -16,0 +21,0 @@ if (!allowed.includes(model.flavour)) { |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.5.0-20230303194346-1eb65e7", | ||
"version": "0.5.0-20230304183717-8ea9932", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -27,2 +27,11 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
export function assertNotExists<T>( | ||
val: T | null | undefined, | ||
message = 'val exists' | ||
): asserts val is null | undefined { | ||
if (val !== null && val !== undefined) { | ||
throw new Error(message); | ||
} | ||
} | ||
export function assertFlavours(model: { flavour: string }, allowed: string[]) { | ||
@@ -29,0 +38,0 @@ if (!allowed.includes(model.flavour)) { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416826
4486