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

get-function-params

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

get-function-params - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

src/encodeStrings.js

6

index.js
var patterns = require('./src/patterns')
var encodeStrings = require('./src/encodeStrings')
var encode = require('./src/encode')

@@ -8,3 +9,6 @@ var decode = require('./src/decode')

var params = encode(cache, fn.toString().replace(/\/\*.*?\*\//g, ''), patterns.prePatterns)
var fnString = fn.toString().replace(/\/\*.*?\*\//g, '')
fnString = encodeStrings(cache, fnString)
var params = encode(cache, fnString, patterns.prePatterns)
.match(/(?:function\s*\((.*)\)|\((.*)\))/)

@@ -11,0 +15,0 @@

2

package.json
{
"name": "get-function-params",
"version": "2.0.2",
"version": "2.0.3",
"description": "Get list of function params, including default values (if any)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,20 +0,4 @@

var stringPatterns = require('./patterns').stringPatterns
var delim = require('./delim')
var encodeStrings = function (cache, string) {
while (true) {
var shortestString = stringPatterns
.reduce(function (arr, pattern) {
return arr.concat(string.match(pattern) || [])
}, [])
.sort(function (a, b) { return a.length - b.length })
[0]
if (!shortestString) return string
string = string.replace(shortestString, delim(cache.push(shortestString)))
}
}
module.exports = function (cache, string, patterns) {
string = encodeStrings(cache, string)
patterns.forEach(function (pattern) {

@@ -21,0 +5,0 @@ while (pattern.test(string)) {

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