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

babel-plugin-object-to-json-parse

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-object-to-json-parse

[![CircleCI](https://circleci.com/gh/nd-02110114/babel-plugin-object-to-json-parse/tree/master.svg?style=svg)](https://circleci.com/gh/nd-02110114/3dmol-sandbox/tree/master) [![License: MIT](https://img.shields.io/github/license/nd-02110114/babel-plugin-o

0.0.7
npm
Version published
Weekly downloads
1.3K
1.51%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-object-to-json-parse 🚀

CircleCI License: MIT npm version

This repository is inspired by this article

As long as the JSON string is only evaluated once, the JSON.parse approach is much faster compared to the JavaScript object literal, especially for cold loads.

Object to JSON.parse

This plugin converts from object literal to JSON.parse (example)

// before
const data = { foo: 42, bar: 1337 };

// after
const data = JSON.parse('{"foo":42,"bar":1337}');

How to use

Install

$ npm install babel-plugin-object-to-json-parse -D
or
$ yarn babel-plugin-object-to-json-parse -D

setup .babelrc

{
  "plugins": ["object-to-json-parse"]
}

Development

Setup

$ git clone git@github.com:nd-02110114/babel-plugin-object-to-json-parse.git
$ cd babel-plugin-object-to-json-parse
$ yarn install

Tips

// example
$ yarn build && yarn example

// test
$ yarn test

FAQs

Package last updated on 21 Jul 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