{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TGetDiffArgs = Parameters<typeof getDiff>;\r\n\r\nexport type TGetDiffReturn = ReturnType<typeof getDiff>;\r\n\r\n/**\r\n * Gets an Array of difference between two given Arrays\r\n * @template T\r\n * @param {Array<T>} arr1 first source Array\r\n * @param {Array<T>} arr2 second source Array\r\n * @returns {Array<T>}\r\n * @throws {TypeError} getDiff: arr1 and arr2 must be arrays\r\n * @example\r\n * // How to get the difference between two arrays?\r\n * const arr1 = [ 1, 2, 3 ];\r\n * const arr2 = [ 3, 4, 5, 6 ];\r\n * const diff = getDiff(arr1, arr2);\n * console.log(diff); // => [ 1, 2, 4, 5, 6 ]\n * @example\n * // Find permissions that changed between two role configurations\n * const changedPermissions = getDiff(\n *   [ \"read\", \"write\" ],\n *   [ \"read\", \"delete\" ]\n * ); // [ \"write\", \"delete\" ]\n */\nexport const getDiff = <T>(arr1: T[], arr2: T[]): T[] => {\r\n  if (!Array.isArray(arr1) || !Array.isArray(arr2)) {\r\n    throw new TypeError(\"getDiff: arr1 and arr2 must be arrays\");\r\n  }\r\n  return [\n    ...arr1.filter((value) => !arr2.includes(value)),\n    ...arr2.filter((value) => !arr1.includes(value)),\n  ];\n};\n"],"names":["getDiff","arr1","arr2","Array","isArray","TypeError","filter","value","includes"],"mappings":"MAwBaA,QAAU,CAAIC,KAAWC,QACpC,IAAKC,MAAMC,QAAQH,QAAUE,MAAMC,QAAQF,MACzC,MAAM,IAAIG,UAAU,yCAEtB,MAAO,IACFJ,KAAKK,OAAQC,QAAWL,KAAKM,SAASD,WACtCL,KAAKI,OAAQC,QAAWN,KAAKO,SAASD"}