@tanstack/db
Version:
A reactive client store for building super fast apps on sync
1 lines • 1.08 kB
Source Map (JSON)
{"version":3,"file":"type-guards.cjs","sources":["../../../src/utils/type-guards.ts"],"sourcesContent":["export function isPlainObject(\n value: unknown,\n): value is Record<PropertyKey, unknown> {\n if (value === null || typeof value !== `object`) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\n/**\n * Type guard to check if a value is promise-like (has a `.then` method)\n * @param value - The value to check\n * @returns True if the value is promise-like, false otherwise\n */\nexport function isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return (\n !!value &&\n (typeof value === `object` || typeof value === `function`) &&\n typeof (value as { then?: unknown }).then === `function`\n )\n}\n"],"names":[],"mappings":";;AAAO,SAAS,cACd,OACuC;AACvC,MAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,QAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,SAAO,cAAc,OAAO,aAAa,cAAc;AACzD;AAOO,SAAS,cAAc,OAA+C;AAC3E,SACE,CAAC,CAAC,UACD,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C,OAAQ,MAA6B,SAAS;AAElD;;;"}