feat: Switch to function-based specification of dependencies
Allows dependencies to be economically expressed and used. For example, see the new definition of subtract. Credit for the basic idea goes to James Drew, see https://stackoverflow.com/a/41525264 Resolves #21.
This commit is contained in:
parent
d72c443616
commit
9fb3aa2959
13 changed files with 104 additions and 102 deletions
|
@ -19,7 +19,7 @@ describe('The default full pocomath instance "math"', () => {
|
|||
|
||||
it('can be extended', () => {
|
||||
math.install({'add': {
|
||||
'...string': [[], addends => addends.reduce((x,y) => x+y, '')]
|
||||
'...string': () => addends => addends.reduce((x,y) => x+y, '')
|
||||
}})
|
||||
assert.strictEqual(math.add('Kilroy',' is here'), 'Kilroy is here')
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue