Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix global leak of ret in JSONPath.normalize() #12

merged 1 commit into from

3 participants

jonathana Romain Subbu Allamaraju

Fix global leak of ret in JSONPath.normalize().

While writing mocha tests around some use of JSONPath, it found a global declaration of ret in normalize() versus var. There appears to be no reason why ret would be a global in this context, and in other versions of the codebase--on google code--the value is just returned raw because there's no caching in place anyway.

jonathana jonathana Update lib/jsonpath.js
Fix global leak of ret in jsonPath.normalize()

Like #11 +1

Subbu Allamaraju s3u merged commit d8a4b62 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 2, 2012
  1. jonathana

    Update lib/jsonpath.js

    jonathana authored
    Fix global leak of ret in jsonPath.normalize()
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/jsonpath.js
2  lib/jsonpath.js
@@ -20,7 +20,7 @@ function jsonPath(obj, expr, arg) {
var subx = [];
- ret = expr.replace(/[\['](\??\(.*?\))[\]']/g, function($0,$1){return "[#"+(subx.push($1)-1)+"]";})
+ var ret = expr.replace(/[\['](\??\(.*?\))[\]']/g, function($0,$1){return "[#"+(subx.push($1)-1)+"]";})
.replace(/'?\.'?|\['?/g, ";")
.replace(/;;;|;;/g, ";..;")
.replace(/;$|'?\]|'$/g, "")
Something went wrong with that request. Please try again.