MCPcopy Create free account
hub / github.com/corbanbrook/dsp.js / booleanScalar

Function booleanScalar

examples/js/processing.js:5486–5497  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

5484
5485 // Conversion
5486 function booleanScalar(val) {
5487 if (typeof val === 'number') {
5488 return val !== 0;
5489 } else if (typeof val === 'boolean') {
5490 return val;
5491 } else if (typeof val === 'string') {
5492 return val.toLowerCase() === 'true';
5493 } else if (val instanceof Char) {
5494 // 1, T or t
5495 return val.code === 49 || val.code === 84 || val.code === 116;
5496 }
5497 }
5498
5499 p['boolean'] = function(val) {
5500 if (val instanceof Array) {

Callers 1

processing.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected