picomath/picomathInstance.js

21 lines
415 B
JavaScript

/* Core of picomath: generates an instance */
import poortf from './poortf.js'
export default function picomathInstance (instName) {
function fn (name, imps) {
if (name in fn) {
fn[name].addImps(imps)
} else {
fn[name] = poortf(name, imps)
}
return fn[name]
}
Object.defineProperty(fn, 'name', {value: instName})
return fn
}