mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2025-01-03 09:30:23 +00:00
Drop dependency on external harmony polyfill
This commit is contained in:
parent
e004ed0be3
commit
66de8344ff
7
basic.js
7
basic.js
@ -48,8 +48,10 @@ if(!Object.keys){Object.keys=function(o){if(o!==Object(o))throw new TypeError();
|
|||||||
if(!Array.prototype.forEach){Array.prototype.forEach=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}var thisp=arguments[1],i;for(i=0;i<len;i++){if(i in t){fun.call(thisp,t[i],i,t);}}};}
|
if(!Array.prototype.forEach){Array.prototype.forEach=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}var thisp=arguments[1],i;for(i=0;i<len;i++){if(i in t){fun.call(thisp,t[i],i,t);}}};}
|
||||||
if(!Array.prototype.map){Array.prototype.map=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}var res=[];res.length=len;var thisp=arguments[1],i;for(i=0;i<len;i++){if(i in t){res[i]=fun.call(thisp,t[i],i,t);}}return res;};}
|
if(!Array.prototype.map){Array.prototype.map=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}var res=[];res.length=len;var thisp=arguments[1],i;for(i=0;i<len;i++){if(i in t){res[i]=fun.call(thisp,t[i],i,t);}}return res;};}
|
||||||
if(!Array.prototype.reduce){Array.prototype.reduce=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}if(len===0&&arguments.length===1){throw new TypeError();}var k=0;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{do{if(k in t){accumulator=t[k++];break;}if(++k>=len){throw new TypeError();}}while(true);}while(k<len){if(k in t){accumulator=fun.call(undefined,accumulator,t[k],k,t);}k++;}return accumulator;};}
|
if(!Array.prototype.reduce){Array.prototype.reduce=function(fun){if(this===void 0||this===null){throw new TypeError();}var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function"){throw new TypeError();}if(len===0&&arguments.length===1){throw new TypeError();}var k=0;var accumulator;if(arguments.length>=2){accumulator=arguments[1];}else{do{if(k in t){accumulator=t[k++];break;}if(++k>=len){throw new TypeError();}}while(true);}while(k<len){if(k in t){accumulator=fun.call(undefined,accumulator,t[k],k,t);}k++;}return accumulator;};}
|
||||||
// Functions from harmony.js, via jsmin, for running via console
|
|
||||||
if(!String.prototype.repeat){String.prototype.repeat=function(count){var array=[];array.length=count+1;return array.join(String(this));};}
|
|
||||||
|
// ES6 polyfill:
|
||||||
|
if (!String.prototype.repeat) { String.prototype.repeat = function(n){return Array(n+1).join(this); }; }
|
||||||
|
|
||||||
var basic = (function() {
|
var basic = (function() {
|
||||||
|
|
||||||
@ -698,7 +700,6 @@ var basic = (function() {
|
|||||||
return ' '.repeat(pos - cur);
|
return ' '.repeat(pos - cur);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'spc': function SPC(n) {
|
'spc': function SPC(n) {
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="alternate" type="application/atom+xml" href="https://github.com/inexorabletash/jsbasic/commits/master.atom">
|
<link rel="alternate" type="application/atom+xml" href="https://github.com/inexorabletash/jsbasic/commits/master.atom">
|
||||||
<link rel="Stylesheet" href="styles.css" type="text/css">
|
<link rel="Stylesheet" href="styles.css" type="text/css">
|
||||||
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Suppress browser compat button -->
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Suppress browser compat button -->
|
||||||
|
|
||||||
<script type="text/javascript" src="../polyfill/polyfill.js?update=2012-02-08"></script>
|
<script type="text/javascript" src="../polyfill/polyfill.js?update=2012-02-08"></script>
|
||||||
<script type="text/javascript" src="../polyfill/harmony.js?update=2011-12-17"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function () {
|
(function () {
|
||||||
function load(url) { document.write('<script type="text/javascript" src="' + url + '"></' + 'script>'); }
|
function load(url) { document.write('<script type="text/javascript" src="' + url + '"></' + 'script>'); }
|
||||||
|
Loading…
Reference in New Issue
Block a user