tinybase 7.0.0-beta.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/@types/common/index.d.ts +1 -1
  2. package/@types/mergeable-store/index.d.ts +1 -1
  3. package/@types/mergeable-store/with-schemas/index.d.ts +1 -1
  4. package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +4 -0
  5. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +4 -0
  6. package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +4 -0
  7. package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +4 -0
  8. package/@types/persisters/persister-electric-sql/index.d.ts +4 -0
  9. package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +4 -0
  10. package/@types/persisters/persister-expo-sqlite/index.d.ts +4 -0
  11. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +4 -0
  12. package/@types/persisters/persister-libsql/index.d.ts +4 -0
  13. package/@types/persisters/persister-libsql/with-schemas/index.d.ts +4 -0
  14. package/@types/persisters/persister-pglite/index.d.ts +5 -1
  15. package/@types/persisters/persister-pglite/with-schemas/index.d.ts +5 -1
  16. package/@types/persisters/persister-postgres/index.d.ts +4 -0
  17. package/@types/persisters/persister-postgres/with-schemas/index.d.ts +4 -0
  18. package/@types/persisters/persister-powersync/index.d.ts +4 -0
  19. package/@types/persisters/persister-powersync/with-schemas/index.d.ts +4 -0
  20. package/@types/persisters/persister-react-native-sqlite/index.d.ts +4 -0
  21. package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +4 -0
  22. package/@types/persisters/persister-sqlite-bun/index.d.ts +4 -0
  23. package/@types/persisters/persister-sqlite-bun/with-schemas/index.d.ts +4 -0
  24. package/@types/persisters/persister-sqlite-wasm/index.d.ts +4 -0
  25. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +4 -0
  26. package/@types/persisters/persister-sqlite3/index.d.ts +4 -0
  27. package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +4 -0
  28. package/@types/queries/index.d.ts +1 -1
  29. package/@types/store/index.d.ts +21 -19
  30. package/@types/store/with-schemas/index.d.ts +15 -13
  31. package/agents.md +62 -0
  32. package/checkpoints/index.js +8 -6
  33. package/checkpoints/with-schemas/index.js +8 -6
  34. package/common/index.js +4 -3
  35. package/common/with-schemas/index.js +4 -3
  36. package/index.js +60 -30
  37. package/indexes/index.js +7 -5
  38. package/indexes/with-schemas/index.js +7 -5
  39. package/mergeable-store/index.js +51 -21
  40. package/mergeable-store/with-schemas/index.js +51 -21
  41. package/metrics/index.js +7 -5
  42. package/metrics/with-schemas/index.js +7 -5
  43. package/min/checkpoints/index.js +1 -1
  44. package/min/checkpoints/index.js.gz +0 -0
  45. package/min/checkpoints/with-schemas/index.js +1 -1
  46. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  47. package/min/common/index.js +1 -1
  48. package/min/common/index.js.gz +0 -0
  49. package/min/common/with-schemas/index.js +1 -1
  50. package/min/common/with-schemas/index.js.gz +0 -0
  51. package/min/index.js +1 -1
  52. package/min/index.js.gz +0 -0
  53. package/min/indexes/index.js +1 -1
  54. package/min/indexes/index.js.gz +0 -0
  55. package/min/indexes/with-schemas/index.js +1 -1
  56. package/min/indexes/with-schemas/index.js.gz +0 -0
  57. package/min/mergeable-store/index.js +1 -1
  58. package/min/mergeable-store/index.js.gz +0 -0
  59. package/min/mergeable-store/with-schemas/index.js +1 -1
  60. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  61. package/min/metrics/index.js +1 -1
  62. package/min/metrics/index.js.gz +0 -0
  63. package/min/metrics/with-schemas/index.js +1 -1
  64. package/min/metrics/with-schemas/index.js.gz +0 -0
  65. package/min/omni/index.js +1 -1
  66. package/min/omni/index.js.gz +0 -0
  67. package/min/omni/with-schemas/index.js +1 -1
  68. package/min/omni/with-schemas/index.js.gz +0 -0
  69. package/min/persisters/index.js +1 -1
  70. package/min/persisters/index.js.gz +0 -0
  71. package/min/persisters/persister-automerge/index.js +1 -1
  72. package/min/persisters/persister-automerge/index.js.gz +0 -0
  73. package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  74. package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  75. package/min/persisters/persister-browser/index.js +1 -1
  76. package/min/persisters/persister-browser/index.js.gz +0 -0
  77. package/min/persisters/persister-browser/with-schemas/index.js +1 -1
  78. package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
  79. package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  80. package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  81. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  82. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
  83. package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
  84. package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
  85. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  86. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
  87. package/min/persisters/persister-durable-object-storage/index.js +1 -1
  88. package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
  89. package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
  90. package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
  91. package/min/persisters/persister-electric-sql/index.js +1 -1
  92. package/min/persisters/persister-electric-sql/index.js.gz +0 -0
  93. package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  94. package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
  95. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  96. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  97. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  98. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  99. package/min/persisters/persister-file/index.js +1 -1
  100. package/min/persisters/persister-file/index.js.gz +0 -0
  101. package/min/persisters/persister-file/with-schemas/index.js +1 -1
  102. package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
  103. package/min/persisters/persister-indexed-db/index.js +1 -1
  104. package/min/persisters/persister-indexed-db/index.js.gz +0 -0
  105. package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  106. package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  107. package/min/persisters/persister-libsql/index.js +1 -1
  108. package/min/persisters/persister-libsql/index.js.gz +0 -0
  109. package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
  110. package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
  111. package/min/persisters/persister-partykit-client/index.js +1 -1
  112. package/min/persisters/persister-partykit-client/index.js.gz +0 -0
  113. package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  114. package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  115. package/min/persisters/persister-partykit-server/index.js +1 -1
  116. package/min/persisters/persister-partykit-server/index.js.gz +0 -0
  117. package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
  118. package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
  119. package/min/persisters/persister-pglite/index.js +1 -1
  120. package/min/persisters/persister-pglite/index.js.gz +0 -0
  121. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  122. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  123. package/min/persisters/persister-postgres/index.js +1 -1
  124. package/min/persisters/persister-postgres/index.js.gz +0 -0
  125. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  126. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  127. package/min/persisters/persister-powersync/index.js +1 -1
  128. package/min/persisters/persister-powersync/index.js.gz +0 -0
  129. package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
  130. package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
  131. package/min/persisters/persister-react-native-mmkv/index.js +1 -1
  132. package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
  133. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -1
  134. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
  135. package/min/persisters/persister-react-native-sqlite/index.js +1 -1
  136. package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
  137. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
  138. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
  139. package/min/persisters/persister-remote/index.js +1 -1
  140. package/min/persisters/persister-remote/index.js.gz +0 -0
  141. package/min/persisters/persister-remote/with-schemas/index.js +1 -1
  142. package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
  143. package/min/persisters/persister-sqlite-bun/index.js +1 -1
  144. package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
  145. package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  146. package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
  147. package/min/persisters/persister-sqlite-wasm/index.js +1 -1
  148. package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  149. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  150. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
  151. package/min/persisters/persister-sqlite3/index.js +1 -1
  152. package/min/persisters/persister-sqlite3/index.js.gz +0 -0
  153. package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  154. package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
  155. package/min/persisters/persister-yjs/index.js +1 -1
  156. package/min/persisters/persister-yjs/index.js.gz +0 -0
  157. package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  158. package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  159. package/min/persisters/with-schemas/index.js +1 -1
  160. package/min/persisters/with-schemas/index.js.gz +0 -0
  161. package/min/queries/index.js +1 -1
  162. package/min/queries/index.js.gz +0 -0
  163. package/min/queries/with-schemas/index.js +1 -1
  164. package/min/queries/with-schemas/index.js.gz +0 -0
  165. package/min/relationships/index.js +1 -1
  166. package/min/relationships/index.js.gz +0 -0
  167. package/min/relationships/with-schemas/index.js +1 -1
  168. package/min/relationships/with-schemas/index.js.gz +0 -0
  169. package/min/store/index.js +1 -1
  170. package/min/store/index.js.gz +0 -0
  171. package/min/store/with-schemas/index.js +1 -1
  172. package/min/store/with-schemas/index.js.gz +0 -0
  173. package/min/synchronizers/index.js +1 -1
  174. package/min/synchronizers/index.js.gz +0 -0
  175. package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  176. package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  177. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  178. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  179. package/min/synchronizers/synchronizer-local/index.js +1 -1
  180. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  181. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  182. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  183. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  184. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  185. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  186. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  187. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  188. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  189. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  190. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  191. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
  192. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
  193. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
  194. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
  195. package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
  196. package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
  197. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
  198. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
  199. package/min/synchronizers/with-schemas/index.js +1 -1
  200. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  201. package/min/ui-react/index.js +1 -1
  202. package/min/ui-react/index.js.gz +0 -0
  203. package/min/ui-react/with-schemas/index.js +1 -1
  204. package/min/ui-react/with-schemas/index.js.gz +0 -0
  205. package/min/ui-react-dom/index.js +1 -1
  206. package/min/ui-react-dom/index.js.gz +0 -0
  207. package/min/ui-react-dom/with-schemas/index.js +1 -1
  208. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  209. package/min/ui-react-inspector/index.js +1 -1
  210. package/min/ui-react-inspector/index.js.gz +0 -0
  211. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  212. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  213. package/min/with-schemas/index.js +1 -1
  214. package/min/with-schemas/index.js.gz +0 -0
  215. package/omni/index.js +78 -46
  216. package/omni/with-schemas/index.js +78 -46
  217. package/package.json +3 -3
  218. package/persisters/index.js +14 -10
  219. package/persisters/persister-automerge/index.js +12 -8
  220. package/persisters/persister-automerge/with-schemas/index.js +12 -8
  221. package/persisters/persister-browser/index.js +12 -8
  222. package/persisters/persister-browser/with-schemas/index.js +12 -8
  223. package/persisters/persister-cr-sqlite-wasm/index.js +14 -10
  224. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +14 -10
  225. package/persisters/persister-durable-object-sql-storage/index.js +14 -10
  226. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +14 -10
  227. package/persisters/persister-durable-object-storage/index.js +12 -8
  228. package/persisters/persister-durable-object-storage/with-schemas/index.js +12 -8
  229. package/persisters/persister-electric-sql/index.js +14 -10
  230. package/persisters/persister-electric-sql/with-schemas/index.js +14 -10
  231. package/persisters/persister-expo-sqlite/index.js +14 -10
  232. package/persisters/persister-expo-sqlite/with-schemas/index.js +14 -10
  233. package/persisters/persister-file/index.js +12 -8
  234. package/persisters/persister-file/with-schemas/index.js +12 -8
  235. package/persisters/persister-indexed-db/index.js +12 -8
  236. package/persisters/persister-indexed-db/with-schemas/index.js +12 -8
  237. package/persisters/persister-libsql/index.js +14 -10
  238. package/persisters/persister-libsql/with-schemas/index.js +14 -10
  239. package/persisters/persister-partykit-client/index.js +12 -8
  240. package/persisters/persister-partykit-client/with-schemas/index.js +12 -8
  241. package/persisters/persister-partykit-server/index.js +4 -3
  242. package/persisters/persister-partykit-server/with-schemas/index.js +4 -3
  243. package/persisters/persister-pglite/index.js +13 -9
  244. package/persisters/persister-pglite/with-schemas/index.js +13 -9
  245. package/persisters/persister-postgres/index.js +13 -9
  246. package/persisters/persister-postgres/with-schemas/index.js +13 -9
  247. package/persisters/persister-powersync/index.js +14 -10
  248. package/persisters/persister-powersync/with-schemas/index.js +14 -10
  249. package/persisters/persister-react-native-mmkv/index.js +12 -8
  250. package/persisters/persister-react-native-mmkv/with-schemas/index.js +12 -8
  251. package/persisters/persister-react-native-sqlite/index.js +14 -10
  252. package/persisters/persister-react-native-sqlite/with-schemas/index.js +14 -10
  253. package/persisters/persister-remote/index.js +14 -10
  254. package/persisters/persister-remote/with-schemas/index.js +14 -10
  255. package/persisters/persister-sqlite-bun/index.js +14 -10
  256. package/persisters/persister-sqlite-bun/with-schemas/index.js +14 -10
  257. package/persisters/persister-sqlite-wasm/index.js +14 -10
  258. package/persisters/persister-sqlite-wasm/with-schemas/index.js +14 -10
  259. package/persisters/persister-sqlite3/index.js +14 -10
  260. package/persisters/persister-sqlite3/with-schemas/index.js +14 -10
  261. package/persisters/persister-yjs/index.js +18 -12
  262. package/persisters/persister-yjs/with-schemas/index.js +18 -12
  263. package/persisters/with-schemas/index.js +14 -10
  264. package/queries/index.js +17 -12
  265. package/queries/with-schemas/index.js +17 -12
  266. package/readme.md +2 -2
  267. package/relationships/index.js +7 -5
  268. package/relationships/with-schemas/index.js +7 -5
  269. package/releases.md +100 -12
  270. package/store/index.js +48 -18
  271. package/store/with-schemas/index.js +48 -18
  272. package/synchronizers/index.js +13 -9
  273. package/synchronizers/synchronizer-broadcast-channel/index.js +14 -10
  274. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +14 -10
  275. package/synchronizers/synchronizer-local/index.js +14 -10
  276. package/synchronizers/synchronizer-local/with-schemas/index.js +14 -10
  277. package/synchronizers/synchronizer-ws-client/index.js +13 -9
  278. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +13 -9
  279. package/synchronizers/synchronizer-ws-server/index.js +13 -9
  280. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +13 -9
  281. package/synchronizers/synchronizer-ws-server-durable-object/index.js +13 -9
  282. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +13 -9
  283. package/synchronizers/synchronizer-ws-server-simple/index.js +5 -4
  284. package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +5 -4
  285. package/synchronizers/with-schemas/index.js +13 -9
  286. package/ui-react/index.js +9 -6
  287. package/ui-react/with-schemas/index.js +9 -6
  288. package/ui-react-dom/index.js +14 -7
  289. package/ui-react-dom/with-schemas/index.js +14 -7
  290. package/ui-react-inspector/index.js +53 -23
  291. package/ui-react-inspector/with-schemas/index.js +53 -23
  292. package/with-schemas/index.js +60 -30
@@ -5,9 +5,13 @@ const EMPTY_STRING = '';
5
5
  const T = 't';
6
6
  const V = 'v';
7
7
 
8
- const isUndefined = (thing) => thing == void 0;
9
- const ifNotUndefined = (value, then, otherwise) =>
10
- isUndefined(value) ? otherwise?.() : then(value);
8
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
9
+ predicate(value) ? otherwise?.() : then(value);
10
+ const isNullish = (thing) => thing == null;
11
+ const isUndefined = (thing) => thing === void 0;
12
+ const isNull = (thing) => thing === null;
13
+ const ifNotNullish = getIfNotFunction(isNullish);
14
+ const ifNotUndefined = getIfNotFunction(isUndefined);
11
15
  const isArray = (thing) => Array.isArray(thing);
12
16
  const size = (arrayOrString) => arrayOrString.length;
13
17
  const test = (regex, subject) => regex.test(subject);
@@ -40,12 +44,12 @@ const object = Object;
40
44
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
41
45
  const objEntries = object.entries;
42
46
  const isObject = (obj) =>
43
- !isUndefined(obj) &&
44
- ifNotUndefined(
47
+ !isNullish(obj) &&
48
+ ifNotNullish(
45
49
  getPrototypeOf(obj),
46
50
  (objPrototype) =>
47
51
  objPrototype == object.prototype ||
48
- isUndefined(getPrototypeOf(objPrototype)),
52
+ isNullish(getPrototypeOf(objPrototype)),
49
53
 
50
54
  /* istanbul ignore next */
51
55
  () => true,
@@ -72,7 +76,7 @@ const mapGet = (map, key) => map?.get(key);
72
76
  const mapForEach = (map, cb) =>
73
77
  collForEach(map, (value, key) => cb(key, value));
74
78
  const mapSet = (map, key, value) =>
75
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
79
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
76
80
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
77
81
  if (!collHas(map, key)) {
78
82
  mapSet(map, key, getDefaultValue());
@@ -183,7 +187,7 @@ const getListenerFunctions = (getThing) => {
183
187
  const index = size(ids);
184
188
  if (index == size(path)) {
185
189
  listener(thing, ...ids, ...extraArgsGetter(ids));
186
- } else if (isUndefined(path[index])) {
190
+ } else if (isNull(path[index])) {
187
191
  arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
188
192
  callWithIds(...ids, id2),
189
193
  );
@@ -459,7 +463,8 @@ const getChangesFromYDoc = (yContent, events) => {
459
463
  mapForEach(
460
464
  keys,
461
465
  (cellId, {action}) =>
462
- (row[cellId] = action == DELETE ? null : yRow.get(cellId)),
466
+ (row[cellId] =
467
+ action == DELETE ? void 0 : yRow.get(cellId)),
463
468
  );
464
469
  },
465
470
  () =>
@@ -467,7 +472,7 @@ const getChangesFromYDoc = (yContent, events) => {
467
472
  keys,
468
473
  (rowId, {action}) =>
469
474
  (table[rowId] =
470
- action == DELETE ? null : yTable.get(rowId)?.toJSON()),
475
+ action == DELETE ? void 0 : yTable.get(rowId)?.toJSON()),
471
476
  ),
472
477
  );
473
478
  },
@@ -476,13 +481,14 @@ const getChangesFromYDoc = (yContent, events) => {
476
481
  keys,
477
482
  (tableId, {action}) =>
478
483
  (tables[tableId] =
479
- action == DELETE ? null : yTables.get(tableId)?.toJSON()),
484
+ action == DELETE ? void 0 : yTables.get(tableId)?.toJSON()),
480
485
  ),
481
486
  )
482
487
  : mapForEach(
483
488
  keys,
484
489
  (valueId, {action}) =>
485
- (values[valueId] = action == DELETE ? null : yValues.get(valueId)),
490
+ (values[valueId] =
491
+ action == DELETE ? void 0 : yValues.get(valueId)),
486
492
  ),
487
493
  );
488
494
  return [tables, values, 1];
@@ -13,15 +13,19 @@ const strReplace = (str, searchValue, replaceValue) =>
13
13
  str.replace(searchValue, replaceValue);
14
14
 
15
15
  const promise = Promise;
16
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
17
+ predicate(value) ? otherwise?.() : then(value);
16
18
  const GLOBAL = globalThis;
17
19
  const THOUSAND = 1e3;
18
20
  const startInterval = (callback, sec, immediate) => {
19
21
  return setInterval(callback, sec * THOUSAND);
20
22
  };
21
23
  const stopInterval = clearInterval;
22
- const isUndefined = (thing) => thing == void 0;
23
- const ifNotUndefined = (value, then, otherwise) =>
24
- isUndefined(value) ? otherwise?.() : then(value);
24
+ const isNullish = (thing) => thing == null;
25
+ const isUndefined = (thing) => thing === void 0;
26
+ const isNull = (thing) => thing === null;
27
+ const ifNotNullish = getIfNotFunction(isNullish);
28
+ const ifNotUndefined = getIfNotFunction(isUndefined);
25
29
  const isString = (thing) => getTypeOf(thing) == STRING;
26
30
  const isArray = (thing) => Array.isArray(thing);
27
31
  const slice = (arrayOrString, start, end) => arrayOrString.slice(start, end);
@@ -61,12 +65,12 @@ const object = Object;
61
65
  const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
62
66
  const objEntries = object.entries;
63
67
  const isObject = (obj) =>
64
- !isUndefined(obj) &&
65
- ifNotUndefined(
68
+ !isNullish(obj) &&
69
+ ifNotNullish(
66
70
  getPrototypeOf(obj),
67
71
  (objPrototype) =>
68
72
  objPrototype == object.prototype ||
69
- isUndefined(getPrototypeOf(objPrototype)),
73
+ isNullish(getPrototypeOf(objPrototype)),
70
74
 
71
75
  /* istanbul ignore next */
72
76
  () => true,
@@ -95,7 +99,7 @@ const mapForEach = (map, cb) =>
95
99
  const mapMap = (coll, cb) =>
96
100
  arrayMap([...(coll?.entries() ?? [])], ([key, value]) => cb(value, key));
97
101
  const mapSet = (map, key, value) =>
98
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
102
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
99
103
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
100
104
  if (!collHas(map, key)) {
101
105
  mapSet(map, key, getDefaultValue());
@@ -206,7 +210,7 @@ const getListenerFunctions = (getThing) => {
206
210
  const index = size(ids);
207
211
  if (index == size(path)) {
208
212
  listener(thing, ...ids, ...extraArgsGetter(ids));
209
- } else if (isUndefined(path[index])) {
213
+ } else if (isNull(path[index])) {
210
214
  arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
211
215
  callWithIds(...ids, id2),
212
216
  );
@@ -579,7 +583,7 @@ const getDefaultedTabularConfigMap = (
579
583
  0,
580
584
  objSize(defaultObj),
581
585
  );
582
- if (!isUndefined(defaultedConfig[0]) && !exclude(id, defaultedConfig[0])) {
586
+ if (!isNull(defaultedConfig[0]) && !exclude(id, defaultedConfig[0])) {
583
587
  then(id, defaultedConfig[0]);
584
588
  mapSet(configMap, id, defaultedConfig);
585
589
  }
@@ -1306,7 +1310,7 @@ const createCustomSqlitePersister = (
1306
1310
  ` ${DATA_VERSION} d,${SCHEMA_VERSION} s,TOTAL_CHANGES() c FROM ${PRAGMA}${DATA_VERSION} JOIN ${PRAGMA}${SCHEMA_VERSION}`,
1307
1311
  );
1308
1312
  if (d != dataVersion || s != schemaVersion || c != totalChanges) {
1309
- if (dataVersion != null) {
1313
+ if (!isNullish(dataVersion)) {
1310
1314
  listener();
1311
1315
  }
1312
1316
  dataVersion = d;
package/queries/index.js CHANGED
@@ -21,13 +21,15 @@ const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
21
21
  const CELL = 'Cell';
22
22
  const CELL_IDS = CELL + IDS;
23
23
 
24
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
25
+ predicate(value) ? otherwise?.() : then(value);
24
26
  const math = Math;
25
27
  const mathMax = math.max;
26
28
  const mathMin = math.min;
27
29
  const isFiniteNumber = isFinite;
28
- const isUndefined = (thing) => thing == void 0;
29
- const ifNotUndefined = (value, then, otherwise) =>
30
- isUndefined(value) ? otherwise?.() : then(value);
30
+ const isUndefined = (thing) => thing === void 0;
31
+ const isNull = (thing) => thing === null;
32
+ const ifNotUndefined = getIfNotFunction(isUndefined);
31
33
  const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
32
34
  const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
33
35
  const isArray = (thing) => Array.isArray(thing);
@@ -69,7 +71,7 @@ const mapGet = (map, key) => map?.get(key);
69
71
  const mapForEach = (map, cb) =>
70
72
  collForEach(map, (value, key) => cb(key, value));
71
73
  const mapSet = (map, key, value) =>
72
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
74
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
73
75
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
74
76
  if (!collHas(map, key)) {
75
77
  mapSet(map, key, getDefaultValue());
@@ -170,6 +172,9 @@ const getAggregateValue = (
170
172
  };
171
173
 
172
174
  const getCellOrValueType = (cellOrValue) => {
175
+ if (isNull(cellOrValue)) {
176
+ return 'null';
177
+ }
173
178
  const type = getTypeOf(cellOrValue);
174
179
  return isTypeStringOrBoolean(type) ||
175
180
  (type == NUMBER && isFiniteNumber(cellOrValue))
@@ -426,7 +431,7 @@ const createQueries = getCreateFunction((store) => {
426
431
  setDefinition(queryId, tableId);
427
432
  resetPreStores(queryId);
428
433
  const selectEntries = [];
429
- const joinEntries = [[null, [tableId, null, null, [], mapNew()]]];
434
+ const joinEntries = [[void 0, [tableId, void 0, void 0, [], mapNew()]]];
430
435
  const wheres = [];
431
436
  const groupEntries = [];
432
437
  const havings = [];
@@ -442,7 +447,7 @@ const createQueries = getCreateFunction((store) => {
442
447
  };
443
448
  const join = (joinedTableId, arg1, arg2) => {
444
449
  const fromIntermediateJoinedTableId =
445
- isUndefined(arg2) || isFunction(arg1) ? null : arg1;
450
+ isUndefined(arg2) || isFunction(arg1) ? void 0 : arg1;
446
451
  const onArg = isUndefined(fromIntermediateJoinedTableId) ? arg1 : arg2;
447
452
  const joinEntry = [
448
453
  joinedTableId,
@@ -562,7 +567,7 @@ const createQueries = getCreateFunction((store) => {
562
567
  groupRow[groupedCellId] = isUndefined(
563
568
  getCellOrValueType(aggregateValue),
564
569
  )
565
- ? null
570
+ ? void 0
566
571
  : aggregateValue;
567
572
  },
568
573
  );
@@ -691,20 +696,20 @@ const createQueries = getCreateFunction((store) => {
691
696
  const listenToTable = (rootRowId, tableId2, rowId, joinedTableIds2) => {
692
697
  const getCell = (cellId) => store.getCell(tableId2, rowId, cellId);
693
698
  arrayForEach(joinedTableIds2, (remoteAsTableId) => {
694
- const [realJoinedTableId, , on, nextJoinedTableIds, remoteIdPair] =
699
+ const [realJoinedTableId, , on, nextJoinedTableIds, remoteIdPairs] =
695
700
  mapGet(joins, remoteAsTableId);
696
701
  const remoteRowId = on?.(getCell, rootRowId);
697
702
  const [previousRemoteRowId, previousRemoteListenerId] =
698
- mapGet(remoteIdPair, rootRowId) ?? [];
703
+ mapGet(remoteIdPairs, rootRowId) ?? [];
699
704
  if (remoteRowId != previousRemoteRowId) {
700
705
  if (!isUndefined(previousRemoteListenerId)) {
701
706
  delStoreListeners(queryId, previousRemoteListenerId);
702
707
  }
703
708
  mapSet(
704
- remoteIdPair,
709
+ remoteIdPairs,
705
710
  rootRowId,
706
711
  isUndefined(remoteRowId)
707
- ? null
712
+ ? void 0
708
713
  : [
709
714
  remoteRowId,
710
715
  ...addStoreListeners(
@@ -725,7 +730,7 @@ const createQueries = getCreateFunction((store) => {
725
730
  });
726
731
  writeSelectRow(rootRowId);
727
732
  };
728
- const {3: joinedTableIds} = mapGet(joins, null);
733
+ const {3: joinedTableIds} = mapGet(joins, void 0);
729
734
  selectJoinWhereStore.transaction(() =>
730
735
  addStoreListeners(
731
736
  queryId,
@@ -21,13 +21,15 @@ const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
21
21
  const CELL = 'Cell';
22
22
  const CELL_IDS = CELL + IDS;
23
23
 
24
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
25
+ predicate(value) ? otherwise?.() : then(value);
24
26
  const math = Math;
25
27
  const mathMax = math.max;
26
28
  const mathMin = math.min;
27
29
  const isFiniteNumber = isFinite;
28
- const isUndefined = (thing) => thing == void 0;
29
- const ifNotUndefined = (value, then, otherwise) =>
30
- isUndefined(value) ? otherwise?.() : then(value);
30
+ const isUndefined = (thing) => thing === void 0;
31
+ const isNull = (thing) => thing === null;
32
+ const ifNotUndefined = getIfNotFunction(isUndefined);
31
33
  const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
32
34
  const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
33
35
  const isArray = (thing) => Array.isArray(thing);
@@ -69,7 +71,7 @@ const mapGet = (map, key) => map?.get(key);
69
71
  const mapForEach = (map, cb) =>
70
72
  collForEach(map, (value, key) => cb(key, value));
71
73
  const mapSet = (map, key, value) =>
72
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
74
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
73
75
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
74
76
  if (!collHas(map, key)) {
75
77
  mapSet(map, key, getDefaultValue());
@@ -170,6 +172,9 @@ const getAggregateValue = (
170
172
  };
171
173
 
172
174
  const getCellOrValueType = (cellOrValue) => {
175
+ if (isNull(cellOrValue)) {
176
+ return 'null';
177
+ }
173
178
  const type = getTypeOf(cellOrValue);
174
179
  return isTypeStringOrBoolean(type) ||
175
180
  (type == NUMBER && isFiniteNumber(cellOrValue))
@@ -426,7 +431,7 @@ const createQueries = getCreateFunction((store) => {
426
431
  setDefinition(queryId, tableId);
427
432
  resetPreStores(queryId);
428
433
  const selectEntries = [];
429
- const joinEntries = [[null, [tableId, null, null, [], mapNew()]]];
434
+ const joinEntries = [[void 0, [tableId, void 0, void 0, [], mapNew()]]];
430
435
  const wheres = [];
431
436
  const groupEntries = [];
432
437
  const havings = [];
@@ -442,7 +447,7 @@ const createQueries = getCreateFunction((store) => {
442
447
  };
443
448
  const join = (joinedTableId, arg1, arg2) => {
444
449
  const fromIntermediateJoinedTableId =
445
- isUndefined(arg2) || isFunction(arg1) ? null : arg1;
450
+ isUndefined(arg2) || isFunction(arg1) ? void 0 : arg1;
446
451
  const onArg = isUndefined(fromIntermediateJoinedTableId) ? arg1 : arg2;
447
452
  const joinEntry = [
448
453
  joinedTableId,
@@ -562,7 +567,7 @@ const createQueries = getCreateFunction((store) => {
562
567
  groupRow[groupedCellId] = isUndefined(
563
568
  getCellOrValueType(aggregateValue),
564
569
  )
565
- ? null
570
+ ? void 0
566
571
  : aggregateValue;
567
572
  },
568
573
  );
@@ -691,20 +696,20 @@ const createQueries = getCreateFunction((store) => {
691
696
  const listenToTable = (rootRowId, tableId2, rowId, joinedTableIds2) => {
692
697
  const getCell = (cellId) => store.getCell(tableId2, rowId, cellId);
693
698
  arrayForEach(joinedTableIds2, (remoteAsTableId) => {
694
- const [realJoinedTableId, , on, nextJoinedTableIds, remoteIdPair] =
699
+ const [realJoinedTableId, , on, nextJoinedTableIds, remoteIdPairs] =
695
700
  mapGet(joins, remoteAsTableId);
696
701
  const remoteRowId = on?.(getCell, rootRowId);
697
702
  const [previousRemoteRowId, previousRemoteListenerId] =
698
- mapGet(remoteIdPair, rootRowId) ?? [];
703
+ mapGet(remoteIdPairs, rootRowId) ?? [];
699
704
  if (remoteRowId != previousRemoteRowId) {
700
705
  if (!isUndefined(previousRemoteListenerId)) {
701
706
  delStoreListeners(queryId, previousRemoteListenerId);
702
707
  }
703
708
  mapSet(
704
- remoteIdPair,
709
+ remoteIdPairs,
705
710
  rootRowId,
706
711
  isUndefined(remoteRowId)
707
- ? null
712
+ ? void 0
708
713
  : [
709
714
  remoteRowId,
710
715
  ...addStoreListeners(
@@ -725,7 +730,7 @@ const createQueries = getCreateFunction((store) => {
725
730
  });
726
731
  writeSelectRow(rootRowId);
727
732
  };
728
- const {3: joinedTableIds} = mapGet(joins, null);
733
+ const {3: joinedTableIds} = mapGet(joins, void 0);
729
734
  selectJoinWhereStore.transaction(() =>
730
735
  addStoreListeners(
731
736
  queryId,
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <link rel="preload" as="image" href="https://beta.tinybase.org/react.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/indexeddb.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/browser.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/cloudflare.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/postgresql.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/pglite.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/sqlite.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/bun.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/expo.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/electric.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/turso.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/powersync.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/partykit.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/yjs.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/crsqlite.png"><link rel="preload" as="image" href="https://beta.tinybase.org/automerge.svg?asImg"><link rel="preload" as="image" href="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/badge/Bluesky-Follow-blue?style=for-the-badge&amp;logo=bluesky&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%230285FF"><link rel="preload" as="image" href="https://img.shields.io/badge/%2F%20Twitter-Follow-blue?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%23000"><link rel="preload" as="image" href="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=Vitest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"><link rel="preload" as="image" href="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"><link rel="preload" as="image" href="https://beta.tinybase.org/ui-react-dom.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/inspector.webp"><link rel="preload" as="image" href="https://github.com/cpojer.png?size=48"><link rel="preload" as="image" href="https://github.com/expo.png?size=48"><link rel="preload" as="image" href="https://github.com/beekeeb.png?size=48"><link rel="preload" as="image" href="https://github.com/cancelself.png?size=48"><link rel="preload" as="image" href="https://github.com/WonderPanda.png?size=48"><link rel="preload" as="image" href="https://github.com/arpitBhalla.png?size=48"><link rel="preload" as="image" href="https://github.com/behrends.png?size=48"><link rel="preload" as="image" href="https://github.com/betomoedano.png?size=48"><link rel="preload" as="image" href="https://github.com/brentvatne.png?size=48"><link rel="preload" as="image" href="https://github.com/byCedric.png?size=48"><link rel="preload" as="image" href="https://github.com/circadian-risk.png?size=48"><link rel="preload" as="image" href="https://github.com/cubecull.png?size=48"><link rel="preload" as="image" href="https://github.com/erwinkn.png?size=48"><link rel="preload" as="image" href="https://github.com/ezra-en.png?size=48"><link rel="preload" as="image" href="https://github.com/feychenie.png?size=48"><link rel="preload" as="image" href="https://github.com/flaming-codes.png?size=48"><link rel="preload" as="image" href="https://github.com/fostertheweb.png?size=48"><link rel="preload" as="image" href="https://github.com/Giulio987.png?size=48"><link rel="preload" as="image" href="https://github.com/hi-ogawa.png?size=48"><link rel="preload" as="image" href="https://github.com/itsdevcoffee.png?size=48"><link rel="preload" as="image" href="https://github.com/jbolda.png?size=48"><link rel="preload" as="image" href="https://github.com/Kayoo-asso.png?size=48"><link rel="preload" as="image" href="https://github.com/kotofurumiya.png?size=48"><link rel="preload" as="image" href="https://github.com/Kudo.png?size=48"><link rel="preload" as="image" href="https://github.com/learn-anything.png?size=48"><link rel="preload" as="image" href="https://github.com/lluc.png?size=48"><link rel="preload" as="image" href="https://github.com/marksteve.png?size=48"><link rel="preload" as="image" href="https://github.com/miking-the-viking.png?size=48"><link rel="preload" as="image" href="https://github.com/mjamesderocher.png?size=48"><link rel="preload" as="image" href="https://github.com/mouktardev.png?size=48"><link rel="preload" as="image" href="https://github.com/nickmessing.png?size=48"><link rel="preload" as="image" href="https://github.com/nikitavoloboev.png?size=48"><link rel="preload" as="image" href="https://github.com/nkzw-tech.png?size=48"><link rel="preload" as="image" href="https://github.com/palerdot.png?size=48"><link rel="preload" as="image" href="https://github.com/PorcoRosso85.png?size=48"><link rel="preload" as="image" href="https://github.com/primodiumxyz.png?size=48"><link rel="preload" as="image" href="https://github.com/shaneosullivan.png?size=48"><link rel="preload" as="image" href="https://github.com/sudo-self.png?size=48"><link rel="preload" as="image" href="https://github.com/SuperSonicHub1.png?size=48"><link rel="preload" as="image" href="https://github.com/threepointone.png?size=48"><link rel="preload" as="image" href="https://github.com/uptonking.png?size=48"><link rel="preload" as="image" href="https://github.com/ViktorZhurbin.png?size=48"><link rel="preload" as="image" href="https://github.com/wilkerlucio.png?size=48"><link rel="preload" as="image" href="https://synclets.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://tinywidgets.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://tinytick.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/youtube.webp"><section id="hero"><h2 id="a-reactive-data-store-sync-engine">A <em>reactive</em> data store &amp; <span><em>sync</em> engine</span></h2></section><p><a href="https://beta.tinybase.org/guides/releases/#v6-7"><em>NEW!</em> v6.7 release</a></p><p><span id="one-with">&quot;The one with OPFS!&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://beta.tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://beta.tinybase.org/api/persister-browser">browser storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://beta.tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.7kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends.</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img src="https://beta.tinybase.org/react.svg?asImg" width="48"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img src="https://beta.tinybase.org/indexeddb.svg?asImg" width="48"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-browser"><img src="https://beta.tinybase.org/browser.svg?asImg" width="48"> OPFS</a></div><div><a href="https://beta.tinybase.org/guides/integrations/cloudflare-durable-objects"><img src="https://beta.tinybase.org/cloudflare.svg?asImg" width="48"> Cloudflare</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/postgresql.svg?asImg" width="48"> PostgreSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/pglite.svg?asImg" width="48"> PGlite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/sqlite.svg?asImg" width="48"> SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/bun.svg?asImg" width="48"> Bun SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/expo.svg?asImg" width="48"> Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/electric.svg?asImg" width="48"> ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/turso.svg?asImg" width="48"> Turso</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/powersync.svg?asImg" width="48"> PowerSync</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img src="https://beta.tinybase.org/partykit.svg?asImg" width="48"> PartyKit</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img src="https://beta.tinybase.org/yjs.svg?asImg" width="48"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img src="https://beta.tinybase.org/crsqlite.png" width="48"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img src="https://beta.tinybase.org/automerge.svg?asImg" width="48"> Automerge</a></div><p>(Baffled by all these logos? Check out our <a href="https://beta.tinybase.org/guides/the-basics/architectural-options">architectural options</a> guide to make sense of it all!)</p></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://bsky.app/profile/tinybase.bsky.social"><img src="https://img.shields.io/badge/Bluesky-Follow-blue?style=for-the-badge&amp;logo=bluesky&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%230285FF"> </a><a href="https://x.com/tinybasejs" target="_blank"><img src="https://img.shields.io/badge/%2F%20Twitter-Follow-blue?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%23000"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=Vitest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/7.0.0-beta.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/the-essentials/creating-stores/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <link rel="preload" as="image" href="https://beta.tinybase.org/react.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/indexeddb.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/browser.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/cloudflare.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/postgresql.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/pglite.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/sqlite.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/bun.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/expo.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/electric.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/turso.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/powersync.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/partykit.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/yjs.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/crsqlite.png"><link rel="preload" as="image" href="https://beta.tinybase.org/automerge.svg?asImg"><link rel="preload" as="image" href="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/badge/Bluesky-Follow-blue?style=for-the-badge&amp;logo=bluesky&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%230285FF"><link rel="preload" as="image" href="https://img.shields.io/badge/%2F%20Twitter-Follow-blue?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%23000"><link rel="preload" as="image" href="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"><link rel="preload" as="image" href="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=Vitest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"><link rel="preload" as="image" href="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"><link rel="preload" as="image" href="https://beta.tinybase.org/ui-react-dom.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/inspector.webp"><link rel="preload" as="image" href="https://github.com/cpojer.png?size=48"><link rel="preload" as="image" href="https://github.com/expo.png?size=48"><link rel="preload" as="image" href="https://github.com/beekeeb.png?size=48"><link rel="preload" as="image" href="https://github.com/cancelself.png?size=48"><link rel="preload" as="image" href="https://github.com/WonderPanda.png?size=48"><link rel="preload" as="image" href="https://github.com/arpitBhalla.png?size=48"><link rel="preload" as="image" href="https://github.com/behrends.png?size=48"><link rel="preload" as="image" href="https://github.com/betomoedano.png?size=48"><link rel="preload" as="image" href="https://github.com/brentvatne.png?size=48"><link rel="preload" as="image" href="https://github.com/byCedric.png?size=48"><link rel="preload" as="image" href="https://github.com/circadian-risk.png?size=48"><link rel="preload" as="image" href="https://github.com/cubecull.png?size=48"><link rel="preload" as="image" href="https://github.com/erwinkn.png?size=48"><link rel="preload" as="image" href="https://github.com/ezra-en.png?size=48"><link rel="preload" as="image" href="https://github.com/feychenie.png?size=48"><link rel="preload" as="image" href="https://github.com/flaming-codes.png?size=48"><link rel="preload" as="image" href="https://github.com/fostertheweb.png?size=48"><link rel="preload" as="image" href="https://github.com/Giulio987.png?size=48"><link rel="preload" as="image" href="https://github.com/hi-ogawa.png?size=48"><link rel="preload" as="image" href="https://github.com/itsdevcoffee.png?size=48"><link rel="preload" as="image" href="https://github.com/jbolda.png?size=48"><link rel="preload" as="image" href="https://github.com/Kayoo-asso.png?size=48"><link rel="preload" as="image" href="https://github.com/kotofurumiya.png?size=48"><link rel="preload" as="image" href="https://github.com/Kudo.png?size=48"><link rel="preload" as="image" href="https://github.com/learn-anything.png?size=48"><link rel="preload" as="image" href="https://github.com/lluc.png?size=48"><link rel="preload" as="image" href="https://github.com/marksteve.png?size=48"><link rel="preload" as="image" href="https://github.com/miking-the-viking.png?size=48"><link rel="preload" as="image" href="https://github.com/mjamesderocher.png?size=48"><link rel="preload" as="image" href="https://github.com/mouktardev.png?size=48"><link rel="preload" as="image" href="https://github.com/nickmessing.png?size=48"><link rel="preload" as="image" href="https://github.com/nikitavoloboev.png?size=48"><link rel="preload" as="image" href="https://github.com/nkzw-tech.png?size=48"><link rel="preload" as="image" href="https://github.com/palerdot.png?size=48"><link rel="preload" as="image" href="https://github.com/PorcoRosso85.png?size=48"><link rel="preload" as="image" href="https://github.com/primodiumxyz.png?size=48"><link rel="preload" as="image" href="https://github.com/shaneosullivan.png?size=48"><link rel="preload" as="image" href="https://github.com/sudo-self.png?size=48"><link rel="preload" as="image" href="https://github.com/SuperSonicHub1.png?size=48"><link rel="preload" as="image" href="https://github.com/threepointone.png?size=48"><link rel="preload" as="image" href="https://github.com/uptonking.png?size=48"><link rel="preload" as="image" href="https://github.com/ViktorZhurbin.png?size=48"><link rel="preload" as="image" href="https://github.com/wilkerlucio.png?size=48"><link rel="preload" as="image" href="https://synclets.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://tinywidgets.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://tinytick.org/favicon.svg?asImg"><link rel="preload" as="image" href="https://beta.tinybase.org/youtube.webp"><section id="hero"><h2 id="a-reactive-data-store-sync-engine">A <em>reactive</em> data store &amp; <span><em>sync</em> engine</span></h2></section><p><a href="https://beta.tinybase.org/guides/releases/#v7-0"><em>NEW!</em> v7.0 release</a></p><p><span id="one-with">&quot;The one with <code>NULL</code>!&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/">Read the docs</a></p><hr><section><h2 id="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://beta.tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://beta.tinybase.org/api/persister-browser">browser storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://beta.tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.4kB - 11.8kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends.</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img src="https://beta.tinybase.org/react.svg?asImg" width="48"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img src="https://beta.tinybase.org/indexeddb.svg?asImg" width="48"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-browser"><img src="https://beta.tinybase.org/browser.svg?asImg" width="48"> OPFS</a></div><div><a href="https://beta.tinybase.org/guides/integrations/cloudflare-durable-objects"><img src="https://beta.tinybase.org/cloudflare.svg?asImg" width="48"> Cloudflare</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/postgresql.svg?asImg" width="48"> PostgreSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/pglite.svg?asImg" width="48"> PGlite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/sqlite.svg?asImg" width="48"> SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/bun.svg?asImg" width="48"> Bun SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/expo.svg?asImg" width="48"> Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/electric.svg?asImg" width="48"> ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/turso.svg?asImg" width="48"> Turso</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img src="https://beta.tinybase.org/powersync.svg?asImg" width="48"> PowerSync</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img src="https://beta.tinybase.org/partykit.svg?asImg" width="48"> PartyKit</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img src="https://beta.tinybase.org/yjs.svg?asImg" width="48"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img src="https://beta.tinybase.org/crsqlite.png" width="48"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img src="https://beta.tinybase.org/automerge.svg?asImg" width="48"> Automerge</a></div><p>(Baffled by all these logos? Check out our <a href="https://beta.tinybase.org/guides/the-basics/architectural-options">architectural options</a> guide to make sense of it all!)</p></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://bsky.app/profile/tinybase.bsky.social"><img src="https://img.shields.io/badge/Bluesky-Follow-blue?style=for-the-badge&amp;logo=bluesky&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%230285FF"> </a><a href="https://x.com/tinybasejs" target="_blank"><img src="https://img.shields.io/badge/%2F%20Twitter-Follow-blue?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%23000"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=Vitest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/7.0.0-beta.3" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/the-essentials/creating-stores/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  import {createStore} from 'tinybase';
@@ -275,4 +275,4 @@ console.log(store.getCell('pets', 'felix', 'sold'));
275
275
  // -> false
276
276
  ```
277
277
 
278
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.7kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>5.1kB</em>, the ui-react-dom components are another <em>3.6kB</em>, and everything is super fast. Life is easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>53.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.7kB</td><td>122.5kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react/">ui-react</a></th><td>5.1kB</td><td>55.5kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>3.6kB</td><td>32.6kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,326</td><td>2,326</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,515</td><td>2,515</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,005</td><td>1,005</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>876</td><td>876</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,143</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,130</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img src="https://github.com/cpojer.png?size=48" title="cpojer" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img src="https://github.com/expo.png?size=48" title="expo" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img src="https://github.com/beekeeb.png?size=48" title="beekeeb" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img src="https://github.com/cancelself.png?size=48" title="cancelself" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img src="https://github.com/WonderPanda.png?size=48" title="WonderPanda" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img src="https://github.com/arpitBhalla.png?size=48" title="arpitBhalla" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/behrends" target="_blank"><img src="https://github.com/behrends.png?size=48" title="behrends" width="48" height="48"></a><a href="https://github.com/betomoedano" target="_blank"><img src="https://github.com/betomoedano.png?size=48" title="betomoedano" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img src="https://github.com/brentvatne.png?size=48" title="brentvatne" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img src="https://github.com/byCedric.png?size=48" title="byCedric" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img src="https://github.com/circadian-risk.png?size=48" title="circadian-risk" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img src="https://github.com/cpojer.png?size=48" title="cpojer" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img src="https://github.com/cubecull.png?size=48" title="cubecull" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img src="https://github.com/erwinkn.png?size=48" title="erwinkn" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img src="https://github.com/expo.png?size=48" title="expo" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img src="https://github.com/ezra-en.png?size=48" title="ezra-en" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img src="https://github.com/feychenie.png?size=48" title="feychenie" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img src="https://github.com/flaming-codes.png?size=48" title="flaming-codes" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img src="https://github.com/fostertheweb.png?size=48" title="fostertheweb" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img src="https://github.com/Giulio987.png?size=48" title="Giulio987" width="48" height="48"></a><a href="https://github.com/hi-ogawa" target="_blank"><img src="https://github.com/hi-ogawa.png?size=48" title="hi-ogawa" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img src="https://github.com/itsdevcoffee.png?size=48" title="itsdevcoffee" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img src="https://github.com/jbolda.png?size=48" title="jbolda" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img src="https://github.com/Kayoo-asso.png?size=48" title="Kayoo-asso" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img src="https://github.com/kotofurumiya.png?size=48" title="kotofurumiya" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img src="https://github.com/Kudo.png?size=48" title="Kudo" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img src="https://github.com/learn-anything.png?size=48" title="learn-anything" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img src="https://github.com/lluc.png?size=48" title="lluc" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img src="https://github.com/marksteve.png?size=48" title="marksteve" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img src="https://github.com/miking-the-viking.png?size=48" title="miking-the-viking" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img src="https://github.com/mjamesderocher.png?size=48" title="mjamesderocher" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img src="https://github.com/mouktardev.png?size=48" title="mouktardev" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img src="https://github.com/nickmessing.png?size=48" title="nickmessing" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img src="https://github.com/nikitavoloboev.png?size=48" title="nikitavoloboev" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img src="https://github.com/nkzw-tech.png?size=48" title="nkzw-tech" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img src="https://github.com/palerdot.png?size=48" title="palerdot" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img src="https://github.com/PorcoRosso85.png?size=48" title="PorcoRosso85" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img src="https://github.com/primodiumxyz.png?size=48" title="primodiumxyz" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img src="https://github.com/shaneosullivan.png?size=48" title="shaneosullivan" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img src="https://github.com/sudo-self.png?size=48" title="sudo-self" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img src="https://github.com/SuperSonicHub1.png?size=48" title="SuperSonicHub1" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img src="https://github.com/threepointone.png?size=48" title="threepointone" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img src="https://github.com/uptonking.png?size=48" title="uptonking" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img src="https://github.com/ViktorZhurbin.png?size=48" title="ViktorZhurbin" width="48" height="48"></a><a href="https://github.com/wilkerlucio" target="_blank"><img src="https://github.com/wilkerlucio.png?size=48" title="wilkerlucio" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img src="https://github.com/WonderPanda.png?size=48" title="WonderPanda" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/">Read the docs</a></p><hr><section id="family"><h2 id="meet-the-family">Meet the family</h2><p>TinyBase is part of a group of small libraries designed to help make rich client and local-first apps easier to build. Check out the others!</p><p><a href="https://synclets.org" target="_blank"><img src="https://synclets.org/favicon.svg?asImg" width="48"><br><b>Synclets</b></a><br>An open, storage-agnostic, sync engine development kit.</p><p><a href="https://tinywidgets.org" target="_blank"><img src="https://tinywidgets.org/favicon.svg?asImg" width="48"><br><b>TinyWidgets</b></a><br>A collection of tiny, reusable, UI components.</p><p><a href="https://tinytick.org" target="_blank"><img src="https://tinytick.org/favicon.svg?asImg" width="48"><br><b>TinyTick</b></a><br>A tiny but very useful task orchestrator.</p></section><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>
278
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>5.4kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.8kB</em>.</p><p>The optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>5.2kB</em>, the ui-react-dom components are another <em>3.7kB</em>, and everything is super fast. Life is easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.4kB</td><td>54.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.8kB</td><td>123.4kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react/">ui-react</a></th><td>5.2kB</td><td>55.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>3.7kB</td><td>32.8kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>2,342</td><td>2,342</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,533</td><td>2,533</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,010</td><td>1,010</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>894</td><td>892</td><td>99.8%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,101</td></tr><tr><th class="right">Assertions</th><td colspan="3">31,961</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img src="https://github.com/cpojer.png?size=48" title="cpojer" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img src="https://github.com/expo.png?size=48" title="expo" width="48" height="48"></a><a href="https://github.com/beekeeb" target="_blank"><img src="https://github.com/beekeeb.png?size=48" title="beekeeb" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img src="https://github.com/cancelself.png?size=48" title="cancelself" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img src="https://github.com/WonderPanda.png?size=48" title="WonderPanda" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img src="https://github.com/arpitBhalla.png?size=48" title="arpitBhalla" width="48" height="48"></a></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><a href="https://github.com/behrends" target="_blank"><img src="https://github.com/behrends.png?size=48" title="behrends" width="48" height="48"></a><a href="https://github.com/betomoedano" target="_blank"><img src="https://github.com/betomoedano.png?size=48" title="betomoedano" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img src="https://github.com/brentvatne.png?size=48" title="brentvatne" width="48" height="48"></a><a href="https://github.com/byCedric" target="_blank"><img src="https://github.com/byCedric.png?size=48" title="byCedric" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img src="https://github.com/circadian-risk.png?size=48" title="circadian-risk" width="48" height="48"></a><a href="https://github.com/cpojer" target="_blank"><img src="https://github.com/cpojer.png?size=48" title="cpojer" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img src="https://github.com/cubecull.png?size=48" title="cubecull" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img src="https://github.com/erwinkn.png?size=48" title="erwinkn" width="48" height="48"></a><a href="https://github.com/expo" target="_blank"><img src="https://github.com/expo.png?size=48" title="expo" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img src="https://github.com/ezra-en.png?size=48" title="ezra-en" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img src="https://github.com/feychenie.png?size=48" title="feychenie" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img src="https://github.com/flaming-codes.png?size=48" title="flaming-codes" width="48" height="48"></a><a href="https://github.com/fostertheweb" target="_blank"><img src="https://github.com/fostertheweb.png?size=48" title="fostertheweb" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img src="https://github.com/Giulio987.png?size=48" title="Giulio987" width="48" height="48"></a><a href="https://github.com/hi-ogawa" target="_blank"><img src="https://github.com/hi-ogawa.png?size=48" title="hi-ogawa" width="48" height="48"></a><a href="https://github.com/itsdevcoffee" target="_blank"><img src="https://github.com/itsdevcoffee.png?size=48" title="itsdevcoffee" width="48" height="48"></a><a href="https://github.com/jbolda" target="_blank"><img src="https://github.com/jbolda.png?size=48" title="jbolda" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img src="https://github.com/Kayoo-asso.png?size=48" title="Kayoo-asso" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img src="https://github.com/kotofurumiya.png?size=48" title="kotofurumiya" width="48" height="48"></a><a href="https://github.com/Kudo" target="_blank"><img src="https://github.com/Kudo.png?size=48" title="Kudo" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img src="https://github.com/learn-anything.png?size=48" title="learn-anything" width="48" height="48"></a><a href="https://github.com/lluc" target="_blank"><img src="https://github.com/lluc.png?size=48" title="lluc" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img src="https://github.com/marksteve.png?size=48" title="marksteve" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img src="https://github.com/miking-the-viking.png?size=48" title="miking-the-viking" width="48" height="48"></a><a href="https://github.com/mjamesderocher" target="_blank"><img src="https://github.com/mjamesderocher.png?size=48" title="mjamesderocher" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img src="https://github.com/mouktardev.png?size=48" title="mouktardev" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img src="https://github.com/nickmessing.png?size=48" title="nickmessing" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img src="https://github.com/nikitavoloboev.png?size=48" title="nikitavoloboev" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img src="https://github.com/nkzw-tech.png?size=48" title="nkzw-tech" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img src="https://github.com/palerdot.png?size=48" title="palerdot" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img src="https://github.com/PorcoRosso85.png?size=48" title="PorcoRosso85" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img src="https://github.com/primodiumxyz.png?size=48" title="primodiumxyz" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img src="https://github.com/shaneosullivan.png?size=48" title="shaneosullivan" width="48" height="48"></a><a href="https://github.com/sudo-self" target="_blank"><img src="https://github.com/sudo-self.png?size=48" title="sudo-self" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img src="https://github.com/SuperSonicHub1.png?size=48" title="SuperSonicHub1" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img src="https://github.com/threepointone.png?size=48" title="threepointone" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img src="https://github.com/uptonking.png?size=48" title="uptonking" width="48" height="48"></a><a href="https://github.com/ViktorZhurbin" target="_blank"><img src="https://github.com/ViktorZhurbin.png?size=48" title="ViktorZhurbin" width="48" height="48"></a><a href="https://github.com/wilkerlucio" target="_blank"><img src="https://github.com/wilkerlucio.png?size=48" title="wilkerlucio" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img src="https://github.com/WonderPanda.png?size=48" title="WonderPanda" width="48" height="48"></a></section><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/the-essentials/creating-stores/store/">Read the docs</a></p><hr><section id="family"><h2 id="meet-the-family">Meet the family</h2><p>TinyBase is part of a group of small libraries designed to help make rich client and local-first apps easier to build. Check out the others!</p><p><a href="https://synclets.org" target="_blank"><img src="https://synclets.org/favicon.svg?asImg" width="48"><br><b>Synclets</b></a><br>An open, storage-agnostic, sync engine development kit.</p><p><a href="https://tinywidgets.org" target="_blank"><img src="https://tinywidgets.org/favicon.svg?asImg" width="48"><br><b>TinyWidgets</b></a><br>A collection of tiny, reusable, UI components.</p><p><a href="https://tinytick.org" target="_blank"><img src="https://tinytick.org/favicon.svg?asImg" width="48"><br><b>TinyTick</b></a><br>A tiny but very useful task orchestrator.</p></section><hr><section id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://beta.tinybase.org/youtube.webp"></a></section>
@@ -2,9 +2,11 @@ const getTypeOf = (thing) => typeof thing;
2
2
  const EMPTY_STRING = '';
3
3
  const STRING = getTypeOf(EMPTY_STRING);
4
4
 
5
- const isUndefined = (thing) => thing == void 0;
6
- const ifNotUndefined = (value, then, otherwise) =>
7
- isUndefined(value) ? otherwise?.() : then(value);
5
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
6
+ predicate(value) ? otherwise?.() : then(value);
7
+ const isUndefined = (thing) => thing === void 0;
8
+ const isNull = (thing) => thing === null;
9
+ const ifNotUndefined = getIfNotFunction(isUndefined);
8
10
  const isString = (thing) => getTypeOf(thing) == STRING;
9
11
  const isArray = (thing) => Array.isArray(thing);
10
12
  const size = (arrayOrString) => arrayOrString.length;
@@ -41,7 +43,7 @@ const mapGet = (map, key) => map?.get(key);
41
43
  const mapForEach = (map, cb) =>
42
44
  collForEach(map, (value, key) => cb(key, value));
43
45
  const mapSet = (map, key, value) =>
44
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
46
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
45
47
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
46
48
  if (!collHas(map, key)) {
47
49
  mapSet(map, key, getDefaultValue());
@@ -323,7 +325,7 @@ const getListenerFunctions = (getThing) => {
323
325
  const index = size(ids);
324
326
  if (index == size(path)) {
325
327
  listener(thing, ...ids, ...extraArgsGetter(ids));
326
- } else if (isUndefined(path[index])) {
328
+ } else if (isNull(path[index])) {
327
329
  arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
328
330
  callWithIds(...ids, id2),
329
331
  );
@@ -2,9 +2,11 @@ const getTypeOf = (thing) => typeof thing;
2
2
  const EMPTY_STRING = '';
3
3
  const STRING = getTypeOf(EMPTY_STRING);
4
4
 
5
- const isUndefined = (thing) => thing == void 0;
6
- const ifNotUndefined = (value, then, otherwise) =>
7
- isUndefined(value) ? otherwise?.() : then(value);
5
+ const getIfNotFunction = (predicate) => (value, then, otherwise) =>
6
+ predicate(value) ? otherwise?.() : then(value);
7
+ const isUndefined = (thing) => thing === void 0;
8
+ const isNull = (thing) => thing === null;
9
+ const ifNotUndefined = getIfNotFunction(isUndefined);
8
10
  const isString = (thing) => getTypeOf(thing) == STRING;
9
11
  const isArray = (thing) => Array.isArray(thing);
10
12
  const size = (arrayOrString) => arrayOrString.length;
@@ -41,7 +43,7 @@ const mapGet = (map, key) => map?.get(key);
41
43
  const mapForEach = (map, cb) =>
42
44
  collForEach(map, (value, key) => cb(key, value));
43
45
  const mapSet = (map, key, value) =>
44
- isUndefined(value) ? (collDel(map, key), map) : map?.set(key, value);
46
+ value === void 0 ? (collDel(map, key), map) : map?.set(key, value);
45
47
  const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
46
48
  if (!collHas(map, key)) {
47
49
  mapSet(map, key, getDefaultValue());
@@ -323,7 +325,7 @@ const getListenerFunctions = (getThing) => {
323
325
  const index = size(ids);
324
326
  if (index == size(path)) {
325
327
  listener(thing, ...ids, ...extraArgsGetter(ids));
326
- } else if (isUndefined(path[index])) {
328
+ } else if (isNull(path[index])) {
327
329
  arrayForEach(pathGetters[index]?.(...ids) ?? [], (id2) =>
328
330
  callWithIds(...ids, id2),
329
331
  );