{"version":3,"file":"once.cjs","names":[],"sources":["../src/once.ts"],"sourcesContent":["/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.\n *\n * @param fn - The function to wrap.\n * @signature once(fn)\n * @example\n * const initialize = once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n * @category Function\n */\nexport function once<T>(fn: () => T): () => T {\n  let called = false;\n  let ret: T;\n  return () => {\n    if (!called) {\n      ret = fn();\n      called = true;\n    }\n    return ret;\n  };\n}\n"],"mappings":"mEAYA,SAAgB,EAAQ,EAAsB,CAC5C,IAAI,EAAS,GACT,EACJ,WACE,AAEE,KADA,EAAM,GAAI,CACD,IAEJ"}