{"version":3,"sources":["../../src/functions/createKnownTypeGuard/createKnownTypeGuard.ts","../../src/functions/without/without.ts"],"names":[],"mappings":";AAkBO,SAAS,qBAGd,QAA0B;AAC1B,QAAM,YAAY,IAAI,IAAa,MAAM;AACzC,SAAO,SAAS,cAAc,GAA+C;AAC3E,WAAO,UAAU,IAAI,CAAC;AAAA,EACxB;AACF;;;ACrBO,SAAS,QACd,OACA,gBACiB;AACjB,QAAM,kBAAkB,qBAAqB,cAAc;AAC3D,SAAO,MAAM,OAAO,CAAC,SAAgC,CAAC,gBAAgB,IAAI,CAAC;AAC7E","sourcesContent":["/**\n * Creates a type guard that checks if the given type is assignable to the given type.\n *\n * @param values The values to check against.\n * @template {TCheckedValue} The type to check against, `unknown` by default. Pass in if you want to have a narrowed type for the type predicate (e.g. `string`).\n * @returns A type guard that checks if the given type is assignable to the given type.\n *\n * @example\n * ```ts\n * const VALID_VALUES = ['foo', 'bar'] as const;\n * const isValidValue = createKnownTypeGuard(VALID_VALUES);\n *\n * const value: unknown = '...';\n * if (isValidValue(value)) {\n *   // ✅ value is of type `'foo' | 'bar'`\n * }\n * ```\n */\nexport function createKnownTypeGuard<\n  TValue,\n  TCheckedValue extends TValue | unknown = unknown\n>(values: Iterable<TValue>) {\n  const setValues = new Set<unknown>(values);\n  return function guardFunction(v: TCheckedValue): v is TCheckedValue & TValue {\n    return setValues.has(v);\n  };\n}\n","import { createKnownTypeGuard } from '../createKnownTypeGuard';\n\n/**\n * Gets the difference between two arrays.\n */\nexport function without<T, const S extends T>(\n  array: readonly T[],\n  itemsToExclude: Iterable<S>\n): Exclude<T, S>[] {\n  const isItemToExclude = createKnownTypeGuard(itemsToExclude);\n  return array.filter((item): item is Exclude<T, S> => !isItemToExclude(item));\n}\n"]}