- Notifications
You must be signed in to change notification settings - Fork1
License
normalized-db/denormalizer
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Warning
This project has been deprecated in favor of@normalized-db/ndb.
DenormalizeJavaScript objects from a normalized data structure based on a simple schema(implemented withTypeScript).
- Author: Sandro Schmid (saseb.schmid@gmail.com)
- Version: 2.5.0-beta.4
To ease versioning equal major and minor version numbers are used for all modules.
Install using NPM:
npm install --save @normalized-db/denormalizerUse theDenormalizerBuilder to create aDenormalizer. Use eitherschema(…) orschemaConfig(…) to apply aschema configuration. This is the only required parameter. IfnormalizedData does not contain an object which isneeded during denormalization then theDenormalizer will try to lazy load it usingfetchCallback. TheKeyMapis a helper with a mapping from primary keys to the index of the related object in the normalized data.
To actually denormalize an object or an array of objects use either…
applyAll(…): Promise<T[]>for objects of a given typeapplyAllKeys(…): Promise<T[]>for objects with keys of a given typeapply(…): Promise<T>for single objects of a given typeapplyKey(…): Promise<T>for single objects by a key of a given type
Thetype-argument defines the data-store in which the item should be contained. Using adepth you can definehow far the denormalization should be applied. A number means that all targets should be denormalized to the n-th level.null means that the field should be denormalized as far as possible. Note that circular dependencies currently willnot be detected. If you need different levels for various fields then use aDepth-object likee.g.{ foo: 3, bar: { x: 1, y: null }. This would denormalize up to 3 levels on obj.foo, 1 level on obj.bar.x andeverything on obj.bar.y.
See theexamples-project for detailed examples:
About
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.