Shelving: toolkit for using data in JavaScript
Shelving is a toolkit for using data in JavaScript and TypeScript, including:
- Schemas (validation)
- Databases (via providers including in-memory, Firestore, IndexedDB)
- Querying (sorting, filtering, slicing)
- State (events and state)
- React (hooks and state)
- Helpers (errors, arrays, objects, strings, dates, equality, merging, diffing, cloning, debug)
Installation
Install via npm
or yarn
:
npm install shelving
yarn add shelving
Import from Skypack CDN (the ?dts
enables TypeScript types in Deno):
import { createDatabase } from "https://cdn.skypack.dev/shelving";
import { createDatabase } from "https://cdn.skypack.dev/shelving?dts";
Usage
Shelving is an ES module supporting import { createQuery } from "shelving";
syntax and can be used natively in systems/browsers that support that (e.g. Chrome 61+, Deno, Node 12+).
Shelving does not include code for CommonJS require()
imports, so using it in older projects will require transpiling.
Modules
Shelving is created from small individual modules which can be imported individually (using e.g. import { addProp } from "shelving/object
). Modules marked with ✅
are also re-exported from the main "shelving"
module.
@todo Write these docs!
Data storage
shelving/schema
✅ — Validate unknown user input against schemasshelving/db
✅shelving/query
✅
Data storage providers
shelving/memory
✅ — Fast in-memory database providershelving/firestore-client
— Provider for Firestore in client apps (using firebase
)shelving/firestore-server
— Provider for Firestore on servers (using firebase-admin
)
State management
shelving/event
✅shelving/state
✅
Data type helpers
shelving/null
✅shelving/undefined
✅shelving/boolean
✅shelving/string
✅shelving/number
✅shelving/array
✅shelving/constructor
✅shelving/data
✅shelving/date
✅shelving/entry
✅shelving/function
✅shelving/object
✅shelving/url
✅
Data manipulation helpers
shelving/equal
✅shelving/clone
✅shelving/merge
✅shelving/diff
✅shelving/filter
✅shelving/sort
✅
Error helpers
shelving/dispatch
✅shelving/assert
✅shelving/console
✅shelving/debug
✅shelving/feedback
✅
Other helpers
shelving/fingerprint
✅shelving/template
✅ — Simple string template rendering and matchingshelving/lazy
✅shelving/random
✅shelving/units
✅
Testing
shelving/test
— Internal reusable testing tools
Changelog
See Releases