Comparing version 7.2.1 to 7.2.2
/** | ||
* bellajs@7.2.1 | ||
* built on: Mon, 07 May 2018 09:33:49 GMT | ||
* bellajs@7.2.2 | ||
* built on: Wed, 16 May 2018 02:37:57 GMT | ||
* repository: https://github.com/ndaidong/bellajs | ||
@@ -5,0 +5,0 @@ * maintainer: @ndaidong |
@@ -1,2 +0,2 @@ | ||
// bellajs@7.2.1, by @ndaidong - built on Mon, 07 May 2018 09:33:49 GMT - published under MIT license | ||
// bellajs@7.2.2, by @ndaidong - built on Wed, 16 May 2018 02:37:57 GMT - published under MIT license | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.bella={})}(this,function(n){"use strict";var r,e=function(n){return{}.toString.call(n)},t=function(n){return"[object Null]"===e(n)},i=function(n){return"[object Undefined]"===e(n)},u=function(n){return"[object String]"===e(n)},o=function(n){return"[object Number]"===e(n)},a=function(n){return Number.isInteger(n)},c=function(n){return Array.isArray(n)},f=function(n){return"[object Object]"===e(n)&&!c(n)},l=function(n){return n instanceof Date&&!isNaN(n.valueOf())},s=function(n){return!n||i(n)||t(n)||u(n)&&""===n||c(n)&&"[]"===JSON.stringify(n)||f(n)&&"{}"===JSON.stringify(n)},g=function(n,r){return!(!n||!r)&&Object.prototype.hasOwnProperty.call(n,r)},h=Number.MAX_SAFE_INTEGER,p=function(n,r){if((!n||n<0)&&(n=0),r||(r=h),n===r)return r;n>r&&(n=Math.min(n,r),r=Math.max(n,r));var e=n,t=r-n+1;return Math.floor(Math.random()*t)+e},v=function(n){var r=o(n)?String(n):n;if(!u(r))throw new Error("InvalidInput: String required.");return r},d=function(n){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=v(n);return(e=e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""))&&r&&(e=e.replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," ")),e},m=function(n){var r=v(n);return 1===r.length?r.toUpperCase():(r=r.toLowerCase()).charAt(0).toUpperCase()+r.slice(1)},w=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0",t=v(n);return t.length>=r?t:new Array(r-t.length+1).join(e)+t},y=function n(r,e,t){var i=v(r);if(o(e)&&(e=String(e)),o(t)&&(t=String(t)),u(e)&&u(t)){var a=i.split(e);i=a.join(t)}else if(c(e)&&u(t))e.forEach(function(r){i=n(i,r,t)});else if(c(e)&&c(t)&&e.length===t.length){var f=e.length;if(f>0)for(var l=0;l<f;l++){var s=e[l],g=t[l];i=n(i,s,g)}}return i},b=function(n){var r=v(n),e={a:"á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ|ä",A:"Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ä",c:"ç",C:"Ç",d:"đ",D:"Đ",e:"é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ|ë",E:"É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ|Ë",i:"í|ì|ỉ|ĩ|ị|ï|î",I:"Í|Ì|Ỉ|Ĩ|Ị|Ï|Î",o:"ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ|ö",O:"Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ô|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ|Ö",u:"ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự|û",U:"Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự|Û",y:"ý|ỳ|ỷ|ỹ|ỵ",Y:"Ý|Ỳ|Ỷ|Ỹ|Ỵ"},t=function(n){g(e,n)&&e[n].split("|").forEach(function(e){return function(n,e){r=y(r,n,e)}(e,n)})};for(var i in e)t(i);return r},j=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],M=["January","February","March","April","May","June","July","August","September","October","November","December"],A=function(){return new Date},D=function(){return Date.now()},E=A().getTimezoneOffset(),I=(r=Math.abs(E/60),["GMT",E<0?"+":"-",w(r,4)].join("")),S=function(n){return String(n<10?"0"+n:n)},N=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"D, M d, Y h:i:s A",e=l(n)?n:new Date(n);if(!l(e))throw new Error("InvalidInput: Number or Date required.");if(!u(r))throw new Error("Invalid output pattern.");var t=r.match(/(\.*)a{1}(\.*)*/i),i=j,o=M,a={Y:function(){return e.getFullYear()},y:function(){return(a.Y()+"").slice(-2)},F:function(){return o[a.n()-1]},M:function(){return(a.F()+"").slice(0,3)},m:function(){return S(a.n())},n:function(){return e.getMonth()+1},S:function(){return n=a.j(),e=(r=n+" ").charAt(r.length-2),r="1"===e?"st":"2"===e?"nd":"3"===e?"rd":"th";var n,r,e},j:function(){return e.getDate()},d:function(){return S(a.j())},t:function(){return new Date(a.Y(),a.n(),0).getDate()},w:function(){return e.getDay()},l:function(){return i[a.w()]},D:function(){return(a.l()+"").slice(0,3)},G:function(){return e.getHours()},g:function(){return a.G()%12||12},h:function(){return S(t?a.g():a.G())},i:function(){return S(e.getMinutes())},s:function(){return S(e.getSeconds())},a:function(){return a.G()>11?"pm":"am"},A:function(){return a.a().toUpperCase()},O:function(){return I}};return r.replace(/\.*\\?([a-z])/gi,function(n,r){return a[n]?a[n]():r})},O=function(n){if(Array.isArray(n)){for(var r=0,e=Array(n.length);r<n.length;r++)e[r]=n[r];return e}return Array.from(n)},T=function n(r){if(l(r))return new Date(r.valueOf());var e=function(r){var e=Object.create({});for(var t in r)g(r,t)&&(e[t]=n(r[t]));return e};return c(r)?function r(t){return[].concat(O(t)).map(function(t){return c(t)?r(t):f(t)?e(t):n(t)})}(r):f(r)?e(r):r};n.curry=function(n){return function r(e,t){return e>0?function(){for(var n=arguments.length,i=Array(n),u=0;u<n;u++)i[u]=arguments[u];return r(e-i.length,[].concat(O(t),i))}:n.apply(void 0,O(t))}(n.length,[])},n.compose=function(){for(var n=arguments.length,r=Array(n),e=0;e<n;e++)r[e]=arguments[e];return r.reduce(function(n,r){return function(e){return n(r(e))}})},n.pipe=function(){for(var n=arguments.length,r=Array(n),e=0;e<n;e++)r[e]=arguments[e];return r.reduce(function(n,r){return function(e){return r(n(e))}})},n.clone=T,n.copies=function n(r,e){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];for(var u in r)if(!(i.length>0&&i.includes(u))&&(!t||t&&e.hasOwnProperty(u))){var o=r[u],a=e[u];f(a)&&f(o)||c(a)&&c(o)?e[u]=n(o,e[u],t,i):e[u]=T(o)}return e},n.unique=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[].concat(O(new Set(n)))},n.isNull=t,n.isUndefined=i,n.isFunction=function(n){return"[object Function]"===e(n)},n.isString=u,n.isNumber=o,n.isInteger=a,n.isArray=c,n.isObject=f,n.isBoolean=function(n){return!0===n||!1===n},n.isDate=l,n.isElement=function(n){return e(n).match(/^\[object HTML\w*Element]$/)},n.isLetter=function(n){return u(n)&&/^[a-z]+$/i.test(n)},n.isEmail=function(n){return u(n)&&/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(n)},n.isEmpty=s,n.hasProperty=g,n.equals=function n(r,e){var t=!0;if(s(r)&&s(e))return!0;if(l(r)&&l(e))return r.getTime()===e.getTime();if(o(r)&&o(e)||u(r)&&u(e))return r===e;if(c(r)&&c(e)){if(r.length!==e.length)return!1;if(r.length>0)for(var i=0,a=r.length;i<a;i++)if(!n(r[i],e[i])){t=!1;break}}else if(f(r)&&f(e)){var h=[],p=[];for(var v in r)g(r,v)&&h.push(v);for(var d in e)g(e,d)&&p.push(d);if(h.length!==p.length)return!1;for(var m in r)if(!g(e,m)||!n(r[m],e[m])){t=!1;break}}return t},n.encode=function(n){var r=v(n);return encodeURIComponent(r)},n.decode=function(n){var r=v(n);return decodeURIComponent(r.replace(/\+/g," "))},n.trim=d,n.truncate=function(n,r){var e=v(n),t=r||140;if(e.length<=t)return e;var i=e.substring(0,t),u=i.split(" "),o="";return u.length>1?(u.pop(),(o+=u.join(" ")).length<e.length&&(o+="...")):o=(i=i.substring(0,t-3))+"...",o},n.stripTags=function(n){var r=v(n);return d(r.replace(/<.*?>/gi," ").replace(/\s\s+/g," "))},n.escapeHTML=function(n){return v(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},n.unescapeHTML=function(n){return v(n).replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},n.ucfirst=m,n.ucwords=function(n){var r=[];return v(n).split(" ").forEach(function(n){r.push(m(n))}),r.join(" ")},n.leftPad=w,n.rightPad=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0",t=v(n);return t.length>=r?t:t+new Array(r-t.length+1).join(e)},n.repeat=function(n,r){var e=v(n);if(!a(r)||r<1)return e;if(e.length*r>=1<<28)throw new RangeError("Repeat count must not overflow maximum string size.");var t=[];return t.length=r,t.fill(e,0,r).join("")},n.replaceAll=y,n.stripAccent=b,n.createId=function(n){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e="abcdefghijklmnopqrstuvwxyz",t=[e,e.toUpperCase(),"0123456789"].join("").split("").sort(function(){return Math.random()>.5}).join(""),i=t.length,u=Math.max(n||32,r.length),o=r;o.length<u;){var a=p(0,i);o+=t.charAt(a)||""}return o},n.createAlias=function(n,r){var e=d(b(n)),t=r||"-";return e.toLowerCase().replace(/\W+/g," ").replace(/\s+/g," ").replace(/\s/g,t)},n.template=function(n){return{compile:function(r){return function(n,r){var e=[];return r&&(u(r)||f(r)||c(r))?function n(r,t,i){i&&e.push(i);var a=[];for(var l in t)if(g(t,l)){var s=t[l];if(o(s)&&(s=String(s)),f(s)||c(s))a.push({key:l,data:s});else if(u(s)){s=y(s,["{","}"],["{","}"]);var h=e.concat([l]),p=new RegExp("{"+h.join(".")+"}","gi");r=r.replace(p,s)}}return a.length>0&&a.forEach(function(e){r=n(r,e.data,e.key)}),d(r,!0)}(n,r):n}(n,r)}}},n.random=p,n.now=A,n.time=D,n.format=N,n.relativize=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D(),r=l(n)?n:new Date(n);if(!l(r))throw new Error("InvalidInput: Number or Date required.");var e=A()-r,t=parseInt(r,10);if(isNaN(t)&&(t=0),e<=t)return"Just now";var i=null,u={millisecond:1,second:1e3,minute:60,hour:60,day:24,month:30,year:12};for(var o in u){if(e<u[o])break;i=o,e/=u[o]}return 1!==(e=Math.floor(e))&&(i+="s"),[e,i].join(" ")+" ago"},n.utc=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D(),r=l(n)?n:new Date(n);if(!l(r))throw new Error("InvalidInput: Number or Date required.");var e=r.getMinutes(),t=new Date(r);return t.setMinutes(e+E),N(t,"D, j M Y h:i:s")+" GMT+0000"},n.local=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D(),r=l(n)?n:new Date(n);if(!l(r))throw new Error("InvalidInput: Number or Date required.");return N(r,"D, j M Y h:i:s O")},n.md5=function(n){for(var r=[],e=0;e<64;)r[e]=0|4294967296*Math.abs(Math.sin(++e));var t,i,u,o,a=[],c=unescape(encodeURI(n)),f=c.length,l=[t=1732584193,i=-271733879,~t,~i];for(e=0;e<=f;)a[e>>2]|=(c.charCodeAt(e)||128)<<e++%4*8;for(a[n=16*(f+8>>6)+14]=8*f,e=0;e<n;e+=16){for(f=l,o=0;o<64;)f=[u=f[3],(t=0|f[1])+((u=f[0]+[t&(i=f[2])|~t&u,u&t|~u&i,t^i^u,i^(t|~u)][f=o>>4]+(r[o]+(0|a[[o,5*o+1,3*o+5,7*o][f]%16+e])))<<(f=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*f+o++%4])|u>>>32-f),t,i];for(o=4;o;)l[--o]=l[o]+f[o]}for(n="";o<32;)n+=(l[o>>3]>>4*(1^7&o++)&15).toString(16);return n},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"version": "7.2.1", | ||
"version": "7.2.2", | ||
"name": "bellajs", | ||
@@ -4,0 +4,0 @@ "description": "A useful helper for any javascript program", |
@@ -9,3 +9,3 @@ BellaJS | ||
[![codecov](https://codecov.io/gh/ndaidong/bellajs/branch/master/graph/badge.svg)](https://codecov.io/gh/ndaidong/bellajs) | ||
[![Dependency Status](https://gemnasium.com/badges/github.com/ndaidong/bellajs.svg)](https://gemnasium.com/github.com/ndaidong/bellajs) | ||
![Dependency Status](https://david-dm.org/ndaidong/bellajs.svg) | ||
[![NSP Status](https://nodesecurity.io/orgs/techpush/projects/63f808aa-af9a-44ea-b744-3d6356d5e268/badge)](https://nodesecurity.io/orgs/techpush/projects/63f808aa-af9a-44ea-b744-3d6356d5e268) | ||
@@ -12,0 +12,0 @@ |
113086