UNPKG

string-pad-start-x

Version:

Pads a string with another string (repeated, if needed).

15 lines 14.8 kB
/*! { "author": "Graham Fairweather", "copywrite": "Copyright (c) 2017", "date": "2019-08-28T17:37:23.244Z", "describe": "", "description": "Pads a string with another string (repeated, if needed).", "file": "string-pad-start-x.min.js", "hash": "4d124d5c823fea53d459", "license": "MIT", "version": "2.1.2" } */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.stringPadStartX=e():t.stringPadStartX=e()}(function(){"use strict";var t,e={}.constructor,n=e.prototype,r=e.defineProperty,o=function(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0},i=function(){return this};try{return r?r(n,"$$globalThis$$",{get:i,configurable:!0}):n.__defineGetter__("$$globalThis$$",i),t="undefined"==typeof $$globalThis$$?o():$$globalThis$$,delete n.$$globalThis$$,t}catch(t){return o()}}(),function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";var r=Object.prototype.toString;if(n(3)()){var o=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==r.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&i.test(o.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,n){"use strict";var r=String.prototype.valueOf,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object String]"===o.call(t))}},function(t,e,n){"use strict";var r=Date.prototype.getDay,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"==typeof t&&null!==t&&(i?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object Date]"===o.call(t))}},function(t,e,n){"use strict";(function(e){var r=e.Symbol,o=n(5);t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&o())))}}).call(this,n(4))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,e,n){"use strict";n.r(e);var r=function(t){return null==t},o=function(t){if(r(t))throw new TypeError("Cannot call method on ".concat(t));return t},i=n(0),u=n.n(i),c="Cannot convert a Symbol value to a string",s=c.constructor,f=function(t){if(u()(t))throw new TypeError(c);return s(t)};function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var l=function(t){return"object"===a(t)?null===t:"function"!=typeof t},p=n(1),y=n.n(p),d={}.constructor("a"),b="a"===d[0]&&0 in d,g=function(){}.bind,h="function"==typeof g&&function(){var t=null,e=null,n=null,r=[];try{var o=g.apply(function(r,o){return n=this,t=r,e=o,arguments},[r,1]),i=o(2);return 1===o.length&&2===i.length&&1===t&&2===e&&n===r}catch(t){return!1}}()&&function(){var t=null,e=null,n=null,r=[1,2,3],o=function(o,i){return t=o,e=i,n=this,r};try{var i=g.apply(o,[null]),u=new i(1,2);return i.length===o.length&&u===r&&1===t&&2===e&&n!==r}catch(t){return!1}}(),v="".split,m=Math.max,S=l.bind,w=l.call,j=h?S.call(w,v):function(t,e){return v.call(t,e)},O=function(t){return y()(t)?j(t,""):t},T=function(t,e){var n=arguments.length>2?arguments[2]:[];if("string"!=typeof t&&l(t))return n;for(var r=b?t:O(t),o=r.length,i=m(0,e)||0;i<o;i+=1)n[n.length]=t[i];return n};function $(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var x=T.bind,P=T.call,E={},F=E.constructor,M=E.toString,N=function(t,e){return t>=e?t:e},_=function(t){if("function"!=typeof t&&"[object Function]"!==M.apply(t))throw new TypeError("bind called on incompatible "+t)},k=[function(t){return function(){return t.apply(this,T(arguments))}},function(t,e){return function(n){return t.apply(this,T(arguments,e,[n]))}},function(t,e){return function(n,r){return t.apply(this,T(arguments,e,[n,r]))}},function(t,e){return function(n,r,o){return t.apply(this,T(arguments,e,[n,r,o]))}},function(t,e){return function(n,r,o,i){return t.apply(this,T(arguments,e,[n,r,o,i]))}},function(t,e){return function(n,r,o,i,u){return t.apply(this,T(arguments,e,[n,r,o,i,u]))}},function(t,e){return function(n,r,o,i,u,c){return t.apply(this,T(arguments,e,[n,r,o,i,u,c]))}},function(t,e){return function(n,r,o,i,u,c,s){return t.apply(this,T(arguments,e,[n,r,o,i,u,c,s]))}},function(t,e){return function(n,r,o,i,u,c,s,f){return t.apply(this,T(arguments,e,[n,r,o,i,u,c,s,f]))}}],C=function(t){var e=$(t,3),n=e[0],r=e[1],o=e[2],i=N(0,r.length-N(0,o.length-2)),u=k[i],c=u?u(n,i):k[0](n);if(r.prototype){var s=function(){};s.prototype=r.prototype,c.prototype=new s,s.prototype=null}return c},D=function(t,e){var n=t.apply(this,e);return F(n)===n?n:this},A=h?P.bind(x):function(t,e){_(t);var n,r=arguments,o=function(){var o=T(arguments,0,T(r,2));return this instanceof n?D.apply(this,[t,o]):t.apply(e,o)};return n=C([o,t,r])},I=TypeError,X=A.apply,q=A(A.call,X),G=A(X,{}.toString),L=function(t){if("function"!=typeof t&&"[object Function]"!==G(t))throw new I(t+" is not a function");return t},z=function(t,e){return q(L(t),e,T(arguments[2]))},B=function(t){try{return{threw:!1,value:z(t,this,T(arguments,1))}}catch(t){return{threw:!0,value:t}}};for(var H=B(function(){return function(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),"function"==typeof Symbol&&u()(Symbol(""))}.bind(void 0)),R=!1===H.threw&&!0===H.value,U=n(2),V=n.n(U),J=function(t){return!!t},K={}.toString,Q=function(t){return function(t){if("function"!=typeof t&&"[object Function]"!==z(K,t))throw new TypeError("methodize called on incompatible "+t)}(t),function(){return z(t,arguments[0],T(arguments,1))}},W=Q({}.toString),Y=function(t){return null===t?"[object Null]":void 0===t?"[object Undefined]":W(t)},Z=R&&u()(Symbol.toStringTag),tt=function(t){return f(o(t))},et=[{code:9,description:"Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\t"},{code:10,description:"Line Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\n"},{code:11,description:"Vertical Tab",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\v"},{code:12,description:"Form Feed",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\f"},{code:13,description:"Carriage Return",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\r"},{code:32,description:"Space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:160,description:"No-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:5760,description:"Ogham space mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:6158,description:"Mongolian vowel separator",es5:!0,es2015:!0,es2016:!0,es2017:!1,es2018:!1,string:"᠎"},{code:8192,description:"En quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8193,description:"Em quad",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8194,description:"En space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8195,description:"Em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8196,description:"Three-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8197,description:"Four-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8198,description:"Six-per-em space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8199,description:"Figure space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8200,description:"Punctuation space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8201,description:"Thin space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8202,description:"Hair space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8232,description:"Line separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2028"},{code:8233,description:"Paragraph separator",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\u2029"},{code:8239,description:"Narrow no-break space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:8287,description:"Medium mathematical space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:12288,description:"Ideographic space",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:" "},{code:65279,description:"Byte Order Mark",es5:!0,es2015:!0,es2016:!0,es2017:!0,es2018:!0,string:"\ufeff"}],nt="",rt=et.length,ot=0;ot<rt;ot+=1)et[ot].es2016&&et[ot].string,et[ot].es2018&&(nt+=et[ot].string);var it=nt,ut=new(0,/none/.constructor)("^[".concat(it,"]+")),ct=Q("".replace),st=function(t){return ct(tt(t),ut,"")},ft=new(0,/none/.constructor)("[".concat(it,"]+$")),at=Q("".replace),lt=function(t){return at(tt(t),ft,"")},pt=function(t){return st(lt(t))},yt=new(0,/none/.constructor)("[".concat(it,"]+"),"g"),dt=Q(" ".replace),bt=function(t){return dt(pt(t),yt," ")},gt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,ht=Q("".replace),vt=function(t,e){return ht(tt(t),gt,arguments.length>1?f(e):"")},mt=B.constructor,St=Q(B.toString),wt=/^class /,jt=Q(wt.test),Ot=!1===B(function(){return mt('"use strict"; return class My {};')()}).threw,Tt=function(t){return jt(wt,bt(vt(St(t)," ")))},$t=function(t){var e=B(Tt,t);return!1===e.threw&&e.value},xt=function(t,e){return!l(t)&&(Z?function(t,e){return!(Ot&&!1===e&&$t(t)||!1!==B(function(){return St(t)}).threw)}(t,J(e)):(!Ot||!1!==J(e)||!$t(t))&&function(t){var e=Y(t);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e}(t))},Pt="string".constructor,Et=(0).constructor,Ft=R&&Symbol.toPrimitive,Mt=R&&Symbol.prototype.valueOf,Nt=["toString","valueOf"],_t=["valueOf","toString"],kt=function(t,e){o(t),function(t){if("string"!=typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"')}(e);for(var n="string"===e?Nt:_t,r=0;r<2;r+=1){var i=t[n[r]];if(xt(i)){var u=z(i,t);if(l(u))return u}}throw new TypeError("No default value")},Ct=function(t,e){if(e){if(t===Pt)return"string";if(t===Et)return"number"}return"default"},Dt=function(t){if(R){if(Ft)return function(t,e){var n=t[e];if(!1===r(n)){if(!1===xt(n))throw new TypeError("".concat(n," returned for property ").concat(e," of object ").concat(t," is not a function"));return n}}(t,Ft);if(u()(t))return Mt}},At=function(t){var e=t.exoticToPrim,n=t.input,r=t.hint,o=z(e,n,[r]);if(l(o))return o;throw new TypeError("unable to convert exotic object to primitive")},It=function(t,e){var n="default"===e&&(V()(t)||u()(t))?"string":e;return kt(t,"default"===n?"number":n)},Xt=function(t,e){if(l(t))return t;var n=Ct(e,arguments.length>1),r=Dt(t);return void 0===r?It(t,n):At({exoticToPrim:r,input:t,hint:n})},qt=parseInt,Gt=(0).constructor,Lt=Q("᠎".charAt),zt=/^[-+]?0[xX]/,Bt=Q(zt.test),Ht=function(t,e){var n=st(f(t));return"᠎"===Lt(n,0)?NaN:qt(n,Gt(e)||(Bt(zt,n)?16:10))},Rt=2..constructor,Ut=Q("Cannot convert a Symbol value to a number".slice),Vt=/^0b[01]+$/i,Jt=Vt.constructor,Kt=Q(Vt.test),Qt=/^0o[0-7]+$/i,Wt=new Jt("[…᠎​￾]","g"),Yt=/^[-+]0x[0-9a-f]+$/i,Zt=function(t,e){return Ht(Ut(t,2),e)},te=function(t,e){return function(t){return Kt(Vt,t)}(e)?t(Zt(e,2)):function(t){return Kt(Qt,t)}(e)?t(Zt(e,8)):null},ee=function(t,e){var n=te(t,e);if(null!==n)return n;if(function(t){return Kt(Wt,t)}(e)||function(t){return Kt(Yt,t)}(e))return NaN;var r=pt(e);return r!==e?t(r):null},ne=function t(e){var n=function(t){if(u()(t))throw new TypeError("Cannot convert a Symbol value to a number");return t}(Xt(e,Rt));if("string"==typeof n){var r=ee(t,n);if(null!==r)return r}return Rt(n)},re=function(t){return t!=t},oe=function(t){return"number"==typeof t&&!1===re(t)&&t!==1/0&&t!==-1/0},ie=function(t){var e=ne(t);return 0===e||re(e)?e:e>0?1:-1},ue=Math.abs,ce=Math.floor,se=function(t){var e=ne(t);return re(e)?0:0===e||!1===oe(e)?e:ie(e)*ce(ue(e))},fe=function(t){var e=se(t);return e<=0?0:e>9007199254740991?9007199254740991:e},ae=Q("".slice);e.default=function(t,e){var n=f(o(t)),r=fe(n.length),i=arguments.length>2?arguments[2]:void 0,u=void 0===i?"":f(i);""===u&&(u=" ");var c=fe(e);if(c<=r)return n;for(var s=c-r;u.length<s;){var a=u.length,l=s-a;u+=a>l?ae(u,0,l):u}var p=u.length>s?ae(u,0,s):u;return p+n}}])}); //# sourceMappingURL=string-pad-start-x.min.js.map