<commit_before>var Glue=function(a){this.boundObject=a;this.listeners={};this.listenersCalcOrFunc={};this.anyKeyPath="*";this.keyPathIsCalculated=function(a){return!!a.match(/\(.+\)$/)};this.keyPathIsFunctional=function(a){return!!a.match(/.+\(\)$/)};this.keyPathIsFunctionalOrCalculated=function(a){return!!a.match(/\(?.+?\(?\)/)}};Glue.version="0.3.0";
Glue.prototype.get=function(a){var b=this,c=function(a,f){var d;d=_.first(a);b.keyPathIsFunctional(d)?(d=d.replace(/\(\)/,""),d=a.length===1?f[d].apply(b.boundObject):c(_.rest(a),f[d].apply(b.boundObject))):(b.keyPathIsCalculated(d)&&(d=d.replace(/\(/,"").replace(/\)/,"")),d=a.length===1?f[d]:c(_.rest(a),f[d]));return d};return c(a.split("."),this.boundObject)};
Glue.prototype.set=function(a,b){var c=this.get(a),e=function(a,c){a.length===1?c[_.first(a)]=b:c[_.first(a)]=e(_.rest(a),c[_.first(a)]);return c};_.extend(this.boundObject,e(a.split("."),this.boundObject));this.notify(a,{oldValue:c,value:b});return this};Glue.prototype.getBoundObject=function(){return _.clone(this.boundObject)};Glue.prototype.bindTo=function(a){this.notify("boundObject",{oldValue:this.boundObject,value:this.boundObject=a});return this};
Glue.prototype.addListener=function(){var a,b,c=arguments[0];switch(arguments.length){case 1:a=arguments[0];break;case 2:_.isFunction(arguments[0])?(b=arguments[1],a=arguments[0]):a=arguments[1];break;default:b=arguments[1],a=arguments[2]}b=b||this.anyKeyPath;c={target:c,hollaback:a};this.keyPathIsFunctionalOrCalculated(b)?(a="listenersCalcOrFunc",c.oldValue=this.get(b)):a="listeners";this[a][b]=this[a][b]||[];this[a][b].push(c);return this};
Glue.prototype.removeListener=function(){var a,b,c=this,e=function(a,b,c){_.each(a,function(e,g){a[g]=_.reject(e,function(a){return a.target===b&&!_.isUndefined(c)&&c===g})});return a};arguments.length===0?(this.listeners={},this.listenersCalcOrFunc={}):arguments.length===1&&!_.isUndefined(arguments[0].keyPath)?(delete this.listeners[a],delete this.listenersCalcOrFunc[a]):(b=arguments[0],a=arguments[1],_.each(["listeners","listenersCalcOrFunc"],function(f){c.listeners=e(c[f],b,a)}));return this};
Glue.prototype.notify=function(a,b){var c=this;_.each(this.listeners[a],function(a){a.hollaback.call(a.target,b)});_.each(this.listeners[this.anyKeyPath],function(a){a.hollaback.call(a.target,b)});_.each(this.listenersCalcOrFunc,function(a,b){var d=c.get(b);_.each(a,function(a){if(!_.isEqual(d,a.oldValue))a.hollaback.call(a.target,{oldValue:a.oldValue,value:d}),a.oldValue=d})});return this};
Glue.prototype.add=function(a,b){var c=this.get(a);c.push(b);this.notify.call(this,a,{keyPath:a,collectionOperation:"add",value:b,collection:c,currentCount:this.count(a)});return this};Glue.prototype.replaceWith=function(a,b,c){var e=this.get(a),b=e.splice.call(e,c,1,b);this.notify.call(this,a,{keyPath:a,collectionOperation:"replace",value:b,collection:e,currentCount:this.count(a)});return this};
Glue.prototype.removeAt=function(a,b){var c=this.get(a),e=c.splice.call(c,b,1);this.notify.call(this,a,{keyPath:a,collectionOperation:"remove",value:e,collection:c,currentCount:this.count(a)});return this};Glue.prototype.insertAt=function(a,b,c){Array.prototype.splice.call(arguments);var e=this.get(a);e.splice.call(e,b,0,c);this.notify.call(this,a,{keyPath:a,collectionOperation:"add",value:c,collection:e,currentCount:this.count(a)});return this};Glue.prototype.objectAt=function(a,b){return this.get(a)[b]};
Glue.prototype.count=function(a){return this.get(a).length};<commit_msg>Recompile glue.js javascript<commit_after>var Glue=function(b){this.target=b;this.resetListeners=function(){this.listeners={any:[],assigned:{},computed:{},oldValues:{}}};this.resetListeners();this.get=function(){key=_.map(Array.prototype.slice.call(arguments),function(b){return b.replace(/\#/,".")}).join(".").replace(/\s/g,"");key=_.isArray(this.target)?0<key.length?"this.target"+key:"this.target":0<key.length?"this.target."+key:"this.target";return eval(key)};this.notify=function(b,e){function f(b){_.isEmpty(b)||(_.each(c.listeners.any,
function(b){b.func.call(b.target,e)}),_.each(c.listeners.computed,function(b,h){var f=c.get(h),d=c.listeners.oldValues[h];if(f!==d)c.listeners.oldValues[h]=f,e.oldValue=d,e.newValue=f,_.each(b,function(b){b.func.call(b.target,e)})}),_.each(c.listeners.assigned[b.join(".")],function(b){b.func.call(b.target,e)}),b.pop(),f(b))}var c=this;_.isEqual(e.oldValue,e.newValue)||_.each(b.replace(/\s/g,"").split(","),function(b){f(b.split("."))});return this}};Glue.version="0.4.0";
Glue.normalizeKey=function(b){return b.replace(/\#/g,".").replace(/\s/g,"")};Glue.prototype.bindTo=function(b,d){var e=this.target;this.notify("target",{operation:"target",oldValue:e,newValue:this.target=b});d&&d(e,this.target);return this};
Glue.prototype.addListener=function(){function b(b,c,h){_.each(b.split(","),function(b){"*"===b?e.listeners.any.push({target:h,func:c}):b.match(/\#/)?(b=Glue.normalizeKey(b).replace(/\]/g,""),e.listeners.oldValues[b]=e.get(b),d("computed",b,c,h)):(b=Glue.normalizeKey(b),d("assigned",b,c,h))})}function d(b,c,h,d){e.listeners[b][c]=e.listeners[b][c]||[];e.listeners[b][c].push({target:d,func:h})}var e=this;a=arguments;1===a.length?b("*",a[0],e.target):2===a.length?_.isString(a[0])?b(a[0],a[1],e.target):
b("*",a[1],a[0]):b(a[0],a[2],a[1]);return this};
Glue.prototype.removeListener=function(){function b(b,c){b?_.each(b.replace(/\s/g,"").split(","),function(b){d(b,c)}):d(b,c)}function d(b,c){"*"===b||void 0===b?c?(f.listeners.any=_.reject(f.listeners.any,function(b){return b.target===c}),_.each(f.listeners.computed,function(b,d){e("computed",d,c);_.isEmpty(f.listeners.computed[d])&&delete f.listeners.oldValues[d]}),_.each(f.listeners.assigned,function(b,d){e("assigned",d,c)})):f.resetListeners():c?b.match(/\#/)?(b=b.replace(/\#/g,"."),e("computed",
b,c)):e("assigned",b,c):b.match(/\#/)?delete f.listeners.computed[b.replace(/\#/g,".")]:delete f.listeners.assigned[b]}function e(b,c,d){f.listeners[b][c]=_.reject(f.listeners[b][c],function(b){return b.target===d})}var f=this,c=arguments;0===c.length?b("*"):1===c.length?_.isString(c[0])?b(c[0]):b(void 0,c[0]):2===c.length&&b(c[0],c[1]);return this};
Glue.prototype.set=function(b,d,e){var f=this;_.each(b.split(","),function(b){var e=b.lastIndexOf("."),g=b.lastIndexOf("["),g=g>e?g:e,e=Glue.normalizeKey(b.substring(g+1).replace(/\]/g,"")),g=f.get(b.substring(0,g));f.notify(b,{operation:"set",oldValue:g[e],newValue:g[e]=d})});e&&e(d);return this};
Glue.prototype.remove=function(b,d){var e=this.get(b),f=b.match(/\[(\d+)\]$/);if(f){var c=f[1],f=b.lastIndexOf(f[0]);0===f?this.target.splice(c,1):this.get(b.substr(0,f)).splice(c,1)}else b=b.split("."),1<b.length?(c=b.pop(),delete this.get(b.join("."))[c]):delete this.target[b[0]],b=b.join(".");this.notify(b,{operation:"remove",oldValue:e});d&&d(e);return this};
Glue.prototype.push=function(){function b(b,c){_.each(b.split(","),function(b){b=Glue.normalizeKey(b);d(b,e.get(b),c)})}function d(b,c,d,g){c.push(d);e.notify(b,{operation:"push",newValue:d});g&&g(d)}var e=this;a=arguments;1===a.length?d("target",this.target,a[0]):2===a.length&&_.isFunction(a[1])?d("target",this.target,a[0],a[1]):3===a.length?b(a[0],a[1],a[2]):b(a[0],a[1]);return this};
Glue.prototype.pop=function(){var b=arguments,d,e;0===b.length?d=this.target.pop():1===b.length?_.isString(b[0])?d=this.get(b[0]).pop():(d=this.target.pop(),e=b[0]):(d=this.get(b[0]).pop(),e=b[1]);this.notify(key,{operation:"pop",oldValue:d});e&&e(d);return d};
Glue.prototype.reject=function(){function b(b,c){c?(_.each(d.get(c),function(d,e){b(d)&&f.push([c+"["+e+"]",e,d])}),_.each(_.map(f,function(b){return b[1]}).reverse(),function(b){d.get(c).splice(b,1)}),f.push([c,"*",d.get(c)])):(_.each(d.target,function(c,d){b(c)&&f.push(["["+d+"]",d,c])}),d.target=_.reject(d.target,b));_.each(f,function(b){d.notify(b[0],{operation:"remove",oldValue:b[2]})})}var d=this,e,f=[],c=arguments;1===c.length?b(c[0]):2===c.length?_.isString(c[0])?b(c[1],c[0]):(b(c[0]),e=c[1]):
(b(c[1],c[0]),e=c[2]);c=key?this.get(key):this.target;e&&e(c);return c};
{'fraction_non_alphanumeric': 0.29809358752166376, 'fraction_numerical': 0.01163654369893538, 'mean_word_length': 13.878453038674033, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5764522', 'n_tokens_mistral': 3464, 'n_tokens_neox': 3441, 'n_words': 101}