{"_id":"multimath","_rev":"3346233","name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"time":{"modified":"2024-07-24T02:51:21.000Z","created":"2017-09-30T19:56:26.753Z","2.0.0":"2019-07-15T12:04:36.981Z","1.0.3":"2018-03-05T09:10:36.920Z","1.0.2":"2017-10-13T05:42:20.431Z","1.0.1":"2017-10-03T07:06:59.624Z","1.0.0":"2017-09-30T19:56:26.753Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"versions":{"2.0.0":{"name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","version":"2.0.0","keywords":["webassembly","math","image","multimath"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"scripts":{"test":"make test","coverage":"nyc mocha && nyc report --reporter html"},"dependencies":{"glur":"^1.1.2","object-assign":"^4.1.1"},"devDependencies":{"benchmark":"^2.1.0","eslint":"^6.0.1","mocha":"^6.1.4","nyc":"^14.1.1","proxyquire":"^2.1.1","sinon":"^7.3.2"},"gitHead":"b01997481f81209cbedcc03304d5b83b182ab352","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"homepage":"https://github.com/nodeca/multimath#readme","_id":"multimath@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"dist":{"shasum":"0d37acf67c328f30e3d8c6b0d3209e6082710302","size":16228,"noattachment":false,"key":"/multimath/-/multimath-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multimath/download/multimath-2.0.0.tgz"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multimath_2.0.0_1563192276879_0.024262470496241972"},"_hasShrinkwrap":false,"publish_time":1563192276981,"_cnpm_publish_time":1563192276981,"_cnpmcore_publish_time":"2021-12-16T18:49:44.641Z"},"1.0.3":{"name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","version":"1.0.3","keywords":["webassembly","math","image","multimath"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"scripts":{"test":"make test","coverage":"nyc mocha && nyc report --reporter html"},"files":["lib/","index.js"],"dependencies":{"glur":"^1.1.2","object-assign":"^4.1.1"},"devDependencies":{"benchmark":"^2.1.0","eslint":"^4.8.0","mocha":"^4.0.1","nyc":"^11.2.1"},"gitHead":"983c310d2c682c7b1619edc53b4ce70208beb726","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"homepage":"https://github.com/nodeca/multimath#readme","_id":"multimath@1.0.3","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"eadee6fb9d727d329d64d60bba247af42334451d","size":16164,"noattachment":false,"key":"/multimath/-/multimath-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/multimath/download/multimath-1.0.3.tgz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multimath_1.0.3_1520241036846_0.5145968290266327"},"_hasShrinkwrap":false,"publish_time":1520241036920,"_cnpm_publish_time":1520241036920,"_cnpmcore_publish_time":"2021-12-16T18:49:45.093Z"},"1.0.2":{"name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","version":"1.0.2","keywords":["webassembly","math","image","multimath"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"scripts":{"test":"make test","coverage":"nyc mocha && nyc report --reporter html"},"files":["lib/","index.js"],"dependencies":{"glur":"^1.1.2","object-assign":"^4.1.1"},"devDependencies":{"benchmark":"^2.1.0","eslint":"^4.8.0","mocha":"^4.0.1","nyc":"^11.2.1"},"gitHead":"4103c508698eb117acfd01ccda497a4031655863","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"homepage":"https://github.com/nodeca/multimath#readme","_id":"multimath@1.0.2","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"89e80ad6a1f9eddc9a913af7e69550c386d62282","size":15847,"noattachment":false,"key":"/multimath/-/multimath-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/multimath/download/multimath-1.0.2.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multimath-1.0.2.tgz_1507873339285_0.22277664043940604"},"directories":{},"publish_time":1507873340431,"_hasShrinkwrap":false,"_cnpm_publish_time":1507873340431,"_cnpmcore_publish_time":"2021-12-16T18:49:45.318Z"},"1.0.1":{"name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","version":"1.0.1","keywords":["webassembly","math","image","multimath"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"scripts":{"test":"make test"},"files":["lib/","index.js"],"dependencies":{"glur":"^1.1.2","object-assign":"^4.1.1"},"devDependencies":{"benchmark":"^2.1.0","eslint":"^3.7.0","mocha":"^3.1.0"},"gitHead":"11a68ec8b3e5f2e49bc9ecdcfc955303ea5b2509","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"homepage":"https://github.com/nodeca/multimath#readme","_id":"multimath@1.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"3144f1daf0f659ce8843a6ab570810c3cc59af16","size":15313,"noattachment":false,"key":"/multimath/-/multimath-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/multimath/download/multimath-1.0.1.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multimath-1.0.1.tgz_1507014418644_0.05947004817426205"},"directories":{},"publish_time":1507014419624,"_hasShrinkwrap":false,"_cnpm_publish_time":1507014419624,"_cnpmcore_publish_time":"2021-12-16T18:49:45.583Z"},"1.0.0":{"name":"multimath","description":"Core to create fast image math in WebAssembly and JS.","version":"1.0.0","keywords":["webassembly","math","image","multimath"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodeca/multimath.git"},"scripts":{"test":"make test"},"files":["lib/","index.js"],"dependencies":{"glur":"^1.1.2","object-assign":"^4.1.1"},"devDependencies":{"benchmark":"^2.1.0","eslint":"^3.7.0","mocha":"^3.1.0"},"gitHead":"18d84322431356ff358c571952b1544ee49670ec","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"homepage":"https://github.com/nodeca/multimath#readme","_id":"multimath@1.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.5.0","_npmUser":{"name":"vitaly","email":"vitaly@rcdesign.ru"},"maintainers":[{"name":"vitaly","email":"vitaly@rcdesign.ru"}],"dist":{"shasum":"599745efdd1bfc4f818b6c60c718254d03543daf","size":14920,"noattachment":false,"key":"/multimath/-/multimath-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multimath/download/multimath-1.0.0.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multimath-1.0.0.tgz_1506801385687_0.842715855455026"},"directories":{},"publish_time":1506801386753,"_hasShrinkwrap":false,"_cnpm_publish_time":1506801386753,"_cnpmcore_publish_time":"2021-12-16T18:49:45.794Z"}},"readme":"multimath\n=========\n\n[![Build Status](https://travis-ci.org/nodeca/multimath.svg?branch=master)](https://travis-ci.org/nodeca/multimath)\n[![NPM version](https://img.shields.io/npm/v/multimath.svg)](https://www.npmjs.org/package/multimath)\n\n> Core to create fast image math in WebAssembly and JS.\n\n`multimath` simplifies creation of small CPU-intensive webassembly modules\nwith fallback to JavaScript implementations.\n\n- It cares about modules init, memory management and other things.\n- Has built-in helpers to write webassembly code without additional runtimes.\n- Use shared memory to chain webassembly calls without memory copy.\n\nBuilt-in functions (curently - unsharp mask) are available as examples for your\nextensions.\n\n\nInstall\n-------\n\n```bash\nnpm install multimath\n```\n\n\nUse\n---\n\n```js\nconst mm = require('multimath')()\n             .use(require('multimath/lib/unsharp_mask'))\n             .use(require('your_custom_module'))\n\n// Simple sync call. Will use sync wasm compile. Ok for webworkers.\n// Can freeze interface at first call if wasm source is too big.\nmm.unsharp_mask(rgba_buffer, width, height);\n\n// Async init, compile all modules at once in async way.\nmm.init().then(() => {\n  mm.unsharp_mask(rgba_buffer, width, height);\n});\n```\n\n\nAPI\n---\n\n\n### new multimath(options)\n\nCreate library instance. Sugar - `multimath()` (without `new`).\n\n```js\nconst mm = require('multimath')({\n  // Options are not mandatory, but you can disable js or ww\n  // implementations for testing\n  js:   true,\n  wasm: true\n});\n```\n\n\n### .use(module)\n\nRegister new module, format is:\n\n```js\n{\n  name:     String,    // default wasm module & function name to expose\n  fn:       Function,  // JS implementation\n  wasm_fn:  Function,  // WebAssembly glue\n  wasm_src: String     // Base64 encoded WebAssembly module\n}\n```\n\nSee example implementation in `lib/` folder.\n\n\n### .init() -> Promise\n\nOptional. Compile all wasm modules in async way. May be useful in this cases:\n\n1. If you have wasm module > 4K AND run multimath in the main thread (not in\n   webworker). Some browsers prohibit sync wasm creation in this case.\n2. If you have a lot of small modules and wish to init everything before run\n   in the main thread, withoutinterface freeze.\n\nProbably, you will never need to use this method. Note, 3K was file is\ninitialized in ~ 3ms.\n\n\n### .<your_method>\n\nAll modules, loaded via `.use()`, pin their methods to current `Multimath`\ninstance. The best implementation will be selected automatically (depends on\nbrowser features and constructor options);\n\n\n### Development\n\nWays to go with your own modules:\n\n- Use `./support/llvmasm_install.sh` to install llvm/binaryen tools. Or use it\n  as base for your own.\n- See `Makefile`\n- See `./lib/unsharp_mask` as example and... of cause `./index.js`.\n\nAlso, see how [pica](https://github.com/nodeca/pica)\nuse this library.\n\n\nLicence\n-------\n\n[MIT](https://github.com/nodeca/multimath/blob/master/LICENSE)\n","_attachments":{},"homepage":"https://github.com/nodeca/multimath#readme","bugs":{"url":"https://github.com/nodeca/multimath/issues"},"license":"MIT"}