UNPKG

soundbank-chunk

Version:

A group of triggerable sound descriptors to be positioned on a loop-grid and played with soundbank.

16 lines (14 loc) 459 B
module.exports = obtainWithIds function obtainWithIds(object, lookupGlobal){ object = object || {} return JSON.parse(JSON.stringify(object, function(key, value){ if (key === 'id' || key === 'from' || key === 'output'){ if (Array.isArray(value)){ return value.map(lookupGlobal) } else if ((typeof value === 'string' && value) || typeof value === 'number'){ return lookupGlobal(value) } } return value })) }