GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - normalized-db/normalizer

This repository was archived by the owner on Jul 3, 2024. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
index.ts
index.ts
 
 
karma.conf.js
karma.conf.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tslint.json
tslint.json
 
 
webpack.config.js
webpack.config.js
 
 

Repository files navigation

@normalized-db/normalizer

Warning

This project has been deprecated in favor of @normalized-db/ndb.

Normalize JavaScript objects based on a simple schema (implemented with TypeScript).

  • Author: Sandro Schmid ([email protected])
  • Version: 2.5.0-beta.4

Versioning

To ease versioning equal major and minor version numbers are used for all modules.

Installation

Install using NPM:

npm install --save @normalized-db/normalizer

Usage

Use the NormalizerBuilder to create a Normalizer. Use either schema(…) or schemaConfig(…) to apply a schema configuration. This is the only required parameter.

Due to references between objects the normalizer needs them to have keys, this is why you should define a UniqueKeyCallback which generates such keys. Note that these will also be used for persisting the normalized data by @normalized-db/data-store.

Using reverse references will generate a _refs-field on objects. E.g. normalizing an object like

const schema: ISchemaConfig = {
  _defaults: { key: 'id' },
  parentType: {
    targets: {
      foo: 'childType'
    }
  },
  childType: true
}

const parent: ParentType = { 
  id: 'parent',
  foo: { 
    id: 'child', 
    bar: 123
  }
}

would result in

const normalizedChild: ChildType = { 
  id: 'child', 
  bar: 123, 
  _refs: { 
    parentType: Set<string>(['parent'])
  }
}

Examples

A more detailed example for a ISchemaConfig and normalization input/output can be found in the core-module's README.

See the examples-project for detailed examples:

  • Angular4-App

About

No description or website provided.

Topics

denormalizerindexeddbjavascriptnormalizationnormalization-databasenormalizernosqlnosql-databaseobject-databasereverse-referencestypescript

Resources

Readme
MIT license
Activity
Custom properties

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.