UNPKG

ll-package

Version:

2 lines (1 loc) 1.63 kB
"use strict";const u=require("../../../../../_virtual/MSI.js");require("../Barcode.js");const c=require("../../../../../_virtual/Barcode.js");Object.defineProperty(u.__exports,"__esModule",{value:!0});var l=function(){function t(e,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),_=c.__exports,h=v(_);function v(t){return t&&t.__esModule?t:{default:t}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y(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 p(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 O=function(t){p(e,t);function e(r,n){return d(this,e),y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,r,n))}return l(e,[{key:"encode",value:function(){for(var n="110",o=0;o<this.data.length;o++){var i=parseInt(this.data[o]),a=i.toString(2);a=g(a,4-a.length);for(var f=0;f<a.length;f++)n+=a[f]=="0"?"100":"110"}return n+="1001",{data:n,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),e}(h.default);function g(t,e){for(var r=0;r<e;r++)t="0"+t;return t}u.__exports.default=O;