luhn-generator
Version:
A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm
16 lines (13 loc) • 463 B
JavaScript
;
var implementation = require('./implementation');
module.exports = function getPolyfill() {
if (!String.prototype.trimStart && !String.prototype.trimLeft) {
return implementation;
}
var zeroWidthSpace = '\u200b';
var trimmed = zeroWidthSpace.trimStart ? zeroWidthSpace.trimStart() : zeroWidthSpace.trimLeft();
if (trimmed !== zeroWidthSpace) {
return implementation;
}
return String.prototype.trimStart || String.prototype.trimLeft;
};