Test Setup Failed
Push — master ( 11cd9d...8453e3 )
by
unknown
03:59
created

polyfill.js ➔ define   B

Complexity

Conditions 2
Paths 30

Size

Total Lines 46

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
c 0
b 0
f 0
nc 30
dl 0
loc 46
rs 8.9411
nop 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A polyfill.js ➔ ... ➔ ??? 0 3 1
B polyfill.js ➔ ... ➔ Function.bind 0 25 3
1
define(function() {
2
    'use strict';
3
4
    Math.log10 = Math.log10 || function(x) {
0 ignored issues
show
Compatibility Best Practice introduced by
You are extending the built-in type Math. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
Loading history...
5
        return Math.log(x) / Math.LN10;
6
    };
7
8
    Math.sign = Math.sign || function(x) {
0 ignored issues
show
Compatibility Best Practice introduced by
You are extending the built-in type Math. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
Loading history...
9
        x = +x; // convert to a number
10
        if (x === 0 || isNaN(x)) {
11
            return x;
12
        }
13
        return x > 0 ? 1 : -1;
14
    };
15
16
    // copied from https://developer.mozilla.org/
17
    /* eslint-disable */
18
    if (!Function.prototype.bind) {
19
        Function.prototype.bind = function(oThis) {
0 ignored issues
show
Compatibility Best Practice introduced by
You are extending the built-in type Function. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
Loading history...
20
            if (typeof this !== 'function') {
21
                // closest thing possible to the ECMAScript 5
22
                // internal IsCallable function
23
                throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
24
            }
25
26
            var aArgs   = Array.prototype.slice.call(arguments, 1),
27
                fToBind = this,
28
                fNOP    = function() {},
29
                fBound  = function() {
30
                    return fToBind.apply(this instanceof fNOP
31
                            ? this
32
                            : oThis,
33
                        aArgs.concat(Array.prototype.slice.call(arguments)));
34
                };
35
36
            if (this.prototype) {
37
                // Function.prototype doesn't have a prototype property
38
                fNOP.prototype = this.prototype;
39
            }
40
            fBound.prototype = new fNOP();
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like fNOP should be capitalized.
Loading history...
41
42
            return fBound;
43
        };
44
    }
45
    /* eslint-enable */
46
});
47