Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Commit 8a8a9d9

Browse files
Vali ShahKent C. Dodds
authored andcommitted
feat(add): Add an "add" function (#59)
* WIP: Add an "add" function * fix: Handled code coverage * Made changes for additon reference Closes #55
1 parent 031ab8d commit 8a8a9d9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/add.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default add
2+
3+
/**
4+
* This method will perform addition operation.
5+
*
6+
* @param {Number} num1 - first number for addition
7+
* @param {Number} num2 - second number for additon
8+
* @return {Number} - Result of addition
9+
*/
10+
function add(num1, num2) {
11+
return num1 + num2
12+
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import hex2rgb from './hex2rgb'
1313
import isNullOrWhitespace from './is-null-or-whitespace'
1414
import startsWith from './startsWith'
1515
import removeDuplicates from './remove-duplicates'
16+
import add from './add'
1617

1718
export {
1819
flatten,
@@ -30,4 +31,5 @@ export {
3031
isNullOrWhitespace,
3132
startsWith,
3233
removeDuplicates,
34+
add,
3335
}

test/add.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import test from 'ava'
2+
import {add} from '../src'
3+
4+
test('Adds two integers ', t => {
5+
const number1 = 23
6+
const number2 = 3
7+
const expected = 23 + 3
8+
const actual = add(number1, number2)
9+
t.deepEqual(actual, expected)
10+
})

0 commit comments

Comments
 (0)