This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/papercraft/openjscad/node_modules/@most/prelude/dist/index.js.map

1 line
10 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"index.js","sources":["../src/array.js","../src/function.js","../src/index.js"],"sourcesContent":["/** @license MIT License (c) copyright 2010-2016 original author or authors */\n\n// Non-mutating array operations\n\n// cons :: a -> [a] -> [a]\n// a with x prepended\nexport function cons (x, a) {\n const l = a.length\n const b = new Array(l + 1)\n b[0] = x\n for (let i = 0; i < l; ++i) {\n b[i + 1] = a[i]\n }\n return b\n}\n\n// append :: a -> [a] -> [a]\n// a with x appended\nexport function append (x, a) {\n const l = a.length\n const b = new Array(l + 1)\n for (let i = 0; i < l; ++i) {\n b[i] = a[i]\n }\n\n b[l] = x\n return b\n}\n\n// drop :: Int -> [a] -> [a]\n// drop first n elements\nexport function drop (n, a) { // eslint-disable-line complexity\n if (n < 0) {\n throw new TypeError('n must be >= 0')\n }\n\n const l = a.length\n if (n === 0 || l === 0) {\n return a\n }\n\n if (n >= l) {\n return []\n }\n\n return unsafeDrop(n, a, l - n)\n}\n\n// unsafeDrop :: Int -> [a] -> Int -> [a]\n// Internal helper for drop\nfunction unsafeDrop (n, a, l) {\n const b = new Array(l)\n for (let i = 0; i < l; ++i) {\n b[i] = a[n + i]\n }\n return b\n}\n\n// tail :: [a] -> [a]\n// drop head element\nexport function tail (a) {\n return drop(1, a)\n}\n\n// copy :: [a] -> [a]\n// duplicate a (shallow duplication)\nexport function copy (a) {\n const l = a.length\n const b = new Array(l)\n for (let i = 0; i < l; ++i) {\n b[i] = a[i]\n }\n return b\n}\n\n// map :: (a -> b) -> [a] -> [b]\n// transform each element with f\nexport function map (f, a) {\n const l = a.length\n const b = new Array(l)\n for (let i = 0; i < l; ++i) {\n b[i] = f(a[i])\n }\n return b\n}\n\n// reduce :: (a -> b -> a) -> a -> [b] -> a\n// accumulate via left-fold\nexport function reduce (f, z, a) {\n let r = z\n for (let i = 0, l = a.length; i < l; ++i) {\n r = f(r, a[i], i)\n }\n return r\n}\n\n// replace :: a -> Int -> [a]\n// replace element at index\nexport function replace (x, i, a) { // eslint-disable-line complexity\n if (i < 0) {\n throw new TypeError('i must be >= 0')\n }\n\n const l = a.length\n const b = new Array(l)\n for (let j = 0; j < l; ++j) {\n b[j] = i === j ? x : a[j]\n }\n return b\n}\n\n// remove :: Int -> [a] -> [a]\n// remove element at index\nexport function remove (i, a) { // eslint-disable-line complexity\n if (i < 0) {\n throw new TypeError('i must be >= 0')\n }\n\n const l = a.length\n if (l === 0 || i >= l) { // exit early if index beyond end of array\n return a\n }\n\n if (l === 1) { // exit early if index in bounds and length === 1\n return []\n }\n\n return unsafeRemove(i, a, l - 1)\n}\n\n// unsafeRemove :: Int -> [a] -> Int -> [a]\n// Internal helper to remove element at index\nfunction unsafeRemove (i, a, l) {\n const b = new Array(l)\n let j\n for (j = 0; j < i; ++j) {\n b[j] = a[j]\n }\n for (j = i; j < l; ++j) {\n b[j] = a[j + 1]\n }\n\n return b\n}\n\n// removeAll :: (a -> boolean) -> [a] -> [a]\n// remove all elements matching a predicate\n// @deprecated\nexport function removeAll (f, a) {\n const l = a.length\n const b = new Array(l)\n let j = 0\n for (let x, i = 0; i < l; ++i) {\n x = a[i]\n if (!f(x)) {\n b[j] = x\n ++j\n }\n }\n\n b.length = j\n return b\n}\n\n// findIndex :: a -> [a] -> Int\n// find index of x in a, from the left\nexport function findIndex (x, a) {\n for (let i = 0, l = a.length; i < l; ++i) {\n if (x === a[i]) {\n return i\n }\n }\n return -1\n}\n\n// isArrayLike :: * -> boolean\n// Return true iff x is array-like\nexport function isArrayLike (x) {\n return x != null && typeof x.length === 'number' && typeof x !== 'function'\n}\n","/** @license MIT License (c) copyright 2010-2016 original author or authors */\n\n// id :: a -> a\nexport const id = x => x\n\n// compose :: (b -> c) -> (a -> b) -> (a -> c)\nexport const compose = (f, g) => x => f(g(x))\n\n// apply :: (a -> b) -> a -> b\nexport const apply = (f, x) => f(x)\n\n// curry2 :: ((