get-function-params
Advanced tools
Comparing version 2.0.2 to 2.0.3
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 @@ |
{ | ||
"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)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3549
9
66