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

Function floatScalar

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

Source from the content-addressed store, hash-verified

5540 // floats should not work. However, floats with only zeroes right of the
5541 // decimal will work because JS converts those to int.
5542 function floatScalar(val) {
5543 if (typeof val === 'number') {
5544 return val;
5545 } else if (typeof val === 'boolean') {
5546 return val ? 1 : 0;
5547 } else if (typeof val === 'string') {
5548 return parseFloat(val);
5549 } else if (val instanceof Char) {
5550 return val.code;
5551 }
5552 }
5553
5554 p['float'] = function(val) {
5555 if (val instanceof Array) {

Callers 1

processing.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected