UNPKG

ll-package

Version:

2 lines (1 loc) 1.57 kB
"use strict";const o=require("../../../../../_virtual/ITF14.js");require("./ITF.js");const c=require("../../../../../_virtual/ITF.js");Object.defineProperty(o.__exports,"__esModule",{value:!0});var a=function(){function t(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),_=c.__exports,l=h(_);function h(t){return t&&t.__esModule?t:{default:t}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function b(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=function(e){var n=e.substr(0,13).split("").map(function(r){return parseInt(r,10)}).reduce(function(r,i,f){return r+i*(3-f%2*2)},0);return Math.ceil(n/10)*10-n},p=function(t){b(e,t);function e(n,r){return y(this,e),n.search(/^[0-9]{13}$/)!==-1&&(n+=u(n)),v(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n,r))}return a(e,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===u(this.data)}}]),e}(l.default);o.__exports.default=p;