swc/bundler/tests/.cache/deno/fa12a97e0eea5f7ff4cca4685863a82f6d6198a3.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

38 lines
961 B
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/reverse.js
import _curry1 from './internal/_curry1.js';
import _isString from './internal/_isString.js';
/**
* Returns a new list or string with the elements or characters in reverse
* order.
*
* @func
* @memberOf R
* @since v0.1.0
* @category List
* @sig [a] -> [a]
* @sig String -> String
* @param {Array|String} list
* @return {Array|String}
* @example
*
* R.reverse([1, 2, 3]); //=> [3, 2, 1]
* R.reverse([1, 2]); //=> [2, 1]
* R.reverse([1]); //=> [1]
* R.reverse([]); //=> []
*
* R.reverse('abc'); //=> 'cba'
* R.reverse('ab'); //=> 'ba'
* R.reverse('a'); //=> 'a'
* R.reverse(''); //=> ''
*/
var reverse = _curry1(function reverse(list) {
return _isString(list)
? list.split('').reverse().join('')
: Array.prototype.slice.call(list, 0).reverse();
});
export default reverse;