Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deep-computed

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-computed

Iterates over objects and arrays and transforms functions to computed properties

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1K
decreased by-10.05%
Maintainers
1
Weekly downloads
 
Created
Source

deep-computed

Iterates over plain objects and arrays and transforms functions to computed properties

Use

If an object or array has a function as a value, it will be wrapped by Object.defineProperty and its getter will pass the root object to it as an argument to resolve the value of the function. For example,

import { deepComputed, Computed } from "./deepComputed";

type MyType = {
  cool: number;
  dude: number;
  deep: {
    ly: {
      nested: {
        coolAndDude: number;
      };
    };
  };
};

const obj: Computed<MyType> = {
  cool: 123,
  dude: 456,
  deep: {
    ly: {
      nested: {
        coolAndDude: ({ cool, dude }) => cool + dude
      }
    }
  }
};

const next = deepComputed(obj);

console.log(next.deep.ly.nested.coolAndDude);
// => 579

Install

yarn install deep-computed

FAQs

Package last updated on 29 May 2019

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