Skip to content

Commit

Permalink
✨ Add math.add fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
nlepage committed Apr 26, 2017
1 parent 7f53645 commit 1a43799
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './core'
export * from './lang'
export * from './array'
export * from './math'
16 changes: 16 additions & 0 deletions src/math/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import add from 'lodash/add'

import update from '../core/update'

/**
* Replaces by the addition of the former number and the given number.
* @function add
* @memberof math
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {number} addend The number to add.
* @return {Object} Returns the updated object.
* @see {@link https://lodash.com/docs#add|Lodash} for more information
* @since 0.1.7
*/
export default update(add)
11 changes: 11 additions & 0 deletions src/math/add.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env node, mocha */
import { expect } from 'chai'

import add from './add'

describe('Add', () => {

it('should add two numbers', () => {
expect(add({ nested: { prop: 2 } }, 'nested.prop', 4)).to.be.deep.equal({ nested: { prop: 6 } })
})
})
9 changes: 9 additions & 0 deletions src/math/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import add from './add'

/**
* Math functions.
* @namespace math
*/
export {
add,
}

0 comments on commit 1a43799

Please sign in to comment.