-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nm/release/2.1.0
Release/2.1.0
- Loading branch information
Showing
15 changed files
with
434 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default (left, right) => left >= right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import test from 'tape'; | ||
import greaterThanOrEquals from './greater-than-equals'; | ||
|
||
test('greaterThanOrEquals should be a function', (assert) => { | ||
assert.equal(typeof greaterThanOrEquals, 'function'); | ||
assert.end(); | ||
}); | ||
|
||
test('greaterThan should return true if the value given is greater than the param', (assert) => { | ||
let actual = greaterThanOrEquals(1, 0); | ||
let expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4, 3); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4.2, 4.1); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4, 4); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4.2, 4.2); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
assert.end(); | ||
}); | ||
|
||
test('greaterThan should return true if the value given is equal to the param', (assert) => { | ||
let actual = greaterThanOrEquals(1, 1); | ||
let expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4, 4); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(4.2, 4.2); | ||
expected = true; | ||
assert.equal(actual, expected); | ||
|
||
assert.end(); | ||
}); | ||
|
||
test('greaterThanOrEquals should return false if the value given is less than the param', (assert) => { | ||
let actual = greaterThanOrEquals(1, 2); | ||
let expected = false; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(0, 10); | ||
expected = false; | ||
assert.equal(actual, expected); | ||
|
||
actual = greaterThanOrEquals(null, 4); | ||
expected = false; | ||
assert.equal(actual, expected); | ||
|
||
assert.end(); | ||
}); | ||
|
||
test('greaterThanOrEquals should return false if the key is undefined', (assert) => { | ||
const actual = greaterThanOrEquals(undefined, 0); | ||
const expected = false; | ||
assert.equal(actual, expected); | ||
assert.end(); | ||
}); | ||
|
||
test('greaterThanOrEquals should return false if the key is a string that parses to NaN', (assert) => { | ||
const redProps = [ | ||
'cool', | ||
'some string', | ||
'undefined', | ||
'null', | ||
'false', | ||
'true', | ||
]; | ||
redProps.forEach((val) => { | ||
const actual = greaterThanOrEquals(val, 0); | ||
const expected = false; | ||
assert.equal(actual, expected, `should return false when passed ${val}`); | ||
}); | ||
assert.end(); | ||
}); | ||
|
||
test('greaterThanOrEquals should compare strings based on standard lexicographical ordering, using Unicode values', (assert) => { | ||
assert.equal(greaterThanOrEquals('a', 'b'), false, 'case 1'); | ||
assert.equal(greaterThanOrEquals('aaaa', 'abaa'), false, 'case 2'); | ||
assert.equal(greaterThanOrEquals('bb', 'a'), true, 'case 3'); | ||
assert.equal(greaterThanOrEquals('baa', 'abb'), true, 'case 4'); | ||
assert.equal(greaterThanOrEquals('1', 2), false, 'case 5'); | ||
assert.equal(greaterThanOrEquals('2', 1), true, 'case 6'); | ||
assert.equal(greaterThanOrEquals('2', '4'), false, 'case 7'); | ||
assert.equal(greaterThanOrEquals('2', '2'), true, 'case 8'); | ||
assert.equal(greaterThanOrEquals(4, 4), true, 'case 9'); | ||
assert.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default (left, right) => left <= right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import test from 'tape'; | ||
import lessThanOrEquals from './less-than-equals'; | ||
|
||
test('lessThanOrEquals should be a function', (assert) => { | ||
assert.equal(typeof lessThanOrEquals, 'function'); | ||
assert.end(); | ||
}); | ||
|
||
test('lessThanOrEquals should return true if "left" is less than "right"', (assert) => { | ||
const actual = lessThanOrEquals(4, 5); | ||
const expected = true; | ||
assert.equal(actual, expected); | ||
assert.end(); | ||
}); | ||
|
||
test('lessThanOrEquals should return true if "left" equals "right"', (assert) => { | ||
const actual = lessThanOrEquals(5, 5); | ||
const expected = true; | ||
assert.equal(actual, expected); | ||
assert.end(); | ||
}); | ||
|
||
test('lessThanOrEquals should return false if "left" is greater than "right', (assert) => { | ||
const actual = lessThanOrEquals(255, 254); | ||
const expected = false; | ||
assert.equal(actual, expected); | ||
assert.end(); | ||
}); | ||
|
||
test('lessThanOrEquals should return false if the key is a string that parses to NaN', (assert) => { | ||
const redProps = [ | ||
'cool', | ||
'some string', | ||
'undefined', | ||
'null', | ||
'false', | ||
'true', | ||
]; | ||
redProps.forEach((val) => { | ||
const actual = lessThanOrEquals(val, 0); | ||
const expected = false; | ||
assert.equal(actual, expected, `should return false when passed ${val}`); | ||
}); | ||
assert.end(); | ||
}); | ||
|
||
test('lessThanOrEquals should compare strings based on standard lexicographical ordering, using Unicode values', (assert) => { | ||
assert.equal(lessThanOrEquals('a', 'b'), true, 'case 1'); | ||
assert.equal(lessThanOrEquals('aaaa', 'abaa'), true, 'case 2'); | ||
assert.equal(lessThanOrEquals('bb', 'a'), false, 'case 3'); | ||
assert.equal(lessThanOrEquals('baa', 'abb'), false, 'case 4'); | ||
assert.equal(lessThanOrEquals('1', 2), true, 'case 5'); | ||
assert.equal(lessThanOrEquals('2', 1), false, 'case 6'); | ||
assert.equal(lessThanOrEquals('2', '4'), true, 'case 7'); | ||
assert.equal(lessThanOrEquals('4', '4'), true, 'case 8'); | ||
assert.equal(lessThanOrEquals(4, '4'), true, 'case 9'); | ||
assert.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.