New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

normalized-data-structure

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalized-data-structure

Utilities for working with simple "Normalized" structure with immutablity. Designed for Redux

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Normalized Data Structure

A very simple library to make it easier to work with Redux Normalizing State Shape, in an immutable way.

Written in typescript.

Structure

byId: Simple "dictionary", where the object key is the items unique identifier allIds: Array of all unique identifiers

Usage

  • empty<T>: create a new normalized data structure of type T. Ex: { byId: {}, allIds: [] }
  • forEach: loop through each item
  • map: map items returning a new Array
  • filter: filter items, returning a new Array
  • set: add an item by key, over-writing any previous item
  • addItems: add a array of items to the structure. Takes either a keyof T or a selector function that returns a string to specify the structure key.
  • removeItem: Remove item by key
  • fromArray: creates a new "normalized" object from an array. Takes either a keyof T or a selector function that returns a string to specify the structure key.
  • toArray: get all items as an array

Keywords

FAQs

Package last updated on 13 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc