{"version":3,"file":"pick.mjs","names":[],"sources":["../src/pick.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n                       🗲 Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website:                  https://stormsoftware.com\n Repository:               https://github.com/storm-software/stryke\n Documentation:            https://docs.stormsoftware.com/projects/stryke\n Contact:                  https://stormsoftware.com/contact\n\n SPDX-License-Identifier:  Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @param obj - The object to pick keys from.\n * @param keys - An array of keys to be picked from the object.\n * @returns A new object with the specified keys picked.\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n * ```\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(\n  obj: T,\n  keys: readonly K[]\n): Pick<T, K> {\n  const result = {} as Pick<T, K>;\n\n  for (let i = 0; i < keys.length; i++) {\n    const key = keys[i];\n\n    if (key && Object.hasOwn(obj, key)) {\n      result[key] = obj[key];\n    }\n  }\n\n  return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,SAAgB,KACd,KACA,MACY;CACZ,MAAM,SAAS,EAAE;AAEjB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;AAEjB,MAAI,OAAO,OAAO,OAAO,KAAK,IAAI,CAChC,QAAO,OAAO,IAAI;;AAItB,QAAO"}