X Tutup
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/core/src/util/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,11 @@ export function throwError(msg: string, actual?: any, expected?: any, comparison
}

export function assertDomNode(node: any): asserts node is Node {
// If we're in a worker, `Node` will not be defined.
if (!(typeof Node !== 'undefined' && node instanceof Node) &&
!(typeof node === 'object' && node != null &&
node.constructor.name === 'WebWorkerRenderNode')) {
if (!(node instanceof Node)) {
throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
}
}


export function assertIndexInRange(arr: any[], index: number) {
assertDefined(arr, 'Array must be defined.');
const maxLen = arr.length;
Expand All @@ -124,7 +120,6 @@ export function assertIndexInRange(arr: any[], index: number) {
}
}


export function assertOneOf(value: any, ...validValues: any[]) {
if (validValues.indexOf(value) !== -1) return true;
throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${
Expand Down
X Tutup