Comparing version 8.0.1 to 8.0.2
/** | ||
* bellajs@8.0.1 | ||
* built on: Sun, 27 Oct 2019 14:53:37 GMT | ||
* bellajs@8.0.2 | ||
* built on: Tue, 17 Dec 2019 04:31:59 GMT | ||
* repository: https://github.com/ndaidong/bellajs | ||
@@ -5,0 +5,0 @@ * maintainer: @ndaidong |
@@ -1,2 +0,2 @@ | ||
// bellajs@8.0.1, by @ndaidong - built on Sun, 27 Oct 2019 14:53:37 GMT - published under MIT license | ||
// bellajs@8.0.2, by @ndaidong - built on Tue, 17 Dec 2019 04:31:59 GMT - published under MIT license | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).bella={})}(this,(function(e){const t=e=>({}).toString.call(e),r=e=>"[object Null]"===t(e),n=e=>"[object Undefined]"===t(e),o=e=>"[object String]"===t(e),i=e=>"[object Number]"===t(e),a=e=>Array.isArray(e),s=e=>"[object Object]"===t(e)&&!a(e),l=e=>e instanceof Date&&!isNaN(e.valueOf()),c=e=>!e||n(e)||r(e)||o(e)&&""===e||a(e)&&"[]"===JSON.stringify(e)||s(e)&&"{}"===JSON.stringify(e),u=(e,t)=>!(!e||!t)&&Object.prototype.hasOwnProperty.call(e,t),f=(e,t)=>{let r=!0;if(c(e)&&c(t))return!0;if(l(e)&&l(t))return e.getTime()===t.getTime();if(i(e)&&i(t)||o(e)&&o(t))return e===t;if(a(e)&&a(t)){if(e.length!==t.length)return!1;if(e.length>0)for(let n=0,o=e.length;n<o;n++)if(!f(e[n],t[n])){r=!1;break}}else if(s(e)&&s(t)){const n=[],o=[];for(const t in e)u(e,t)&&n.push(t);for(const e in t)u(t,e)&&o.push(e);if(n.length!==o.length)return!1;for(const n in e)if(!u(t,n)||!f(e[n],t[n])){r=!1;break}}return r},g=Number.MAX_SAFE_INTEGER,p=(e,t)=>{if((!e||e<0)&&(e=0),t||(t=g),e===t)return t;e>t&&(e=Math.min(e,t),t=Math.max(e,t));const r=e,n=t-e+1;return Math.floor(Math.random()*n)+r},h=e=>{const t=i(e)?String(e):e;if(!o(t))throw new Error("InvalidInput: String required.");return t},d=e=>{let t=h(e);return 1===t.length?t.toUpperCase():(t=t.toLowerCase()).charAt(0).toUpperCase()+t.slice(1)},m=(e,t,r)=>{let n=h(e);if(i(t)&&(t=String(t)),i(r)&&(r=String(r)),o(t)&&o(r)){const e=n.split(t);n=e.join(r)}else if(a(t)&&o(r))t.forEach(e=>{n=m(n,e,r)});else if(a(t)&&a(r)&&t.length===r.length){const e=t.length;if(e>0)for(let o=0;o<e;o++){const e=t[o],i=r[o];n=m(n,e,i)}}return n},w=e=>{let t=h(e);const r={a:"á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ|ä",A:"Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ä",c:"ç",C:"Ç",d:"đ",D:"Đ",e:"é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ|ë",E:"É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ|Ë",i:"í|ì|ỉ|ĩ|ị|ï|î",I:"Í|Ì|Ỉ|Ĩ|Ị|Ï|Î",o:"ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ|ö",O:"Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ô|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ|Ö",u:"ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự|û",U:"Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự|Û",y:"ý|ỳ|ỷ|ỹ|ỵ",Y:"Ý|Ỳ|Ỷ|Ỹ|Ỵ"},n=(e,r)=>{t=m(t,e,r)};for(const e in r)if(u(r,e)){r[e].split("|").forEach(t=>n(t,e))}return t},b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],y=["January","February","March","April","May","June","July","August","September","October","November","December"],M=()=>new Date,j=()=>Date.now(),D=M().getTimezoneOffset(),S=(()=>{const e=Math.abs(D/60);return["GMT",D<0?"+":"-",String(e).padStart(4,"0")].join("")})(),N=e=>String(e<10?"0"+e:e),E=(e,t="D, M d, Y h:i:s A")=>{const r=l(e)?e:new Date(e);if(!l(r))throw new Error("InvalidInput: Number or Date required.");if(!o(t))throw new Error("Invalid output pattern.");const n=t.match(/(\.*)a{1}(\.*)*/i),i=b,a=y;let s={Y:()=>r.getFullYear(),y:()=>(s.Y()+"").slice(-2),F:()=>a[s.n()-1],M:()=>(s.F()+"").slice(0,3),m:()=>N(s.n()),n:()=>r.getMonth()+1,S:()=>(e=>{let t=e+" ";const r=t.charAt(t.length-2);return t="1"===r?"st":"2"===r?"nd":"3"===r?"rd":"th"})(s.j()),j:()=>r.getDate(),d:()=>N(s.j()),t:()=>new Date(s.Y(),s.n(),0).getDate(),w:()=>r.getDay(),l:()=>i[s.w()],D:()=>(s.l()+"").slice(0,3),G:()=>r.getHours(),g:()=>s.G()%12||12,h:()=>N(n?s.g():s.G()),i:()=>N(r.getMinutes()),s:()=>N(r.getSeconds()),a:()=>s.G()>11?"pm":"am",A:()=>s.a().toUpperCase(),O:()=>S};return t.replace(/\.*\\?([a-z])/gi,(e,t)=>s[e]?s[e]():t)};const I=e=>{if(l(e))return new Date(e.valueOf());const t=e=>{const t=Object.create({});for(const r in e)u(e,r)&&(t[r]=I(e[r]));return t},r=e=>[...e].map(e=>a(e)?r(e):s(e)?t(e):I(e));return a(e)?r(e):s(e)?t(e):e},A=(e,t,r=!1,n=[])=>{for(const o in e)if(!(n.length>0&&n.includes(o))&&(!r||r&&u(t,o))){const i=e[o],l=t[o];s(l)&&s(i)||a(l)&&a(i)?t[o]=A(i,t[o],r,n):t[o]=I(i)}return t},O=(e,t=[])=>[...t].sort(e),v=(e=[])=>O(()=>Math.random()>.5,[...e]);e.clone=I,e.compose=(...e)=>e.reduce((e,t)=>r=>e(t(r))),e.copies=A,e.curry=e=>{const t=e.length,r=(t,n)=>t>0?(...e)=>r(t-e.length,[...n,...e]):e(...n);return r(t,[])},e.equals=f,e.escapeHTML=e=>{return h(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},e.format=E,e.genid=(e,t="")=>{const r="abcdefghijklmnopqrstuvwxyz",n=r.toUpperCase(),o=[r,n,"0123456789"].join("").split("").sort(()=>Math.random()>.5).join(""),i=o.length,a=Math.max(e||32,t.length);let s=t;for(;s.length<a;){const e=p(0,i);s+=o.charAt(e)||""}return s},e.hasProperty=u,e.isArray=a,e.isBoolean=e=>!0===e||!1===e,e.isDate=l,e.isElement=e=>t(e).match(/^\[object HTML\w*Element]$/),e.isEmail=e=>{return o(e)&&/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(e)},e.isEmpty=c,e.isFunction=e=>"[object Function]"===t(e),e.isInteger=e=>Number.isInteger(e),e.isLetter=e=>{return o(e)&&/^[a-z]+$/i.test(e)},e.isNull=r,e.isNumber=i,e.isObject=s,e.isString=o,e.isUndefined=n,e.local=(e=j())=>{const t=l(e)?e:new Date(e);if(!l(t))throw new Error("InvalidInput: Number or Date required.");return E(t,"D, j M Y h:i:s O")},e.md5=e=>{for(var t=[],r=0;r<64;)t[r]=0|4294967296*Math.abs(Math.sin(++r));var n,o,i,a,s=[],l=unescape(encodeURI(e)),c=l.length,u=[n=1732584193,o=-271733879,~n,~o];for(r=0;r<=c;)s[r>>2]|=(l.charCodeAt(r)||128)<<r++%4*8;for(s[e=16*(c+8>>6)+14]=8*c,r=0;r<e;r+=16){for(c=u,a=0;a<64;)c=[i=c[3],(n=0|c[1])+((i=c[0]+[n&(o=c[2])|~n&i,i&n|~i&o,n^o^i,o^(n|~i)][c=a>>4]+(t[a]+(0|s[[a,5*a+1,3*a+5,7*a][c]%16+r])))<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+a++%4])|i>>>32-c),n,o];for(a=4;a;)u[--a]=u[a]+c[a]}for(e="";a<32;)e+=(u[a>>3]>>4*(1^7&a++)&15).toString(16);return e},e.now=M,e.pick=(e=1,t=[])=>{const r=v([...t]),n=Math.max(1,e),o=Math.min(n,r.length-1);return r.splice(0,o)},e.pipe=(...e)=>e.reduce((e,t)=>r=>t(e(r))),e.randint=p,e.relativize=(e=j())=>{const t=l(e)?e:new Date(e);if(!l(t))throw new Error("InvalidInput: Number or Date required.");let r=M()-t,n=parseInt(t,10);if(isNaN(n)&&(n=0),r<=n)return"Just now";let o=null;const i={millisecond:1,second:1e3,minute:60,hour:60,day:24,month:30,year:12};for(const e in i){if(r<i[e])break;o=e,r/=i[e]}return 1!==(r=Math.floor(r))&&(o+="s"),[r,o].join(" ")+" ago"},e.replaceAll=m,e.shuffle=v,e.slugify=(e,t)=>{const r=t||"-";return w(e).trim().toLowerCase().replace(/\W+/g," ").replace(/\s+/g," ").replace(/\s/g,r)},e.sort=O,e.sortBy=(e,t=1,r=[])=>O(r,(r,n)=>r[e]>n[e]?t:r[e]<n[e]?-1*t:0),e.stripAccent=w,e.stripTags=e=>{return h(e).replace(/<.*?>/gi," ").replace(/\s\s+/g," ").trim()},e.time=j,e.truncate=(e,t)=>{const r=h(e),n=t||140;if(r.length<=n)return r;let o=r.substring(0,n);const i=o.split(" ");let a="";return i.length>1?(i.pop(),(a+=i.join(" ")).length<r.length&&(a+="...")):a=(o=o.substring(0,n-3))+"...",a},e.ucfirst=d,e.ucwords=e=>{const t=h(e).split(" "),r=[];return t.forEach(e=>{r.push(d(e))}),r.join(" ")},e.unescapeHTML=e=>{return h(e).replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.unique=(e=[])=>[...new Set(e)],e.utc=(e=j())=>{const t=l(e)?e:new Date(e);if(!l(t))throw new Error("InvalidInput: Number or Date required.");const r=t.getMinutes(),n=new Date(t);return n.setMinutes(r+D),`${E(n,"D, j M Y h:i:s")} GMT+0000`},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"version": "8.0.1", | ||
"version": "8.0.2", | ||
"name": "bellajs", | ||
@@ -11,6 +11,4 @@ "description": "A useful helper for any javascript program", | ||
"author": "@ndaidong", | ||
"type": "module", | ||
"main": "./dist/bella.js", | ||
"module": "./src/main", | ||
"jsnext:main": "./src/main", | ||
"browser": "./dist/bella.min.js", | ||
@@ -28,10 +26,10 @@ "engines": { | ||
"devDependencies": { | ||
"coveralls": "^3.0.7", | ||
"coveralls": "^3.0.9", | ||
"eslint-config-goes": "^1.1.8", | ||
"gcc-min": "^7.1.5", | ||
"is": "^3.3.0", | ||
"jsdom": "^15.2.0", | ||
"jsdom": "^15.2.1", | ||
"jsdom-global": "^3.0.2", | ||
"sinon": "^7.5.0", | ||
"tap": "^14.8.2" | ||
"tap": "^14.10.4" | ||
}, | ||
@@ -38,0 +36,0 @@ "keywords": [ |
@@ -5,11 +5,11 @@ /** | ||
const { | ||
import { | ||
existsSync, | ||
readdirSync, | ||
} = require('fs'); | ||
} from 'fs'; | ||
const { | ||
import { | ||
extname, | ||
join, | ||
} = require('path'); | ||
} from 'path'; | ||
@@ -16,0 +16,0 @@ const dirs = [ |
Sorry, the diff of this file is not supported yet
97325
No