MCPcopy Create free account
hub / github.com/chalk/chalk / assertValidLevel

Function assertValidLevel

source/index.js:17–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15const styles = Object.create(null);
16
17const assertValidLevel = level => {
18 if (!Number.isSafeInteger(level) || level < 0 || level > 3) {
19 throw new Error('The `level` should be an integer from 0 to 3');
20 }
21};
22
23// The level is stored under a symbol so the hot path can read it as a plain property, while `level` itself is an accessor that rejects values the rest of the code could not handle.
24const levelDescriptor = {

Callers 2

setFunction · 0.85
applyOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected