{"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 * @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 * @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":"kGAmCA,SAAgB,EAAS,GAAG,EAAmC,CAC7D,OAAOA,EAAAA,MAAM,EAAwB,EAAK,CAG5C,MAAM,GACJ,EACA,IAEA,EAAI,EAAI,EAAM,MAAM,EAAG,KAAK,IAAI,EAAG,EAAM,OAAS,EAAE,CAAC,CAAG,CAAC,GAAG,EAAM"}