Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accessory

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accessory - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

20

index.js
'use strict'
var split = require('dot-parts')
var balanced = require('balanced-match')
var ap = require('ap')
var findCall = ap.partial(balanced, '(', ')')

@@ -10,3 +13,18 @@ module.exports = function createAccessor (source, path) {

function accumulate (statement, property) {
return statement + "['" + property + "']"
var callString = ''
function append (body) {
callString += '(' + body + ')'
}
var call = findCall(property)
if (call) {
property = call.pre
append(call.body)
var post = call.post
}
while (post) {
call = findCall(post)
append(call.body)
post = call.post
}
return statement + "['" + property + "']" + callString
}

6

package.json
{
"name": "accessory",
"main": "index.js",
"version": "1.0.1",
"description": "Create property accessor statements for dot paths",
"version": "1.1.0",
"description": "Create property accessor/caller statements for dot paths",
"license": "MIT",

@@ -32,4 +32,6 @@ "repository": "bendrucker/accessory",

"dependencies": {
"ap": "~0.2.0",
"balanced-match": "~0.2.0",
"dot-parts": "~1.0.0"
}
}
# accessory [![Build Status](https://travis-ci.org/bendrucker/accessory.svg?branch=master)](https://travis-ci.org/bendrucker/accessory)
> Create property accessor statements for dot paths
> Create property accessor/caller statements for dot paths

@@ -23,2 +23,5 @@

//=> window['foo.bar']
accessory('window', 'foo.bar(baz)')
//=> window['foo']['bar'](baz)
```

@@ -42,3 +45,3 @@

A dot property path.
A dot property path, including function calls.

@@ -45,0 +48,0 @@

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