Reactive-Extensions/RxJS

View on GitHub
src/core/internal/polyfills.js

Summary

Maintainability
F
2 wks
Test Coverage

Showing 17 of 17 total issues

File polyfills.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Utilities
var toString = Object.prototype.toString;
var arrayClass = '[object Array]',
funcClass = '[object Function]',
stringClass = '[object String]';
Severity: Minor
Found in src/core/internal/polyfills.js - About 2 hrs to fix

    Function indexOf has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    Array.prototype.indexOf = function indexOf(searchElement) {
    var t = Object(this);
    var len = t.length >>> 0;
    if (len === 0) {
    return -1;
    Severity: Minor
    Found in src/core/internal/polyfills.js - About 2 hrs to fix

    Function event has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    target.attachEvent('on' + type, typeListeners.event = function (e) {
    e || (e = root.event);
     
    var documentElement = target.document &&
    target.document.documentElement ||
    Severity: Major
    Found in src/core/internal/polyfills.js - About 2 hrs to fix

      Function forEach has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      Array.prototype.forEach = function (callback, thisArg) {
      var T, k;
       
      if (this == null) {
      throw new TypeError(' this is null or not defined');
      Severity: Minor
      Found in src/core/internal/polyfills.js - About 1 hr to fix

      Function every has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      Array.prototype.every = function every(fun /*, thisp */) {
      var object = Object(this),
      self = splitString && toString.call(this) === stringClass ?
      this.split('') :
      object,
      Severity: Minor
      Found in src/core/internal/polyfills.js - About 1 hr to fix

      Function map has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      Array.prototype.map = function map(fun /*, thisp*/) {
      var object = Object(this),
      self = splitString && toString.call(this) === stringClass ?
      this.split('') :
      object,
      Severity: Minor
      Found in src/core/internal/polyfills.js - About 55 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      root.Element && root.Element.prototype.attachEvent && !root.Element.prototype.addEventListener && (function () {
      function addMethod(name, fn) {
      Window.prototype[name] = HTMLDocument.prototype[name] = Element.prototype[name] = fn;
      }
       
       
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 wk to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 379..497

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.prototype.indexOf) {
      Array.prototype.indexOf = function indexOf(searchElement) {
      var t = Object(this);
      var len = t.length >>> 0;
      if (len === 0) {
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 278..305

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      (!root.CustomEvent || typeof root.CustomEvent === 'object') && (function() {
      function CustomEvent (type, params) {
      var event;
      params = params || { bubbles: false, cancelable: false, detail: undefined };
       
       
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 499..522

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Object.keys) {
      Object.keys = (function() {
      'use strict';
      var hasOwnProperty = Object.prototype.hasOwnProperty,
      hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString');
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 315..344

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.prototype.map) {
      Array.prototype.map = function map(fun /*, thisp*/) {
      var object = Object(this),
      self = splitString && toString.call(this) === stringClass ?
      this.split('') :
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 236..257

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      if (typeof Object.create !== 'function') {
      // Production steps of ECMA-262, Edition 5, 15.2.3.5
      // Reference: http://es5.github.io/#x15.2.3.5
      Object.create = (function() {
      function Temp() {}
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 346..377

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.prototype.every) {
      Array.prototype.every = function every(fun /*, thisp */) {
      var object = Object(this),
      self = splitString && toString.call(this) === stringClass ?
      this.split('') :
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 214..234

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.prototype.forEach) {
      Array.prototype.forEach = function (callback, thisArg) {
      var T, k;
       
      if (this == null) {
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 day to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 181..210

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.prototype.filter) {
      Array.prototype.filter = function (predicate) {
      var results = [], item, t = new Object(this);
      for (var i = 0, len = t.length >>> 0; i < len; i++) {
      item = t[i];
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 5 hrs to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 259..270

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Object.prototype.propertyIsEnumerable) {
      Object.prototype.propertyIsEnumerable = function (key) {
      for (var k in this) { if (k === key) { return true; } }
      return false;
      };
      Severity: Major
      Found in src/core/internal/polyfills.js and 1 other location - About 1 hr to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 308..313

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if (!Array.isArray) {
      Array.isArray = function (arg) {
      return toString.call(arg) === arrayClass;
      };
      }
      Severity: Minor
      Found in src/core/internal/polyfills.js and 1 other location - About 30 mins to fix
      modules/rx-lite-compat/rx.lite.compat.js on lines 272..276
      Category
      Status