feat: Add all remaining features of original Picomath PoC (#5)
Namely, a README describing the proof-of-concept, a custom selective loader, and some additional tests. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #5
This commit is contained in:
parent
84a8b9d5c4
commit
a16d6a5ce3
4 changed files with 67 additions and 1 deletions
19
complex/extendToComplex.mjs
Normal file
19
complex/extendToComplex.mjs
Normal file
|
@ -0,0 +1,19 @@
|
|||
import './Complex.mjs'
|
||||
import * as complex from './complex.mjs'
|
||||
|
||||
/* Add all the complex implementations for functions already
|
||||
in the instance:
|
||||
*/
|
||||
|
||||
export default async function extendToComplex(pmath) {
|
||||
pmath.install(complex)
|
||||
for (const name in pmath._imps) {
|
||||
const modulePath = `./${name}.mjs`
|
||||
try {
|
||||
const mod = await import(modulePath)
|
||||
pmath.install(mod)
|
||||
} catch (err) {
|
||||
// Guess it wasn't a method available in complex; no worries
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue