rubico
Version:
[a]synchronous functional programming
8 lines (7 loc) • 510 B
JavaScript
/**
* rubico v2.6.2
* https://github.com/a-synchronous/rubico
* (c) 2019-2024 Richard Tong
* rubico may be freely distributed under the MIT license.
*/
const isString=function(r){return"string"==typeof r||null!=r&&r.constructor==String},isArray=Array.isArray,append=r=>function(n){if(isArray(n))return isArray(r)?[...n,...r]:[...n,r];if(isString(n)){if(!isString(r))throw new TypeError(`${r} is not a string`);return`${n}${r}`}throw new TypeError(`${n} is not an Array or string`)};export default append;