/usr/share/javascript/json/cycle.min.js is in libjs-json 0~20121008-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /*
cycle.js
2012-08-19
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
*//*jslint evil: true, regexp: true *//*members $ref, apply, call, decycle, hasOwnProperty, length, prototype, push,
retrocycle, stringify, test, toString
*/typeof JSON.decycle!="function"&&(JSON.decycle=function(b){"use strict";var c=[],d=[];return function e(a,b){var f,g,h;switch(typeof a){case"object":if(a===null||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String)return a;for(f=0;f<c.length;f+=1)if(c[f]===a)return{$ref:d[f]};c.push(a),d.push(b);if(Object.prototype.toString.apply(a)==="[object Array]"){h=[];for(f=0;f<a.length;f+=1)h[f]=e(a[f],b+"["+f+"]")}else{h={};for(g in a)Object.prototype.hasOwnProperty.call(a,g)&&(h[g]=e(a[g],b+"["+JSON.stringify(g)+"]"))}return h;case"number":case"string":case"boolean":return a}}(b,"$")}),typeof JSON.retrocycle!="function"&&(JSON.retrocycle=function retrocycle($){"use strict";var px=/^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;return function rez(value){var i,item,name,path;if(value&&typeof value=="object")if(Object.prototype.toString.apply(value)==="[object Array]")for(i=0;i<value.length;i+=1)item=value[i],item&&typeof item=="object"&&(path=item.$ref,typeof path=="string"&&px.test(path)?value[i]=eval(path):rez(item));else for(name in value)typeof value[name]=="object"&&(item=value[name],item&&(path=item.$ref,typeof path=="string"&&px.test(path)?value[name]=eval(path):rez(item)))}($),$});
|