Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle global correctly in Ringo

  • Loading branch information...
commit 11d8ffd2b55fa25c51760366d9a83c57a66e2b8f 1 parent e00a687
@kriszyp authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  json-ext.js
View
3  json-ext.js
@@ -106,13 +106,12 @@ replace(/(?:^|:|,|&&)(?:\s*\[)+/g, ''))) {
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
-
var nativeConstructors = {"String":String, "Object":Object, "Number":Number, "Boolean":Boolean, "Array":Array, "Date":Date};
exports.stringify = ({}).toSource ?
// we will use toSource if it is available
(function(){
Object.keys(nativeConstructors).forEach(function(name){
- global[name].toSource = function(){
+ (global[name] || global()[name]).toSource = function(){ // you have to call global() in Rhino. Why?!?
return name;
};
});

0 comments on commit 11d8ffd

Please sign in to comment.
Something went wrong with that request. Please try again.