{"version":3,"file":"dropLast.cjs","names":["purry"],"sources":["../src/dropLast.ts"],"sourcesContent":["import type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport { purry } from \"./purry\";\n\n/**\n * Removes last `n` elements from the `array`.\n *\n * Related operations:\n * - `drop` - same, but from the start of the array.\n * - `splice` - to remove or insert at an arbitrary index.\n * - `takeLast` - to keep the last `n` instead.\n *\n * @param array - The target array.\n * @param n - The number of elements to skip.\n * @signature\n *    dropLast(array, n)\n * @example\n *    dropLast([1, 2, 3, 4, 5], 2) // => [1, 2, 3]\n * @dataFirst\n * @category Array\n */\nexport function dropLast<T extends IterableContainer>(\n  array: T,\n  n: number,\n): T[number][];\n\n/**\n * Removes last `n` elements from the `array`.\n *\n * Related operations:\n * - `drop` - same, but from the start of the array.\n * - `splice` - to remove or insert at an arbitrary index.\n * - `takeLast` - to keep the last `n` instead.\n *\n * @param n - The number of elements to skip.\n * @signature\n *    dropLast(n)(array)\n * @example\n *    dropLast(2)([1, 2, 3, 4, 5]) // => [1, 2, 3]\n * @dataLast\n * @category Array\n */\nexport function dropLast(\n  n: number,\n): <T extends IterableContainer>(array: T) => T[number][];\n\nexport function dropLast(...args: readonly unknown[]): unknown {\n  return purry(dropLastImplementation, args);\n}\n\nconst dropLastImplementation = <T extends IterableContainer>(\n  array: T,\n  n: number,\n): T[number][] =>\n  n > 0 ? array.slice(0, Math.max(0, array.length - n)) : [...array];\n"],"mappings":"kGA6CA,SAAgB,EAAS,GAAG,EAAmC,CAC7D,OAAOA,EAAAA,MAAM,EAAwB,CAAI,CAC3C,CAEA,MAAM,GACJ,EACA,IAEA,EAAI,EAAI,EAAM,MAAM,EAAG,KAAK,IAAI,EAAG,EAAM,OAAS,CAAC,CAAC,EAAI,CAAC,GAAG,CAAK"}