src/static/js/modules/object.observe-polyfill.js
Function Notifier
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Notifier = function(watching){
var _listeners = [], _acceptLists = [], _updates = [], _updater = false, properties = [], values = [];
var self = this;
Object.defineProperty(self, '_watching', {
enumerable: true,
Consider simplifying this complex logical expression. Open
Open
if(supportsAccessors && !Object.observe){
(function(extend, global){
var isCallable = (function(toString){
var s = toString.call(toString),
u = typeof u;
File object.observe-polyfill.js
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var supportsAccessors = require('./supports-accessors');
// The polyfill below is from https://github.com/jdarling/Object.observe
/*
Function _checkPropertyListing
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self._checkPropertyListing = function(dontQueueUpdates){
var object = self._watching, keys = Object.keys(object), i=0, l=keys.length;
var newKeys = [], oldKeys = properties.slice(0), updates = [];
var prop, queueUpdates = !dontQueueUpdates, propType, value, idx, aLength;
Function Observer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Observer = (function(){
var wraped = [];
var Observer = function(O, callback, accept){
validateArguments(O, callback, accept);
if (!accept) {
Function wrapProperty
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var wrapProperty = function(object, prop){
var propType = typeof(object[prop]), descriptor = Object.getOwnPropertyDescriptor(object, prop);
if((prop==='getNotifier')||isAccessorDescriptor(descriptor)||(!descriptor.enumerable)){
return false;
}
Function deliverChangeRecords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self.deliverChangeRecords = function(){
var i = 0, l = _listeners.length,
//keepRunning = true, removed as it seems the actual implementation doesn't do this
// In response to BUG #5
retval;
Avoid deeply nested control flow statements. Open
Open
if(values[idx] !== value){
if(queueUpdates){
self.queueUpdate(object, prop, 'update', values[idx], value);
}
values[idx] = value;
Avoid deeply nested control flow statements. Open
Open
for (var j = 0, updatesLength = _updates.length; j < updatesLength; j++) {
if (_acceptLists[i].indexOf(_updates[j].type) !== -1) {
currentUpdates.push(_updates[j]);
}
}
Avoid deeply nested control flow statements. Open
Open
if(_listeners[i]===console.log){
console.log(currentUpdates);
}else{
_listeners[i](currentUpdates);
}