Sha256: c6f899fb8323905881dcf91fb7bf2a55a29c3844aaceeca2f823d2bc4b7e8d20

Contents?: true

Size: 999 Bytes

Versions: 26

Compression:

Stored size: 999 Bytes

Contents

{"version":3,"sources":["../src/until.ts"],"sourcesContent":["export type AsyncTuple<\n  ErrorType extends any = Error,\n  DataType extends any = unknown,\n> =\n  | {\n      error: ErrorType\n      data: null\n    }\n  | { error: null; data: DataType }\n\n/**\n * Gracefully handles a given Promise factory.\n * @example\n * const { error, data } = await until(() => asyncAction())\n */\nexport const until = async <\n  ErrorType extends any = Error,\n  DataType extends any = unknown,\n>(\n  promise: () => Promise<DataType>,\n): Promise<AsyncTuple<ErrorType, DataType>> => {\n  try {\n    const data = await promise().catch((error) => {\n      throw error\n    })\n    return { error: null, data }\n  } catch (error) {\n    return { error, data: null }\n  }\n}\n"],"mappings":";AAeO,IAAM,QAAQ,OAInB,YAC6C;AAC7C,MAAI;AACF,UAAM,OAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,UAAU;AAC5C,YAAM;AAAA,IACR,CAAC;AACD,WAAO,EAAE,OAAO,MAAM,KAAK;AAAA,EAC7B,SAAS,OAAP;AACA,WAAO,EAAE,OAAO,MAAM,KAAK;AAAA,EAC7B;AACF;","names":[]}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.25 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.24 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.23 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.22 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.21 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.20 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.19 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.18 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.17 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.16 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.15 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.14 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.13 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.12 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.11 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.10 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.9 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.8 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map
clapton-0.0.7 lib/clapton/javascripts/node_modules/@open-draft/until/lib/index.mjs.map