Advertisement
Romul81

TextPipe JScript ES5-augment filter

Jul 7th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //JScript ES5 augment script
  2. //var a; //Our global variable that does not reset for each file
  3.  
  4. //Called for every line in the file
  5. //EOL contains the end of line characters (Unix, DOS or Mac) that must be
  6. //appended to each line
  7. function processLine(line, EOL) {
  8.     //your code here
  9.  
  10.     //a = a + 1; //counter increment
  11.     //line +=  " " + a; //add the count to the end of each line
  12.     return line + EOL;
  13. }
  14.  
  15.  
  16. //Called at the start of a processing job -
  17. //perform one-time initialisation here
  18. function startJob() {
  19.     //a = 0; // assign value to global variable
  20.  
  21.     // augment.js JavaScript 1.8.5 methods for all, version: 1.0.0
  22.     // using snippets from Mozilla - https://developer.mozilla.org/en/JavaScript
  23.     // (c) 2011 Oliver Nightingale
  24.     //
  25.     //  Released under MIT license.
  26.     if(!Array.prototype.every){Array.prototype.every=function(f,b){if(this===void 0||this===null||typeof f!=="function"){throw new TypeError}var d=Object(this),a=d.length>>>0,e=(b===void 0||b===null);for(var c=0;c<a;c++){if(c in d){if(e){if(!f(d[c],c,d)){return false}}else{if(!f.call(b,d[c],c,d)){return false}}}}return true}}if(!Array.prototype.filter){Array.prototype.filter=function(g,b){if(this===void 0||this===null||typeof g!=="function"){throw new TypeError}var e=Object(this),a=e.length>>>0,f=(b===void 0||b===null),c=[];for(var d=0;d<a;d++){if(d in e){var h=e[d];if(f){if(g(e[d],d,e)){c.push(h)}}else{if(g.call(b,e[d],d,e)){c.push(h)}}}}return c}}if(!Array.prototype.forEach){Array.prototype.forEach=function(f,b){if(this===void 0||this===null||typeof f!=="function"){throw new TypeError}var d=Object(this),a=d.length>>>0,e=(b===void 0||b===null);for(var c=0;c<a;c++){if(c in d){if(e){f(d[c],c,d)}else{f.call(b,d[c],c,d)}}}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(d,f){if(this===void 0||this===null){throw new TypeError}var e=Object(this),b=e.length>>>0,a=(f!==void 0&&f!==null);if(b===0){return -1}var g=0;if(a){g=Number(f);if(g!==g){g=0}else{if(g!==0&&g!==Infinity&&g!==-Infinity){g=(g>0||-1)*Math.floor(Math.abs(g))}}}if(g>=b){return -1}var c=g>=0?g:Math.max(b-Math.abs(g),0);for(;c<b;c++){if(c in e&&e[c]===d){return c}}return -1}}Array.isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(d,f){if(this===void 0||this===null){throw new TypeError()}var e=Object(this),b=e.length>>>0,a=(f!==void 0&&f!==null);if(b===0){return -1}var g=b;if(a){g=Number(f);if(g!==g){g=0}else{if(g!==0&&g!==(Infinity)&&g!==-(Infinity)){g=(g>0||-1)*Math.floor(Math.abs(g))}}}var c=g>=0?Math.min(g,b-1):b-Math.abs(g);for(;c>=0;c--){if(c in e&&e[c]===d){return c}}return -1}}if(!Array.prototype.map){Array.prototype.map=function(g,b){if(this===void 0||this===null||typeof g!=="function"){throw new TypeError}var e=Object(this),a=e.length>>>0,f=(b===void 0||b===null),c=new Array(a);for(var d=0;d<a;d++){if(d in e){if(f){c[d]=g(e[d],d,e)}else{c[d]=g.call(b,e[d],d,e)}}}return c}}if(!Array.prototype.reduce){Array.prototype.reduce=function(g,b){if(this===void 0||this===null||typeof g!=="function"){throw new TypeError}var f=Object(this),a=f.length>>>0,e=(b!==void 0&&b!==null);if(a==0&&!e){throw new TypeError}var d=0,c;if(e){c=b}else{do{if(d in f){c=f[d++];break}if(++d>=a){throw new TypeError}}while(true)}while(d<a){if(d in f){c=g(c,f[d],d,f)}d++}return c}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function(g,b){if(this===void 0||this===null||typeof g!=="function"){throw new TypeError}var f=Object(this),a=f.length>>>0,e=(b!==void 0&&b!==null);if(a==0&&!e){throw new TypeError}var d=a-1,c;if(e){c=b}else{do{if(d in this){c=f[d--];break}if(--d<0){throw new TypeError}}while(true)}while(d--){if(d in f){c=callbackfn(c,f[d],d,f)}}return c}}if(!Array.prototype.some){Array.prototype.some=function(f,b){if(this===void 0||this===null||typeof f!=="function"){throw new TypeError}var d=Object(this),a=d.length>>>0,e=(b===void 0||b===null);for(var c=0;c<a;c++){if(c in d){if(e){if(f(d[c],c,d)){return true}}else{if(f.call(b,d[c],c,d)){return true}}}}return false}}if(!Date.now){Date.now=function(){return +new Date}}if(!Date.prototype.toISOString){Date.prototype.toISOString=(function(){var a=function(c,b){b=b||2;return(c=c+"",c.length===b)?c:a("0"+c,b)};return function(){var c=this.getUTCFullYear();c=(c<0?"-":(c>9999?"+":""))+("00000"+Math.abs(c)).slice(0<=c&&c<=9999?-4:-6);var b=[c,a(this.getUTCMonth()+1),a(this.getUTCDate())].join("-");var d=[a(this.getUTCHours()),a(this.getUTCMinutes()),a(this.getUTCSeconds())].join(":")+"."+a(this.getUTCMilliseconds(),3);return[b,d].join("T")+"Z"}})()}if(!Date.prototype.toJSON){Date.prototype.toJSON=function(){var b=Object(this),a=b.toISOString;if(typeof a!=="function"){throw new TypeError}return a.call(b)}}if(!Function.prototype.bind){Function.prototype.bind=function(d){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var e=Array.prototype.slice,b=e.call(arguments,1),a=this,f=function(){},c=function(){if(f.prototype&&this instanceof f){var g=a.apply(new f,b.concat(e.call(arguments)));return(Object(g)===g)?g:a}else{return a.apply(d,b.concat(e.call(arguments)))}};f.prototype=a.prototype;c.prototype=new f();return c}}(function(){var a=function(b){if(b!==Object(b)){throw new TypeError("Object.getPrototypeOf called on non-object")}};if(!Object.getPrototypeOf){if(typeof"test".__proto__==="object"){Object.getPrototypeOf=function(b){a(b);return b.__proto__}}else{Object.getPrototypeOf=function(b){a(b);return b.constructor.prototype}}}})();if(!Object.keys){Object.keys=(function(){var c=Object.prototype.hasOwnProperty,d=!({toString:null}).propertyIsEnumerable("toString"),b=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=b.length;return function(g){if(typeof g!=="object"&&typeof g!=="function"||g===null){throw new TypeError("Object.keys called on non-object")}var e=[];for(var h in g){if(c.call(g,h)){e.push(h)}}if(d){for(var f=0;f<a;f++){if(c.call(g,b[f])){e.push(b[f])}}}return e}})()}if(!String.prototype.trim){String.prototype.trim=(function(){var b=/^\s+/,a=/\s+$/;return function(){return this.replace(b,"").replace(a,"")}})()};
  27.  
  28. }
  29.  
  30.  
  31. //Called at the end of a processing job -
  32. //destroy any declared objects here
  33. function endJob() {
  34.     ; //do nothing
  35. }
  36.  
  37.  
  38. //Called before each file is opened -
  39. //perform per-file initialisation here
  40. function startFile() {
  41.     return "";
  42. }
  43.  
  44.  
  45. //Called before each file is closed -
  46. //flush all pending file output here
  47. function endFile() {
  48.     return "";
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement