This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathn8iv.min.js
1 lines (1 loc) · 8.21 KB
/
n8iv.min.js
1
!function(e,t,n){"use strict";function r(){return e.x.apply(e,arguments),r}function i(t,n){return e.x.cache(t.__name__,n).x(t),r}e.x.cache("Object",function(t){function n(e,n){return e.length==n.length&&Array.coerce(e).every(function(e,r){return t.equalTo(n[r],e)})}function r(n,r){if(e.len(n)!==e.len(r)||t.ownLen(n)!==t.ownLen(r))return!1;for(var i in r)if(e.has(n,i)!==e.has(r,i)||!t.equalTo(n[i],r[i]))return!1;return!0}e.defs(t,{aggregate:function(e,n,r,i){return i||(i=e),t.keys(e).reduce(function(t,n,u){return r.call(i,t,e[n],n,e,u)},n)},clear:function(e){return t.keys(e).forEach(function(t){delete e[t]},e),e},equalTo:function(t,i){switch(e.ntype(t)){case"array":return Array.isArray(i)?n(t,i):!1;case"object":return"object"==e.ntype(i)?r(t,i):!1;case"date":return+t==+i}return t==i},ownKeys:function(e){return t.getOwnPropertyNames(e)},ownLen:function(e){return t.ownKeys(e).length}},"w")}),e.x.cache("Function",function(t){var n=/^[\s\(]*function[^\(]*\(([^\)]*)\)/,r=/\s*,\s*/;e.def(t,"coerce",e.describe(function(t){return"function"==e.ntype(t)?t:function(){return t}},"w")),e.defs(t.prototype,{params:{get:function(){var e=(this+"").match(n)[1].trim().split(r);return 1!=e.length||e[0]?e:[]}},attempt:function(e){var t=Array.coerce(arguments,1),n=this;return function(){try{return n.apply(e||this,t)}catch(r){return r}}()},bake:function(){var t="baked",n=this;return n[t]||!e.def(n,t,e.describe(function(){return n.apply(this,[this].concat(Array.coerce(arguments)))}.mimic(n),"w"))||n[t]},defer:"commonjs"==e.ENV?function(e){return process.nextTick(this.bind.apply(this,[e].concat(Array.coerce(arguments,1))))}:function(){return this.delay.apply(this,[1].concat(Array.coerce(arguments)))},delay:function(t,n){function r(){return r.stop(),u.apply(n||this,i)}var i=Array.coerce(arguments,2),u=this;return e.copy(r,{stop:function(){return clearTimeout(this.timeoutId),delete this.timeoutId,u},timeoutId:setTimeout(r,t)})},memoize:function(t,n){function r(){var e=Array.coerce(arguments),r=""+e;return r in n?n[r]:n[r]=i.apply(t,e)}var i=this;return"object"==e.ntype(n)||(n=e.obj()),r.unmemoize=function(){return i},r},stop:function(){return this},unmemoize:function(){return this},wrap:function(e){var t=Array.coerce(arguments,1),n=this;return function(){return e.apply(this,[n.bind(this)].concat(t).concat(Array.coerce(arguments)))}.mimic(e)}},"w")}),e.x.cache("Array",function(t){function n(e,t){return e(t)?"0":"1"}function r(e,t){return e.test(t)?"0":"1"}function i(e,t){return Object.value(t,e)||"1"}function u(e){return e?e:null}function s(e){return e[0]}function o(e){return[e,"function"==typeof this?this(e):Object.value(e,this)]}var c=t.prototype,a={desc:function(e,t){return e[1]==t[1]?0:e[1]<t[1]?1:-1},asc:function(e,t){return e[1]==t[1]?0:e[1]>t[1]?1:-1}};a[!0+""]=a[1]=a.asc,a[!1+""]=a[0]=a.desc,e.def(t,"sortFns",e.describe({value:a},"w")),e.defs(t.prototype,{aggregate:function(e,t,n){return c.reduce.call(this,function(e,r,i,u){return t.call(n||r,e,r,i,u)},e)},associate:function(t,n,r){return n||(n=e),r||(r=this),c.reduce.call(this,function(e,i,u){return e[t[u]]=n.call(r,i,u,this),e},e.obj())},clear:function(){return this.length=0,this},clone:function(){return c.slice.call(this)},compact:function(t){return c.mapc.call(this,t===!0?u:e)},contains:function(e){return!!~c.indexOf.call(this,e)},each:function(e,t){return c.forEach.call(this,e,t||this),this},flatten:function(n){if("number"==e.type(n)){if(!(n>0))return this;--n}return c.aggregate.call(this,[],function(e,r){return t.isArray(r)?e.splice.apply(e,[e.length,0].concat(r.flatten(n))):e.push(r),e},this)},grep:function(t,n,r){var i=this;return n||(n=e),r||(r=i),"string"!=e.ntype(t)||(t=RegExp(t.escapeRE(),"g")),c.aggregate.call(i,[],function(e,u,s){return!t.test(u)||e.push(n.call(r,u,s,i)),e})},groupBy:function(t,u,s){u||(u=e);var o,a,f=this,l={};switch(e.type(t)){case"function":a=n;break;case"regexp":a=r;break;case"number":case"string":a=i,o=c.pluck.call(f,t,!0);break;default:throw new TypeError("Array.prototype.groupBy can only match based on a Function, RegExp or String.")}return o?o.forEach(function(e){l[e]=[]}):(l["0"]=[],l["1"]=[]),c.aggregate.call(f,l,function(e,n,r){return e[a(t,n)].push(u.call(this,n,r,f)),e},s||f)},include:function(e){return c.contains.call(this,e)?!1:!this.push(e)||!0},invokec:function(n){var r=t.coerce(arguments,1);return c.mapc.call(this,function(t){return"function"==e.ntype(t[n])?t[n].apply(t,r):null})},item:function(e){return this[0>e?this.length+e:e]},last:function(){return this[this.length-1]},mapc:function(t,n){return n||(n=this),c.reduce.call(this,function(r,i,u,s){return!e.exists(i=t.call(n,i,u,s))||r.push(i),r},[])},remove:function(){for(var e,n,r=t.coerce(arguments),i=[];n=r.shift();)!~(e=c.indexOf.call(this,n))||i.push(c.splice.call(this,e,1)[0]);return i},sortBy:function(t,n){return c.map.call(this,o,t).sort("function"==e.ntype(n)?n:a[(n+"").toLowerCase()]||a.asc).map(s)},tuck:function(e,n){var r=t.isArray(n);return c.each.call(this,function(t,i){t[e]=r?n[i]:n})},uniq:function(){return c.reduce.call(this,function(e,t){return e.contains(t)||e.push(t),e},[])},without:function(){var e=c.clone.call(this);return e.remove.apply(e,arguments),e},zip:function(){var e=t.coerce(arguments);return e.unshift(this),c.map.call(this,function(t,n){return e.pluck(n)})}},"w")}),e.x.cache("Number",function(t){var n=Math.abs,r=9007199254740992,i=Math.floor;e.defs(t,{isInteger:function(t){return"number"==e.type(t)&&isFinite(t)&&t>-r&&r>t&&i(t)===t},toInteger:function(e){return e=+e,isNaN(e)?0:0!==e&&isFinite(e)?(0>e?-1:1)*n(i(e)):e}},"w"),e.defs(t.prototype,{pad:function(e,t){var n=this.toString(t||10);return"0".times(e-n.length)+n},times:function(t,n){return e.range(0,this).forEach(t,n||e.global),this},toHex:function(){return this.pad(2,16)}},"w")}),e.x.cache("String",function(t){function n(e,t){return t+t.toLowerCase()}function r(e){e=e.trim();var t=e.charAt(0),r=e.charAt(1),i=t.toLowerCase()==t&&" "!=r&&r.toUpperCase()==r?2:1,u=e.substring(i).replace(c,n).split(l);return u[0]=e.substring(0,i)+u[0],u}var i=e.obj(),u=e.obj(),s=/([-\*\+\?\.\|\^\$\/\\\(\)[\]\{\}])/g,o="\\$1",c=/([A-Z])/g,a=/#?(\w{1,6})/,f=/(\d{1,3})/g,l=/[\sA-Z_-]+/g,h=/(.*?)\s*$/;e.defs(t.prototype,{blank:function(){return!!this.trim().empty()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},clean:function(e){return e||(e=" "),e=i[e]||(i[e]={re:RegExp("("+e+"){1,}","g"),fill:e}),this.split(e.re).filter(function(t){return!t.blank()&&t!=e.fill}).join(e.fill)},contains:function(e){return!!~this.indexOf(e)},empty:function(){return""===t(this)},endsWith:function(e){return this.length&&this.lastIndexOf(e)==this.length-e.length},format:e.format.bake(),gsub:e.gsub.bake(),hyphenate:function(){return r(this).join("-").toLowerCase()},includes:function(e){return this.toLowerCase().contains(t(e).toLowerCase())},parts:function(e){var t=Array.coerce(this.match(e));switch(t.length){case 1:if(null===t[0]||t[0]===this)return[];default:return t[0]!==this||t.shift(),t}},regexpEsc:function(){return this.replace(s,o)},sliceEvery:function(e){return e=parseInt(e,10),isNaN(e)||e>this.length||0==e?[t(this)]:this.match(u[e]||(u[e]=RegExp("(.{1,"+e+"})","g")))},startsWith:function(e){return!this.indexOf(e)},times:function(e){return Array(Number.toInteger(e)+1).join(this)},toCamelCase:function(){var e=r(this),t=[e.shift()];return e.reduce(function(e,t){return e.push(t.capitalize()),e},t).join("")},toHex:function(){function e(e){return parseInt(e,10).pad(2,16)}return function(){var t=this.match(f);return"#"+(1==t.length?e(t[0]).times(3):t.map(e).join(""))}}(),toJSON:JSON.parse.bake(),toRGB:function(e){var t,n=this.match(a)[1],r=n.length;switch(r){case 6:break;case 3:n=this.times(2);break;case 2:n=this.times(3);break;default:n=r>6?n.substring(0,6):4==r?n+"00":n+"0"}return t=n.sliceEvery(2).map(function(e){return parseInt(e,16)}),e===!0?t:"rgb("+t.join(", ")+")"},trimRight:function(){return this.replace(h,"$1")},truncate:function(n,r){return n||(n=50),"string"==e.ntype(r)||(r="..."),n>this.length?t(this):this.substring(0,n).trimRight()+r},underscore:function(){return r(this).join("_").toLowerCase()}},"w")}),e.iter(n)||(n="commonjs"==e.ENV?module:e.global),e.defs(r=e.expose(r,t,n),{util:e,x:i},"r"),e.expose(e,r),e.x(Object,Array,Function,Number,String)}("undefined"!=typeof m8?m8:"undefined"!=typeof require?require("m8"):null,"n8iv");