forked from char0n/ramda-adjunct
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref char0n#279
- Loading branch information
Guillaume ARM
committed
Jan 18, 2018
1 parent
57b4de4
commit 30e3366
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { both, isEmpty } from 'ramda'; | ||
|
||
import isArray from './isArray'; | ||
|
||
|
||
/** | ||
* Checks if input value is an empty `Array`. | ||
* | ||
* @func isEmptyArray | ||
* @memberOf RA | ||
* @since {@link https://char0n.github.io/ramda-adjunct/2.4.0|v2.4.0} | ||
* @category Type | ||
* @sig * -> Boolean | ||
* @param {*} val The value to test | ||
* @return {Boolean} | ||
* @see {@link RA.isNotEmptyArray|isNotEmptyArray} | ||
* @example | ||
* | ||
* RA.isEmptyArray([]); // => true | ||
* RA.isEmptyArray([42]); // => false | ||
* RA.isEmptyArray({}); // => false | ||
* RA.isEmptyArray(null); // => false | ||
* RA.isEmptyArray(undefined); // => false | ||
* RA.isEmptyArray(42); // => false | ||
* RA.isEmptyArray('42'); // => false | ||
*/ | ||
const isEmptyArray = both(isEmpty, isArray); | ||
|
||
export default isEmptyArray; |
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,21 @@ | ||
import * as RA from '../src/index'; | ||
import eq from './shared/eq'; | ||
|
||
describe('isEmptyArray', function() { | ||
it('tests a value to be an empty `Array`', function() { | ||
eq(RA.isEmptyArray([]), true); | ||
eq(RA.isEmptyArray(new Array()), true); | ||
eq(RA.isEmptyArray(Array.prototype), true); | ||
|
||
eq(RA.isEmptyArray([1]), false); | ||
eq(RA.isEmptyArray(void 0), false); | ||
eq(RA.isEmptyArray({}), false); | ||
eq(RA.isEmptyArray(null), false); | ||
eq(RA.isEmptyArray(undefined), false); | ||
eq(RA.isEmptyArray(17), false); | ||
eq(RA.isEmptyArray('Array'), false); | ||
eq(RA.isEmptyArray(true), false); | ||
eq(RA.isEmptyArray(false), false); | ||
eq(RA.isEmptyArray({ __proto__: Array.prototype }), false); | ||
}); | ||
}); |