source: node_modules/ramda-adjunct/lib/ensureArray.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 883 bytes
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var _isNotArray = _interopRequireDefault(require("./isNotArray"));
7function _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 */
25var ensureArray = (0, _ramda.when)(_isNotArray["default"], (0, _ramda.of)(Array));
26var _default = ensureArray;
27exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.