Tone.js/test/helper/Dispose.ts
Garren Smith efbd3c7f5f Fix linting issues
Also add in no-unused-expression-chai rule so that chai works with
tslint.
2019-06-23 12:53:57 +02:00

18 lines
509 B
TypeScript

export function isDisposed(instance): void {
for (const prop in instance) {
if (instance.hasOwnProperty(prop)) {
const member = instance[prop];
if (typeof member !== "function" &&
typeof member !== "string" &&
typeof member !== "number" &&
typeof member !== "boolean" &&
typeof member !== "undefined" &&
prop !== "preset" &&
!(member instanceof AudioContext)) {
if (member !== null) {
throw Error("property was not completely disposed: " + prop);
}
}
}
}
}