30 lines
634 B
JavaScript
30 lines
634 B
JavaScript
|
import slice from "./slice.js";
|
||
|
/**
|
||
|
* Returns all but the last element of the given list or string.
|
||
|
*
|
||
|
* @func
|
||
|
* @memberOf R
|
||
|
* @since v0.9.0
|
||
|
* @category List
|
||
|
* @sig [a] -> [a]
|
||
|
* @sig String -> String
|
||
|
* @param {*} list
|
||
|
* @return {*}
|
||
|
* @see R.last, R.head, R.tail
|
||
|
* @example
|
||
|
*
|
||
|
* R.init([1, 2, 3]); //=> [1, 2]
|
||
|
* R.init([1, 2]); //=> [1]
|
||
|
* R.init([1]); //=> []
|
||
|
* R.init([]); //=> []
|
||
|
*
|
||
|
* R.init('abc'); //=> 'ab'
|
||
|
* R.init('ab'); //=> 'a'
|
||
|
* R.init('a'); //=> ''
|
||
|
* R.init(''); //=> ''
|
||
|
*/
|
||
|
|
||
|
var init =
|
||
|
/*#__PURE__*/
|
||
|
slice(0, -1);
|
||
|
export default init;
|