Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

Commit

Permalink
rename assert -> $assert (for power-assert)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohayonao committed Dec 10, 2015
1 parent a46dc09 commit c7f8388
Show file tree
Hide file tree
Showing 26 changed files with 317 additions and 317 deletions.
38 changes: 19 additions & 19 deletions src/AnalyserNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export default class AnalyserNode extends AudioNode {
}

set fftSize(value) {
this._.inspector.describe("fftSize", (assert) => {
this._.inspector.describe("fftSize", ($assert) => {
let enumFFTSize = new Enumerator([
32, 64, 128, 256, 512, 1024, 2048,
]);

assert(enumFFTSize.contains(value), (fmt) => {
$assert(enumFFTSize.contains(value), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(value, "fftSize", enumFFTSize.toString())}
Expand All @@ -50,8 +50,8 @@ export default class AnalyserNode extends AudioNode {
}

set frequencyBinCount(value) {
this._.inspector.describe("frequencyBinCount", (assert) => {
assert.throwReadOnlyTypeError(value);
this._.inspector.describe("frequencyBinCount", ($assert) => {
$assert.throwReadOnlyTypeError(value);
});
}

Expand All @@ -60,8 +60,8 @@ export default class AnalyserNode extends AudioNode {
}

set minDecibels(value) {
this._.inspector.describe("minDecibels", (assert) => {
assert(utils.isNumber(value), (fmt) => {
this._.inspector.describe("minDecibels", ($assert) => {
$assert(utils.isNumber(value), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(value, "minDecibels", "number")}
Expand All @@ -77,8 +77,8 @@ export default class AnalyserNode extends AudioNode {
}

set maxDecibels(value) {
this._.inspector.describe("maxDecibels", (assert) => {
assert(utils.isNumber(value), (fmt) => {
this._.inspector.describe("maxDecibels", ($assert) => {
$assert(utils.isNumber(value), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(value, "maxDecibels", "number")}
Expand All @@ -94,8 +94,8 @@ export default class AnalyserNode extends AudioNode {
}

set smoothingTimeConstant(value) {
this._.inspector.describe("smoothingTimeConstant", (assert) => {
assert(utils.isNumber(value), (fmt) => {
this._.inspector.describe("smoothingTimeConstant", ($assert) => {
$assert(utils.isNumber(value), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(value, "smoothingTimeConstant", "number")}
Expand All @@ -107,8 +107,8 @@ export default class AnalyserNode extends AudioNode {
}

getFloatFrequencyData(array) {
this._.inspector.describe("getFloatFrequencyData", (assert) => {
assert(utils.isInstanceOf(array, Float32Array), (fmt) => {
this._.inspector.describe("getFloatFrequencyData", ($assert) => {
$assert(utils.isInstanceOf(array, Float32Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(array, "array", "Float32Array")}
Expand All @@ -118,8 +118,8 @@ export default class AnalyserNode extends AudioNode {
}

getByteFrequencyData(array) {
this._.inspector.describe("getByteFrequencyData", (assert) => {
assert(utils.isInstanceOf(array, Uint8Array), (fmt) => {
this._.inspector.describe("getByteFrequencyData", ($assert) => {
$assert(utils.isInstanceOf(array, Uint8Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(array, "array", "Uint8Array")}
Expand All @@ -129,14 +129,14 @@ export default class AnalyserNode extends AudioNode {
}

getFloatTimeDomainData(array) {
this._.inspector.describe("getFloatTimeDomainData", (assert) => {
assert(configuration.getState("AnalyserNode#getFloatTimeDomainData") === "enabled", (fmt) => {
this._.inspector.describe("getFloatTimeDomainData", ($assert) => {
$assert(configuration.getState("AnalyserNode#getFloatTimeDomainData") === "enabled", (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
not enabled
`);
});
assert(utils.isInstanceOf(array, Float32Array), (fmt) => {
$assert(utils.isInstanceOf(array, Float32Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(array, "array", "Float32Array")}
Expand All @@ -146,8 +146,8 @@ export default class AnalyserNode extends AudioNode {
}

getByteTimeDomainData(array) {
this._.inspector.describe("getByteTimeDomainData", (assert) => {
assert(utils.isInstanceOf(array, Uint8Array), (fmt) => {
this._.inspector.describe("getByteTimeDomainData", ($assert) => {
$assert(utils.isInstanceOf(array, Uint8Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(array, "array", "Uint8Array")}
Expand Down
58 changes: 29 additions & 29 deletions src/AudioBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ export default class AudioBuffer {
},
});

this._.inspector.describe("constructor", (assert) => {
assert(utils.isPositiveInteger(numberOfChannels), (fmt) => {
this._.inspector.describe("constructor", ($assert) => {
$assert(utils.isPositiveInteger(numberOfChannels), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(numberOfChannels, "numberOfChannels", "positive integer")}
`);
});

assert(utils.isPositiveInteger(length), (fmt) => {
$assert(utils.isPositiveInteger(length), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(length, "length", "positive integer")}
`);
});

assert(utils.isPositiveInteger(sampleRate), (fmt) => {
$assert(utils.isPositiveInteger(sampleRate), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(sampleRate, "sampleRate", "positive integer")}
Expand All @@ -57,8 +57,8 @@ export default class AudioBuffer {
}

set sampleRate(value) {
this._.inspector.describe("sampleRate", (assert) => {
assert.throwReadOnlyTypeError(value);
this._.inspector.describe("sampleRate", ($assert) => {
$assert.throwReadOnlyTypeError(value);
});
}

Expand All @@ -67,8 +67,8 @@ export default class AudioBuffer {
}

set length(value) {
this._.inspector.describe("length", (assert) => {
assert.throwReadOnlyTypeError(value);
this._.inspector.describe("length", ($assert) => {
$assert.throwReadOnlyTypeError(value);
});
}

Expand All @@ -77,8 +77,8 @@ export default class AudioBuffer {
}

set duration(value) {
this._.inspector.describe("duration", (assert) => {
assert.throwReadOnlyTypeError(value);
this._.inspector.describe("duration", ($assert) => {
$assert.throwReadOnlyTypeError(value);
});
}

Expand All @@ -87,8 +87,8 @@ export default class AudioBuffer {
}

set numberOfChannels(value) {
this._.inspector.describe("numberOfChannels", (assert) => {
assert.throwReadOnlyTypeError(value);
this._.inspector.describe("numberOfChannels", ($assert) => {
$assert.throwReadOnlyTypeError(value);
});
}

Expand All @@ -101,15 +101,15 @@ export default class AudioBuffer {
}

getChannelData(channel) {
this._.inspector.describe("getChannelData", (assert) => {
assert(utils.isPositiveInteger(channel), (fmt) => {
this._.inspector.describe("getChannelData", ($assert) => {
$assert(utils.isPositiveInteger(channel), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(channel, "channel", "positive integer")}
`);
});

assert(channel < this._.data.length, (fmt) => {
$assert(channel < this._.data.length, (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
channel index (${channel}) exceeds number of channels (${this._.data.length})
Expand All @@ -125,43 +125,43 @@ export default class AudioBuffer {
startInChannel = 0;
}

this._.inspector.describe("copyFromChannel", (assert) => {
assert(configuration.getState("AudioBuffer#copyFromChannel") === "enabled", (fmt) => {
this._.inspector.describe("copyFromChannel", ($assert) => {
$assert(configuration.getState("AudioBuffer#copyFromChannel") === "enabled", (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
not enabled
`);
});

assert(utils.isInstanceOf(destination, Float32Array), (fmt) => {
$assert(utils.isInstanceOf(destination, Float32Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(destination, "destination", "Float32Array")}
`);
});

assert(utils.isPositiveInteger(channelNumber), (fmt) => {
$assert(utils.isPositiveInteger(channelNumber), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(channelNumber, "channelNumber", "positive integer")}
`);
});

assert(utils.isPositiveInteger(startInChannel), (fmt) => {
$assert(utils.isPositiveInteger(startInChannel), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(channelNumber, "startInChannel", "positive integer")}
`);
});

assert(0 <= channelNumber && channelNumber < this._.data.length, (fmt) => {
$assert(0 <= channelNumber && channelNumber < this._.data.length, (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
The channelNumber provided (${channelNumber}) is outside the range [0, ${this._.data.length})
`);
});

assert(0 <= startInChannel && startInChannel < this._.length, (fmt) => {
$assert(0 <= startInChannel && startInChannel < this._.length, (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
The startInChannel provided (${startInChannel}) is outside the range [0, ${this._.length}).
Expand All @@ -179,43 +179,43 @@ export default class AudioBuffer {
startInChannel = 0;
}

this._.inspector.describe("copyToChannel", (assert) => {
assert(configuration.getState("AudioBuffer#copyToChannel") === "enabled", (fmt) => {
this._.inspector.describe("copyToChannel", ($assert) => {
$assert(configuration.getState("AudioBuffer#copyToChannel") === "enabled", (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
not enabled
`);
});

assert(utils.isInstanceOf(source, Float32Array), (fmt) => {
$assert(utils.isInstanceOf(source, Float32Array), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(source, "destination", "Float32Array")}
`);
});

assert(utils.isPositiveInteger(channelNumber), (fmt) => {
$assert(utils.isPositiveInteger(channelNumber), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(channelNumber, "channelNumber", "positive integer")}
`);
});

assert(utils.isPositiveInteger(startInChannel), (fmt) => {
$assert(utils.isPositiveInteger(startInChannel), (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
${fmt.butGot(channelNumber, "startInChannel", "positive integer")}
`);
});

assert(0 <= channelNumber && channelNumber < this._.data.length, (fmt) => {
$assert(0 <= channelNumber && channelNumber < this._.data.length, (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
The channelNumber provided (${channelNumber}) is outside the range [0, ${this._.data.length})
`);
});

assert(0 <= startInChannel && startInChannel < this._.length, (fmt) => {
$assert(0 <= startInChannel && startInChannel < this._.length, (fmt) => {
throw new TypeError(fmt.plain `
${fmt.form};
The startInChannel provided (${startInChannel}) is outside the range [0, ${this._.length}).
Expand Down
Loading

0 comments on commit c7f8388

Please sign in to comment.