diff --git a/src/bigint/add.mjs b/src/bigint/add.mjs index d6fc0c7..dfff057 100644 --- a/src/bigint/add.mjs +++ b/src/bigint/add.mjs @@ -1,5 +1,6 @@ +import {use} from '../core/PocomathInstance.mjs' export {Types} from './Types/bigint.mjs' export const add = { - '...bigint': [[], addends => addends.reduce((x,y) => x+y, 0n)], + '...bigint': use([], addends => addends.reduce((x,y) => x+y, 0n)) } diff --git a/src/bigint/negate.mjs b/src/bigint/negate.mjs index 538e1d4..eed50bf 100644 --- a/src/bigint/negate.mjs +++ b/src/bigint/negate.mjs @@ -1,3 +1,4 @@ +import {use} from '../core/PocomathInstance.mjs' export {Types} from './Types/bigint.mjs' -export const negate = {bigint: [[], b => -b ]} +export const negate = {bigint: use([], b => -b)} diff --git a/src/core/PocomathInstance.mjs b/src/core/PocomathInstance.mjs index 4d32896..3093291 100644 --- a/src/core/PocomathInstance.mjs +++ b/src/core/PocomathInstance.mjs @@ -1,6 +1,10 @@ /* Core of pocomath: create an instance */ import typed from 'typed-function' +export function use(dependencies, implementation) { + return [dependencies, implementation] +} + export default class PocomathInstance { /* Disallowed names for ops; beware, this is slightly non-DRY * in that if a new top-level PocomathInstance method is added, its name