Skip to content

Commit 5703a5b

Browse files
tmpvarlloyd
authored andcommitted
you may now require jsonselect from node
1 parent e6e6a06 commit 5703a5b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*~
22
\#*\#
3+
.DS_Store

src/jsonselect.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
/*
33
* This is the JSONSelect reference implementation, in javascript.
44
*/
5-
(function() {
6-
var w = window;
7-
var jp = (w.JSON ? w.JSON.parse : w.eval);
5+
;(function(exports) {
6+
var jp = (typeof JSON !== 'undefined' ? JSON.parse : eval);
87
function jsonParse(s) { try { return jp(s); } catch(e) { te("ijs"); }; }
98

109
// emitted error codes. Strip this table for an, uh, "optimized build"
@@ -227,7 +226,7 @@
227226
};
228227
}
229228

230-
w.JSONSelect = {
229+
exports.JSONSelect = {
231230
// expose private API for testing
232231
_lex: lex,
233232
_parse: parse,
@@ -236,4 +235,4 @@
236235
forEach: function(sel, obj, fun) { return compile(sel).forEach(obj, fun) },
237236
compile: compile
238237
};
239-
})();
238+
})((typeof exports === "undefined") ? window : exports);

0 commit comments

Comments
 (0)