Skip to content

Instantly share code, notes, and snippets.

@subzey
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subzey/cbce2557da78f4fe900e to your computer and use it in GitHub Desktop.
Save subzey/cbce2557da78f4fe900e to your computer and use it in GitHub Desktop.
DSON shim
var DSON = DSON || {
parse: function(v) {
return JSON.parse(v.replace(/"(\\"|[^"])*"|[a-z]+/gi, function(v) {
return {
such: '{',
wow: '}',
is: ':',
so: '[',
many: ']',
next: ',',
very: 'e',
notfalse: !0,
nottrue: [!1],
nullish: null
}[v.toLowerCase()] || v;
}));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment