main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
883 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | var _isNotArray = _interopRequireDefault(require("./isNotArray"));
|
---|
| 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
| 8 | /**
|
---|
| 9 | * Returns a singleton array containing the value provided.
|
---|
| 10 | * If value is already an array, it is returned as is.
|
---|
| 11 | *
|
---|
| 12 | * @func ensureArray
|
---|
| 13 | * @memberOf RA
|
---|
| 14 | * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
|
---|
| 15 | * @category List
|
---|
| 16 | * @sig a | [a] -> [a]
|
---|
| 17 | * @param {*|Array} val the value ensure as Array
|
---|
| 18 | * @return {Array}
|
---|
| 19 | * @see {@link http://ramdajs.com/docs/#of|R.of}
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * RA.ensureArray(42); //=> [42]
|
---|
| 23 | * RA.ensureArray([42]); //=> [42]
|
---|
| 24 | */
|
---|
| 25 | var ensureArray = (0, _ramda.when)(_isNotArray["default"], (0, _ramda.of)(Array));
|
---|
| 26 | var _default = ensureArray;
|
---|
| 27 | exports["default"] = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.