JS lib: drop es5 shims.
This commit is contained in:
@@ -1,80 +1,23 @@
|
||||
|
||||
// TODO drop this:
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
if (!Array.isArray) {
|
||||
Array.isArray = function (vArg) {
|
||||
return Object.prototype.toString.call(vArg) === "[object Array]";
|
||||
};
|
||||
}
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
if (typeof this !== "function") {
|
||||
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
||||
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
||||
}
|
||||
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||
fToBind = this,
|
||||
fNOP = function () {
|
||||
},
|
||||
fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP && oThis
|
||||
? this
|
||||
: oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Object.keys) {
|
||||
Object.keys = function (o) {
|
||||
var result = [];
|
||||
var i = 0;
|
||||
for (var p in o) {
|
||||
if (o.hasOwnProperty(p)) {
|
||||
result[i++] = p;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Object.create) {
|
||||
Object.create = function(proto) {
|
||||
function F() {}
|
||||
F.prototype = proto;
|
||||
return new F();
|
||||
}
|
||||
}
|
||||
|
||||
// http://ejohn.org/blog/objectgetprototypeof/
|
||||
if ( typeof Object.getPrototypeOf !== "function" ) {
|
||||
if ( typeof "test".__proto__ === "object" ) {
|
||||
Object.getPrototypeOf = function(object){
|
||||
return object.__proto__;
|
||||
};
|
||||
} else {
|
||||
Object.getPrototypeOf = function(object){
|
||||
// May break if the constructor has been tampered with
|
||||
return object.constructor.prototype;
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Kotlin = {};
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function toArray(obj) {
|
||||
var array;
|
||||
@@ -384,5 +327,3 @@ var Kotlin = {};
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user