custom module: send() function casting numbers to integers instead of floats by default
This commit is contained in:
parent
ca20d3cdef
commit
5cb6423051
2 changed files with 3 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- modal: error when `label` depends on a child's property
|
||||
- custom module: `send()` function casting numbers to integers instead of floats by default
|
||||
|
||||
## 0.49.0
|
||||
|
||||
|
|
|
|||
|
|
@ -129,10 +129,10 @@ class OscServer {
|
|||
switch (typeof arg) {
|
||||
case 'number':
|
||||
var typeTagMatch = typeof precision == 'string' ? precision.match(/[0-9]+([a-zA-Z]{1})/) : null,
|
||||
typeTag = typeTagMatch === null ? precision == 0 ? 'i' : 'f' : typeTagMatch[1],
|
||||
typeTag = typeTagMatch === null ? precision === 0 ? 'i' : 'f' : typeTagMatch[1],
|
||||
precisionValue = parseFloat(precision) || 0
|
||||
|
||||
return {type: typeTag, value: parseFloat(arg.toFixed(precisionValue))}
|
||||
return {type: typeTag, value: precision === undefined ? arg : parseFloat(arg.toFixed(precisionValue))}
|
||||
case 'boolean':
|
||||
return {type: arg ? 'T' : 'F', value: arg}
|
||||
case 'object':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue