New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

graph-reducer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graph-reducer

Something like lodash.merge() (a recursive version of Object.assign()) that specially designed for graph-stater

latest
Source
npmnpm
Version
0.2.0-beta.2
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

Graph-Reducer

Something like lodash.merge() (a recursive version of Object.assign()) that specially designed for graph-stater.

It additionally supports functions (in payload(s) argument(s)) to make it possible to transform properties based on their previous states/values.

It also deeply compares the source state (source object) with the primary result (newState), during its original process and returns an additional value (noTransform) that shows the result of this comparison.

npm (scoped) install size npm
Dependencies Status devDependencies Status
GitHub GitHub forks GitHub stars

Installation

npm i graph-reducer

or using yarn:

yarn add graph-reducer

Usage

import graphReducer from 'graph-reducer'

const srcState = {
    a: 'a',
    n: 10,
    v: {c: 'c'}
}

const payload = {
    a: 'A',
    v: {c: 'C'},
    n: n => n * 2,
}

const {newState} = graphReducer(srcState, payload)

assert.deepStrictEqual(newState, {  // import assert from 'assert' // https://nodejs.org/api/assert.html
    a: 'A',
    n: 20,
    v: {c: 'C'}
})

License

MIT © Mir-Ismaili

Keywords

javascript

FAQs

Package last updated on 12 Jan 2021

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