mirror of
https://github.com/markedjs/marked
synced 2024-11-22 00:05:53 +00:00
chore: remove node 4 polyfills (#3014)
This commit is contained in:
parent
591ad80483
commit
587729f9a5
@ -5,47 +5,6 @@ import { createRequire } from 'module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
function node4Polyfills() {
|
||||
// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd
|
||||
if (!String.prototype.padEnd) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
String.prototype.padEnd = function padEnd(targetLength, padString) {
|
||||
targetLength = targetLength >> 0; // floor if number or convert non-number to 0;
|
||||
padString = String((typeof padString !== 'undefined' ? padString : ' '));
|
||||
if (this.length > targetLength) {
|
||||
return String(this);
|
||||
} else {
|
||||
targetLength = targetLength - this.length;
|
||||
if (targetLength > padString.length) {
|
||||
padString += padString.repeat(targetLength / padString.length); // append to original to ensure we are longer than needed
|
||||
}
|
||||
return String(this) + padString.slice(0, targetLength);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
|
||||
if (!String.prototype.padStart) {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
String.prototype.padStart = function padStart(targetLength, padString) {
|
||||
targetLength = targetLength >> 0; // truncate if number, or convert non-number to 0;
|
||||
padString = String(typeof padString !== 'undefined' ? padString : ' ');
|
||||
if (this.length >= targetLength) {
|
||||
return String(this);
|
||||
} else {
|
||||
targetLength = targetLength - this.length;
|
||||
if (targetLength > padString.length) {
|
||||
padString += padString.repeat(targetLength / padString.length); // append to original to ensure we are longer than needed
|
||||
}
|
||||
return padString.slice(0, targetLength) + String(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
node4Polyfills();
|
||||
|
||||
export function outputCompletionTable(title, specs) {
|
||||
let longestName = 0;
|
||||
let maxSpecs = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user