Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

babel-plugin-flow-onlyupdateforkeys

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

babel-plugin-flow-onlyupdateforkeys

A babel plugin to generate args of recompose.onlyUpdateForKeys from flow type.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

babel-plugin-flow-onlyupdateforkeys

A babel plugin to generate args of recompose.onlyUpdateForKeys from flow type. It is intended to be an alternative to recompose.onlyUpdateForPropTypes for flow type.

Example

In

// @flow
import React from 'react';
import { compose, onlyUpdateForKeys } from 'recompose';

export default compose(
  onlyUpdateForKeys(), // without args
)(function Foo(props: { foo: string, bar: number }) {
  const { foo, bar } = props;

  return (
    <div>{foo}-{bar}</div>
  );
});

Out

// @flow
import React from 'react';
import { compose, onlyUpdateForKeys } from 'recompose';

export default compose(
  onlyUpdateForKeys(['foo', 'bar']), // with args
)(function Foo(props: { foo: string, bar: number }) {
  const { foo, bar } = props;

  return (
    <div>{foo}-{bar}</div>
  );
});

Installation

$ npm install --save-dev babel-plugin-flow-onlyupdateforkeys

Usage

.babelrc

{
  "plugins": ["flow-onlyupdateforkeys"]
}

Via CLI

$ babel --plugins flow-onlyupdateforkeys script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["flow-onlyupdateforkeys"]
});

Using with flow-runtime

Note that when using this plugin with flow-runtime, you must ensure that babel-plugin-flow-onlyupdateforkeys is included before babel-plugin-flow-runtime.

.babelrc

{
  "plugins": [
    "flow-onlyupdateforkeys",
    "flow-runtime"
  ]
}

Keywords

babel

FAQs

Package last updated on 24 Jul 2017

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