Socket
Socket
Sign inDemoInstall

remove-use-strict

Package Overview
Dependencies
13
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remove-use-strict

remove unnecessary 'use strict';


Version published
Weekly downloads
757
increased by24.1%
Maintainers
1
Install size
3.08 MB
Created
Weekly downloads
 

Readme

Source

remove-use-strict Build Status

This node module remove unnecessary "use strict"; literal.

Unnecessary "use strict"; ?

A Use Strict Directive is an ExpressionStatement in a Directive Prologue whose StringLiteral is either the exact character sequences "use strict" or 'use strict'. A Use Strict Directive may not contain an EscapeSequence or LineContinuation.

A Directive Prologue is the longest sequence of ExpressionStatement productions occurring as the initial SourceElement productions of a Program or FunctionBody and where each ExpressionStatement in the sequence consists entirely of a StringLiteral token followed a semicolon. The semicolon may appear explicitly or may be inserted by automatic semicolon insertion. A Directive Prologue may be an empty sequence.

via ECMAScript Language Specification - ECMA-262 Edition 5.1

and "use strict" - blog.niw.at

This module remove "use strict"; which isn't delective prologue.

(also has force option)

Installation

npm install remove-use-strict

Task

Usage

var removeUst = require("../lib/remove-use-strict");
var code = 'var a = 1;\n' +
    '"use strict";\n"use strict";';// unnecessary use strict...
removeUst(code); // => 'var a = 1;'

force option : true

var code = '"use strict";\n' +
    'function a(){ "use strict"; \n var a = "use strict"; }';
removeUst(code, {
    force : true
}) // => 'function a(){  var a = "use strict"; }'

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

FAQs

Last updated on 24 Aug 2019

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