Socket
Socket
Sign inDemoInstall

esformatter-dot-notation

Package Overview
Dependencies
4
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    esformatter-dot-notation

esformatter plugin for transforming object bracket usage to dot notation


Version published
Weekly downloads
375
increased by32.51%
Maintainers
1
Install size
659 kB
Created
Weekly downloads
 

Readme

Source

esformatter-dot-notation

esformatter plugin for transforming object bracket usage to dot notation

NPM Version NPM Downloads Build Status

esformatter-dot-notation is a plugin for esformatter meant to convert accessing object properties with brackets into dot notation where valid.

This module uses unquoted-property-validator which uses Mathias Bynens implementation in order to validate if a property name is a valid identifier name and can be used with dot notation.

That means invalid identifiers will not be converted and your code is safe for transformations (see tests).

Turn this:

someObject['property'] = true;

into:

someObject.property = true;

Installation

$ npm install esformatter-dot-notation --save-dev

Config

Newest esformatter versions autoload plugins from your node_modules See this

Add to your esformatter config file:

{
  "plugins": [
    "esformatter-dot-notation"
  ]
}

Or you can manually register your plugin:

var dotNotation = require('esformatter-dot-notation');
// register plugin
esformatter.register(dotNotation);

Usage

var fs = require('fs');
var esformatter = require('esformatter');
//register plugin manually
esformatter.register(require('esformatter-dot-notation'));

var str = fs.readFileSync('someKewlFile.js').toString();
var output = esformatter.format(str);
//-> output will now contain the formatted string

See esformatter for more options and further usage.

License

MIT @Gilad Peleg

Keywords

FAQs

Last updated on 28 May 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc