Socket
Socket
Sign inDemoInstall

acorn5-object-spread

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

acorn5-object-spread - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

CHANGELOG.md

16

inject.js

@@ -26,3 +26,3 @@ 'use strict';

prop = this.parseSpread()
prop.type = isPattern ? "RestProperty" : "SpreadProperty"
prop.type = isPattern ? "RestElement" : "SpreadElement"
node.properties.push(prop)

@@ -55,4 +55,18 @@ continue

const getCheckLVal = origCheckLVal => function (expr, bindingType, checkClashes) {
if (expr.type == "ObjectPattern") {
for (let prop of expr.properties)
this.checkLVal(prop, bindingType, checkClashes)
return
} else if (expr.type === "Property") {
return this.checkLVal(expr.value, bindingType, checkClashes)
} else if (expr.type === "RestProperty") {
return this.checkLVal(expr.argument, bindingType, checkClashes)
}
return origCheckLVal.apply(this, arguments)
}
acorn.plugins.objectSpread = function objectSpreadPlugin(instance) {
pp.parseObj = parseObj;
pp.checkLVal = getCheckLVal(pp.checkLVal)
};

@@ -59,0 +73,0 @@

9

package.json
{
"name": "acorn5-object-spread",
"description": "Support object spread in acorn 5",
"description": "Support for rest and spread properties in acorn 5",
"homepage": "https://github.com/adrianheine/acorn5-object-spread",
"author": "Darío Javier Cravero <dario@uxtemple.com>",
"contributors": [
"Darío Javier Cravero <dario@uxtemple.com>",
"Adrian Heine <mail@adrianheine.de>"
],
"repository": {

@@ -17,3 +20,3 @@ "type": "git",

},
"version": "2.0.1"
"version": "3.0.0"
}

@@ -1,2 +0,2 @@

# ObjectSpread support in acorn 5
# Spread and rest properties support in acorn 5

@@ -7,5 +7,7 @@ [![NPM version](https://img.shields.io/npm/v/acorn5-object-spread.svg)](https://www.npmjs.org/package/acorn5-object-spread)

It implements support for spread and rest properties as defined in the stage 3 proposal [Object Rest/Spread Properties for ECMAScript](https://github.com/tc39/proposal-object-rest-spread).
## Usage
You can use this module directly in order to get Acorn instance with plugin installed:
You can use this module directly in order to get an Acorn instance with the plugin installed:

@@ -16,3 +18,3 @@ ```javascript

Or you can use `inject.js` for injecting plugin into your own version of Acorn like this:
Or you can use `inject.js` for injecting the plugin into your own version of Acorn like this:

@@ -23,3 +25,3 @@ ```javascript

Then, use the `plugins` option whenever you need to support objectSpread while parsing:
Then, use the `plugins` option whenever you need to support object spread or rest while parsing:

@@ -26,0 +28,0 @@ ```javascript

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