rubico
Version:
[a]synchronous functional programming
24 lines (19 loc) • 605 B
JavaScript
/**
* Rubico v2.8.2
* https://rubico.land/
*
* © Richard Yufei Tong, King of Software
* Rubico may be freely distributed under the CFOSS license.
*/
(function (root, uniq) {
if (typeof module == 'object') (module.exports = uniq) // CommonJS
else if (typeof define == 'function') define(() => uniq) // AMD
else (root.uniq = uniq) // Browser
}(typeof globalThis == 'object' ? globalThis : this, (function () { 'use strict'
const isArray = Array.isArray
const uniq = arr => {
if (!isArray(arr)) throw Error('uniq(arr): arr is not an array')
return [...new Set(arr)]
}
return uniq
}())))