Sha256: 6397d909a2e558ca0325034731b2bd23d4f5e177ba5fff84f17a43a76d4b6db8

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

// This methods allows the killing of built-in functions,
// so the shim can take over with that implementation
var HLP = (function() {
    "use strict";
    var kill;

    kill = function(_class, methods) {
        /*if(!Array.isArray(methods))
            return;*/
        if(!_class.originals)
            _class.originals = {};

        for (var i = 0, len = methods.length; i < len; i++) {
            var obj = methods[i];
            _class.originals[obj] = _class[obj];
            delete _class[obj];
            if (obj in _class) {
                // try something more aggressive since V8 at least
                // appears to ignore the delete.
                _class[obj] = null;
                if (_class[obj]) {
                    console.log("Couln't overwrite", obj, "of", _class);
                }
            }
        }
    };
    return { kill: kill };
}());

HLP.kill(Function.prototype, [
    'bind'
]);

HLP.kill(Array, [
    'isArray'
]);

HLP.kill(String.prototype, [
    "trim"
]);

HLP.kill(Object, [
    'keys'
]);

HLP.kill(Number.prototype, [
    'toFixed'
]);

HLP.kill(Date, [
    'now', 'parse'
]);

HLP.kill(Date.prototype, [
    "toJSON", "toISOString"
]);

HLP.kill(Array.prototype, [
    'forEach', 'some', 'every',
    'indexOf', 'lastIndexOf',
    'map', 'filter',
    'reduce', 'reduceRight'
]);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
jruby_activiti-2.0.8 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.7 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.6 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.5 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.4 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.3 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.2 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.1 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js
jruby_activiti-2.0.0 web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js