Skip to content

Commit

Permalink
build: upgrade to prettier v2
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzahamidi committed May 21, 2020
1 parent 4dfa4fb commit 66f4471
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -26,7 +26,7 @@
"indent-string": "^4.0.0",
"lodash.merge": "^4.6.0",
"loglevel-colored-level-prefix": "^1.0.0",
"prettier": "^1.7.0",
"prettier": "^2.0.0",
"pretty-format": "^23.0.1",
"require-relative": "^0.8.7",
"typescript": "^3.2.1",
Expand Down
9 changes: 9 additions & 0 deletions polyfills/trim-end.js
@@ -0,0 +1,9 @@
/**
* String.prototype.trimEnd() polyfill
* Adapted from polyfill.io
*/
if (!String.prototype.trimEnd) {
String.prototype.trimEnd = function () {
return this.replace(new RegExp(/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/.source + '$', 'g'), '');
};
}
9 changes: 9 additions & 0 deletions polyfills/trim-start.js
@@ -0,0 +1,9 @@
/**
* String.prototype.trimStart() polyfill
* Adapted from polyfill.io
*/
if (!String.prototype.trimStart) {
String.prototype.trimStart = function () {
return this.replace(new RegExp('^' + /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/.source, 'g'), '');
};
}
9 changes: 9 additions & 0 deletions polyfills/trim.js
@@ -0,0 +1,9 @@
/**
* String.prototype.trim() polyfill
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
*/
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}
6 changes: 6 additions & 0 deletions src/index.js
@@ -1,5 +1,11 @@
/* eslint no-console:0, global-require:0, import/no-dynamic-require:0 */
/* eslint complexity: [1, 13] */

// Add node 8 polyfills
import '../polyfills/trim';
import '../polyfills/trim-start';
import '../polyfills/trim-end';

import fs from 'fs';
import path from 'path';
import requireRelative from 'require-relative';
Expand Down

0 comments on commit 66f4471

Please sign in to comment.