prevent-end
Version:
Prevents a string or an array from ending with specified value.
7 lines • 17.7 kB
JavaScript
/*!
*** prevent-end 1.0.6
*** Copyright © 2019, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid)
*** @license MIT
*** See https://github.com/Jaid/prevent-end
!*/
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=29)}([function(t,e,r){var n=r(16),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){var n=r(50),o=r(53);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},function(t,e,r){var n=r(10),o=r(32),i=r(33),u=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,r){var n=r(40),o=r(41),i=r(42),u=r(43),c=r(44);function a(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}a.prototype.clear=n,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=u,a.prototype.set=c,t.exports=a},function(t,e,r){var n=r(9);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e,r){var n=r(1)(Object,"create");t.exports=n},function(t,e,r){var n=r(62);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,r){var n=r(0).Symbol;t.exports=n},function(t,e,r){var n=r(1)(r(0),"Map");t.exports=n},function(t,e){var r=Array.isArray;t.exports=r},function(t,e){t.exports=function(t,e,r){var n=-1,o=t.length;0>e&&(e=-e>o?0:o+e),0>(r=r>o?o:r)&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}},function(t,e,r){var n=r(15),o=r(17);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},function(t,e,r){var n=r(2),o=r(4);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e,r){(function(e){var r="object"==typeof e&&e&&e.Object===Object&&e;t.exports=r}).call(this,r(31))},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&9007199254740991>=t}},function(t,e){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&t>-1&&t%1==0&&e>t}},function(t,e,r){var n=r(34);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,r){var n=r(54),o=r(61),i=r(63),u=r(64),c=r(65);function a(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}a.prototype.clear=n,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=u,a.prototype.set=c,t.exports=a},function(t,e,r){var n=r(66),o=r(69),i=r(70);t.exports=function(t,e,r,u,c,a){var f=1&r,s=t.length,p=e.length;if(!(s==p||f&&p>s))return!1;var l=a.get(t);if(l&&a.get(e))return l==e;var v=-1,y=!0,b=2&r?new n:void 0;for(a.set(t,e),a.set(e,t);++v<s;){var h=t[v],_=e[v];if(u)var d=f?u(_,h,v,e,t,a):u(h,_,v,t,e,a);if(void 0!==d){if(d)continue;y=!1;break}if(b){if(!o(e,function(t,e){if(!i(b,e)&&(h===t||c(h,t,r,u,a)))return b.push(e)})){y=!1;break}}else if(h!==_&&!c(h,_,r,u,a)){y=!1;break}}return a.delete(t),a.delete(e),y}},function(t,e,r){(function(t){var n=r(0),o=r(87),i=e&&!e.nodeType&&e,u=i&&"object"==typeof t&&t&&!t.nodeType&&t,c=u&&u.exports===i?n.Buffer:void 0,a=(c?c.isBuffer:void 0)||o;t.exports=a}).call(this,r(24)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){var n=r(88),o=r(89),i=r(90),u=i&&i.isTypedArray,c=u?o(u):n;t.exports=c},function(t,e,r){var n=r(13),o=r(30),i=r(19);t.exports=function(t,e,r){var u=null==t?0:t.length;return u?(r&&"number"!=typeof r&&o(t,e,r)?(e=0,r=u):(e=null==e?0:i(e),r=void 0===r?u:i(r)),n(t,e,r)):[]}},function(t,e,r){var n=r(13),o=r(19);t.exports=function(t,e,r){var i=null==t?0:t.length;return i?(e=r||void 0===e?1:o(e),n(t,0>(e=i-e)?0:e,i)):[]}},function(t,e,r){var n=r(37);t.exports=function(t,e){return n(t,e)}},function(t,e,r){r.r(e);var n=r(26),o=r.n(n),i=r(27),u=r.n(i),c=r(28),a=r.n(c);e.default=(t,e)=>"string"==typeof t?t.endsWith(e)?t.substr(0,t.length-e.length):t:Array.isArray(t,e)?(Array.isArray(e)||(e=[e]),a()(u()(t,e.length),e)?o()(t,0,t.length-e.length):t):t},function(t,e,r){var n=r(9),o=r(14),i=r(18),u=r(4);t.exports=function(t,e,r){if(!u(r))return!1;var c=typeof e;return!!("number"==c?o(r)&&i(e,r.length):"string"==c&&e in r)&&n(r[e],t)}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){var n=r(10),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,c),r=t[c];try{t[c]=void 0;var n=!0}catch(t){}var o=u.call(t);return n&&(e?t[c]=r:delete t[c]),o}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n=r(35);t.exports=function(t){return t?(t=n(t))===1/0||t===-1/0?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}},function(t,e,r){var n=r(4),o=r(36),i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,a=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(o(t))return NaN;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(/^\s+|\s+$/g,"");var r=u.test(t);return r||c.test(t)?a(t.slice(2),r?2:8):i.test(t)?NaN:+t}},function(t,e,r){var n=r(2),o=r(3);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},function(t,e,r){var n=r(38),o=r(3);t.exports=function t(e,r,i,u,c){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,u,t,c))}},function(t,e,r){var n=r(39),o=r(22),i=r(71),u=r(75),c=r(95),a=r(12),f=r(23),s=r(25),p="[object Object]",l=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,v,y,b){var h=a(t),_=a(e),d=h?"[object Array]":c(t),x=_?"[object Array]":c(e),j=(d="[object Arguments]"==d?p:d)==p,g=(x="[object Arguments]"==x?p:x)==p,O=d==x;if(O&&f(t)){if(!f(e))return!1;h=!0,j=!1}if(O&&!j)return b||(b=new n),h||s(t)?o(t,e,r,v,y,b):i(t,e,d,r,v,y,b);if(!(1&r)){var w=j&&l.call(t,"__wrapped__"),m=g&&l.call(e,"__wrapped__");if(w||m){var A=w?t.value():t,P=m?e.value():e;return b||(b=new n),y(A,P,r,v,b)}}return!!O&&(b||(b=new n),u(t,e,r,v,y,b))}},function(t,e,r){var n=r(5),o=r(45),i=r(46),u=r(47),c=r(48),a=r(49);function f(t){var e=this.__data__=new n(t);this.size=e.size}f.prototype.clear=o,f.prototype.delete=i,f.prototype.get=u,f.prototype.has=c,f.prototype.set=a,t.exports=f},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(6),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return r>=0&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},function(t,e,r){var n=r(6);t.exports=function(t){var e=this.__data__,r=n(e,t);return 0>r?void 0:e[r][1]}},function(t,e,r){var n=r(6);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(6);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return 0>o?(++this.size,r.push([t,e])):r[o][1]=e,this}},function(t,e,r){var n=r(5);t.exports=function(){this.__data__=new n,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,r){var n=r(5),o=r(11),i=r(21);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var u=r.__data__;if(!o||199>u.length)return u.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(u)}return r.set(t,e),this.size=r.size,this}},function(t,e,r){var n=r(15),o=r(51),i=r(4),u=r(20),c=Function.prototype,a=Object.prototype,f=c.toString,s=a.hasOwnProperty,p=RegExp("^"+f.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?p:/^\[object .+?Constructor\]$/).test(u(t))}},function(t,e,r){var n,o=r(52),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},function(t,e,r){var n=r(0)["__core-js_shared__"];t.exports=n},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,r){var n=r(55),o=r(5),i=r(11);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},function(t,e,r){var n=r(56),o=r(57),i=r(58),u=r(59),c=r(60);function a(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}a.prototype.clear=n,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=u,a.prototype.set=c,t.exports=a},function(t,e,r){var n=r(7);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,r){var n=r(7),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},function(t,e,r){var n=r(7),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},function(t,e,r){var n=r(7);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,r){var n=r(8);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(8);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(8);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(8);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},function(t,e,r){var n=r(21),o=r(67),i=r(68);function u(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}u.prototype.add=u.prototype.push=o,u.prototype.has=i,t.exports=u},function(t,e){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},function(t,e){t.exports=function(t,e){return t.has(e)}},function(t,e,r){var n=r(10),o=r(72),i=r(9),u=r(22),c=r(73),a=r(74),f=n?n.prototype:void 0,s=f?f.valueOf:void 0;t.exports=function(t,e,r,n,f,p,l){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!p(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var v=c;case"[object Set]":var y=1&n;if(v||(v=a),t.size!=e.size&&!y)return!1;var b=l.get(t);if(b)return b==e;n|=2,l.set(t,e);var h=u(v(t),v(e),n,f,p,l);return l.delete(t),h;case"[object Symbol]":if(s)return s.call(t)==s.call(e)}return!1}},function(t,e,r){var n=r(0).Uint8Array;t.exports=n},function(t,e){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}},function(t,e){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}},function(t,e,r){var n=r(76),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,u,c){var a=1&r,f=n(t),s=f.length;if(s!=n(e).length&&!a)return!1;for(var p=s;p--;){var l=f[p];if(!(a?l in e:o.call(e,l)))return!1}var v=c.get(t);if(v&&c.get(e))return v==e;var y=!0;c.set(t,e),c.set(e,t);for(var b=a;++p<s;){var h=t[l=f[p]],_=e[l];if(i)var d=a?i(_,h,l,e,t,c):i(h,_,l,t,e,c);if(!(void 0===d?h===_||u(h,_,r,i,c):d)){y=!1;break}b||(b="constructor"==l)}if(y&&!b){var x=t.constructor,j=e.constructor;x!=j&&"constructor"in t&&"constructor"in e&&!("function"==typeof x&&x instanceof x&&"function"==typeof j&&j instanceof j)&&(y=!1)}return c.delete(t),c.delete(e),y}},function(t,e,r){var n=r(77),o=r(79),i=r(82);t.exports=function(t){return n(t,i,o)}},function(t,e,r){var n=r(78),o=r(12);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},function(t,e){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},function(t,e,r){var n=r(80),o=r(81),i=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols,c=u?function(t){return null==t?[]:(t=Object(t),n(u(t),function(e){return i.call(t,e)}))}:o;t.exports=c},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}},function(t,e){t.exports=function(){return[]}},function(t,e,r){var n=r(83),o=r(91),i=r(14);t.exports=function(t){return i(t)?n(t):o(t)}},function(t,e,r){var n=r(84),o=r(85),i=r(12),u=r(23),c=r(18),a=r(25),f=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),s=!r&&o(t),p=!r&&!s&&u(t),l=!r&&!s&&!p&&a(t),v=r||s||p||l,y=v?n(t.length,String):[],b=y.length;for(var h in t)!e&&!f.call(t,h)||v&&("length"==h||p&&("offset"==h||"parent"==h)||l&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||c(h,b))||y.push(h);return y}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},function(t,e,r){var n=r(86),o=r(3),i=Object.prototype,u=i.hasOwnProperty,c=i.propertyIsEnumerable,a=n(function(){return arguments}())?n:function(t){return o(t)&&u.call(t,"callee")&&!c.call(t,"callee")};t.exports=a},function(t,e,r){var n=r(2),o=r(3);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,r){var n=r(2),o=r(17),i=r(3),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!u[n(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,r){(function(t){var n=r(16),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,u=i&&i.exports===o&&n.process,c=function(){try{return i&&i.require&&i.require("util").types||u&&u.binding&&u.binding("util")}catch(t){}}();t.exports=c}).call(this,r(24)(t))},function(t,e,r){var n=r(92),o=r(93),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},function(t,e,r){var n=r(94)(Object.keys,Object);t.exports=n},function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}},function(t,e,r){var n=r(96),o=r(11),i=r(97),u=r(98),c=r(99),a=r(2),f=r(20),s=f(n),p=f(o),l=f(i),v=f(u),y=f(c),b=a;(n&&"[object DataView]"!=b(new n(new ArrayBuffer(1)))||o&&"[object Map]"!=b(new o)||i&&"[object Promise]"!=b(i.resolve())||u&&"[object Set]"!=b(new u)||c&&"[object WeakMap]"!=b(new c))&&(b=function(t){var e=a(t),r="[object Object]"==e?t.constructor:void 0,n=r?f(r):"";if(n)switch(n){case s:return"[object DataView]";case p:return"[object Map]";case l:return"[object Promise]";case v:return"[object Set]";case y:return"[object WeakMap]"}return e}),t.exports=b},function(t,e,r){var n=r(1)(r(0),"DataView");t.exports=n},function(t,e,r){var n=r(1)(r(0),"Promise");t.exports=n},function(t,e,r){var n=r(1)(r(0),"Set");t.exports=n},function(t,e,r){var n=r(1)(r(0),"WeakMap");t.exports=n}])});