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

Commit 69fce67

Browse files
lockroundKent C. Dodds
authored and
Kent C. Dodds
committed
feat(common): add lessThan function with tests (#166)
1 parent 6fd533f commit 69fce67

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import flatten from './flatten'
77
import getQueryStringParam from './get-query-string-param'
88
import snakeToCamel from './snake-to-camel'
99
import padLeft from './pad-left'
10+
import lessThan from './less-than'
1011
import randomInteger from './random-integer'
1112
import arrayFill from './array-fill'
1213
import sortObjectsArray from './sort-objects-array'
@@ -120,4 +121,5 @@ export {
120121
reverse,
121122
removeAccents,
122123
getQueryStringValue,
124+
lessThan,
123125
}

src/less-than.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default lessThan
2+
3+
/**
4+
* This method will check if num1 is less than num2
5+
*
6+
* @param {Number} num1 - first number
7+
* @param {Number} num2 - second number
8+
* @return {Boolean} - Returns true if num1 is less than num2, else false.
9+
*/
10+
function lessThan(num1, num2) {
11+
return num1 < num2
12+
}

test/less-than.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import test from 'ava'
2+
import {lessThan} from '../src'
3+
4+
test('checks if num1 is less than num2', t => {
5+
const num1 = 1
6+
const num2 = 2
7+
const expected = true
8+
const actual = lessThan(num1, num2)
9+
t.deepEqual(actual, expected)
10+
})

0 commit comments

Comments
 (0)