A unified client-side database library for IndexedDB, WebSQL, and localStorage, currently at stable version 1.3.0. It provides a consistent asynchronous API across storage backends, supports schema version migration, advanced queries (including SQL-like and full-text search via additional modules), and transaction workflow management. Key differentiators include support for legacy browsers (IE6+, Chrome 4+, etc.), on-the-fly schema generation, managed requests to avoid InvalidStateError, and high-performance index queries using AVL trees for localStorage. Actively maintained until 2016, now in maintenance mode.
npm install ydn.dbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to open a database with schema, store and retrieve a record, and query using an index.
Use IndexedDB backend by ensuring browser supports IndexedDB; avoid relying on WebSQL.
Pass schema as second argument: new ydn.db.Storage('name', schema).Define compound index, e.g., ['age', 'name'] if ordering by 'name' after filtering by 'age'.
Add 'keyPath' property to index objects in schema.
Use .done() for success, .fail() for error, not .then() .catch().
Ensure ydn.db.min.js is included before usage: <script src='ydn.db.min.js'></script>
Use managed requests: db.run() to wrap operations in transaction, or ensure db is open.
Add 'version' to schema: { version: 1, stores: [...] }No dependency data recorded yet.