New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bellajs

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bellajs - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

6

package.json
{
"version": "3.4.2",
"version": "3.4.3",
"name": "bellajs",
"description": "A set of helpful and usual functions for browser and node.",
"description": "A small library with the useful functions for handling string, array, date, schedule and dom/event",
"homepage": "http://techpush.net",
"repository": {
"type": "git",
"url": "https://github.com/techpush/bella.js.git"
"url": "https://github.com/techpush/bella.js"
},

@@ -10,0 +10,0 @@ "author": "Dong Nguyen <ndaidong@gmail.com> (https://twitter.com/ndaidong)",

bella.js
========
A set of helpful and usual functions for browser and node.
BellaJS is a lightweight library with the useful functions for handling string, array, date, schedule and dom/event. It supports both Node.js and browser environments.
# Setup

@@ -24,11 +25,4 @@

I assume there is a file bella.min.js located at "/public/js/lib/", the following ways can be used to include BellaJS:
Assuming there is a file bella.min.js located at "/public/js/lib/", the following ways can be used to include BellaJS:
##### Script tags
```
<script type="text/javascript" src="/public/js/lib/bella.min.js"></script>
```
##### SystemJS

@@ -66,2 +60,10 @@

##### Traditional script tag
```
<script type="text/javascript" src="/public/js/lib/bella.min.js"></script>
```
# Usage

@@ -100,6 +102,5 @@

- Bella.md5(String s)
- Bella.sha1(String s)
- Bella.sha256(String s)
### Array & Object manipulation
### Array & Object
- Bella.unique(Array a)

@@ -116,16 +117,2 @@ - Bella.max(Array a)

### DOM
- Bella.dom.one(String selectors)
- Bella.dom.all(String selectors)
- Bella.dom.get(String ID)
- Bella.dom.add(Element dom)
- Bella.dom.create(Element dom)
### Event
- Bella.event.listen(String|Element s, String eventName, Function callback)
- Bella.event.ignore(String|Element s, String eventName, Function callback)
- Bella.event.simulate(String|Element s, String eventName)
- Bella.event.exit(Event e)
- Bella.event.locate(Event e)
### DateTime

@@ -176,3 +163,3 @@ - Bella.date.format(String pattern, Date|Number|String input)

Almost cases it maybe better if we use Bella.scheduler instead of setInterval or setTimeout, because it runs only one timer for the entire process. Regarding parameter "pattern" for Bella.scheduler.every, it may be:
Scheduler is the best utility BellaJS provides. Almost cases you can use Bella.scheduler instead of setInterval or setTimeout, because it runs only one timer for the entire process. Regarding parameter "pattern" for Bella.scheduler.every, it may be:

@@ -226,2 +213,27 @@ **1, A string in the format of 'Y m d H i s'.**

The following object Bella.dom, Bella.event and Bella.device are not available on Node.js environment.
### DOM & Event manipulation
- Bella.dom.one(String selectors)
- Bella.dom.all(String selectors)
- Bella.dom.get(String ID)
- Bella.dom.add(Element dom)
- Bella.dom.create(Element dom)
- Bella.event.listen(String|Element s, String eventName, Function callback)
- Bella.event.ignore(String|Element s, String eventName, Function callback)
- Bella.event.simulate(String|Element s, String eventName)
- Bella.event.exit(Event e)
- Bella.event.locate(Event e)
The HTML DOM Elements returned by Bella.dom's methods have several helpful method as below:
- hasClass(String className)
- addClass(String className)
- removeClass(String className)
- toggleClass(String className)
- html([String html])
- text([String text])
- empty()
- destroy()
## Properties

@@ -234,3 +246,2 @@

- Bella.dom, Bella.event and Bella.device are not available on Node.js environment.

@@ -237,0 +248,0 @@ ## Test with Jasmine

/**
* BellaJS v3.4.2
* BellaJS v3.4.3
* Author by @ndaidong

@@ -295,3 +295,2 @@ * GitHub : https://github.com/techpush/bella.js.git

Bella.md5 = function(){for(var m=[],l=0;64>l;)m[l]=0|4294967296*Math.abs(Math.sin(++l));return function(c){var e,g,f,a,h=[];c=unescape(encodeURI(c));for(var b=c.length,k=[e=1732584193,g=-271733879,~e,~g],d=0;d<=b;)h[d>>2]|=(c.charCodeAt(d)||128)<<8*(d++%4);h[c=16*(b+8>>6)+14]=8*b;for(d=0;d<c;d+=16){b=k;for(a=0;64>a;)b=[f=b[3],(e=b[1]|0)+((f=b[0]+[e&(g=b[2])|~e&f,f&e|~f&g,e^g^f,g^(e|~f)][b=a>>4]+(m[a]+(h[[a,5*a+1,3*a+5,7*a][b]%16+d]|0)))<<(b=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*b+a++%4])|f>>>32-b),e,g];for(a=4;a;)k[--a]=k[a]+b[a]}for(c="";32>a;)c+=(k[a>>3]>>4*(1^a++&7)&15).toString(16);return c}}();
Bella.sha1 = function(d){var l=0,a=0,f=[],b,c,g,h,p,e,m=[b=1732584193,c=4023233417,~b,~c,3285377520],n=[],k=unescape(encodeURI(d));for(b=k.length;a<=b;)n[a>>2]|=(k.charCodeAt(a)||128)<<8*(3-a++%4);for(n[d=(b+8>>6<<4)+15]=b<<3;l<=d;l+=16){b=m;for(a=0;80>a;b=[[(e=((k=b[0])<<5|k>>>27)+b[4]+(f[a]=16>a?~~n[l+a]:e<<1|e>>>31)+1518500249)+((c=b[1])&(g=b[2])|~c&(h=b[3])),p=e+(c^g^h)+341275144,e+(c&g|c&h|g&h)+882459459,p+1535694389][0|a++/20]|0,k,c<<30|c>>>2,g,h])e=f[a-3]^f[a-8]^f[a-14]^f[a-16];for(a=5;a;)m[--a]=m[a]+b[a]|0}for(d="";40>a;)d+=(m[a>>3]>>4*(7-a++%8)&15).toString(16);return d};
Bella.sha256 = function(){function e(a,b){return a>>>b|a<<32-b}for(var b=1,a,n=[],m=[];18>++b;)for(a=b*b;312>a;a+=b)m[a]=1;b=1;for(a=0;313>b;)m[++b]||(m[a]=Math.pow(b,0.5)%1*4294967296|0,n[a++]=Math.pow(b,1/3)%1*4294967296|0);return function(g){for(var l=m.slice(b=0),c=unescape(encodeURI(g)),h=[],d=c.length,k=[],f,p;b<d;)k[b>>2]|=(c.charCodeAt(b)&255)<<8*(3-b++%4);d*=8;k[d>>5]|=128<<24-d%32;k[p=(d+64>>9<<4)+15]=d;for(b=0;b<p;b+=16){for(c=l.slice(a=0,8);64>a;c[4]+=f)h[a]=16>a?k[a+b]:(e(f=h[a-2],17)^e(f,19)^f>>>10)+(h[a-7]|0)+(e(f=h[a-15],7)^e(f,18)^f>>>3)+(h[a-16]|0),c.unshift((f=(c.pop()+(e(g=c[4],6)^e(g,11)^e(g,25))+((g&c[5]^~g&c[6])+n[a])|0)+(h[a++]|0))+(e(d=c[0],2)^e(d,13)^e(d,22))+(d&c[1]^c[1]&c[2]^c[2]&d));for(a=8;a--;)l[a]=c[a]+l[a]}for(c="";63>a;)c+=(l[++a>>3]>>4*(7-a%8)&15).toString(16);return c}}();

@@ -362,7 +361,2 @@

// number
Bella.round = function(num, dec){
return Math.round(num*Math.pow(10, dec))/Math.pow(10, dec);
}
// object

@@ -423,8 +417,2 @@ Bella.inherits = Object.create;

Bella.bind = function(obj, fn){
return function () {
return fn.apply(obj, arguments);
};
}
// for browser only

@@ -431,0 +419,0 @@ if(Bella.ENV=='browser'){

/**
* BellaJS v3.4.2 - min
* BellaJS v3.4.3 - min
* Author by @ndaidong

@@ -8,29 +8,28 @@ * GitHub : https://github.com/techpush/bella.js.git

/*eslint-disable*/
;(function(v){function z(a,b){for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=c+c.toLowerCase(),d=c.length,e=b||"",f=Math.max(a||32,e.length);e.length<f;)var k=Math.floor(Math.random()*d),e=e+(c.charAt(k)||"");return e}var d={ENV:"browser"};"undefined"!=typeof module&&module.exports&&(d.ENV="node");var y=function(a){var b=Object.prototype.toString,c=typeof a;if("object"==c){if(a){if(-1!==b.call(a).indexOf("HTML")&&-1!=b.call(a).indexOf("Element"))return"element";if(a instanceof Array||!(a instanceof
;(function(v){function z(a,b){for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=c+c.toLowerCase(),d=c.length,e=b||"",g=Math.max(a||32,e.length);e.length<g;)var k=Math.floor(Math.random()*d),e=e+(c.charAt(k)||"");return e}var d={ENV:"browser"};"undefined"!=typeof module&&module.exports&&(d.ENV="node");var y=function(a){var b=Object.prototype.toString,c=typeof a;if("object"==c){if(a){if(-1!==b.call(a).indexOf("HTML")&&-1!=b.call(a).indexOf("Element"))return"element";if(a instanceof Array||!(a instanceof
Object)&&"[object Array]"==b.call(a)||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if(!(a instanceof Object||"[object Function]"!=b.call(a)&&("undefined"==typeof a.call||"undefined"==typeof a.propertyIsEnumerable||a.propertyIsEnumerable("call"))))return"function"}return"null"}return"function"==c&&"undefined"==typeof a.call?"object":c};Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,
b=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),d=c.length;return function(e){if("object"!==typeof e&&("function"!==typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f=[],k;for(k in e)a.call(e,k)&&f.push(k);if(b)for(k=0;k<d;k++)a.call(e,c[k])&&f.push(c[k]);return f}}());var A=function(a){return"undefined"!==a},B=function(a){return!a||null===a||t(a)&&0===a.length||
w(a)&&0===Object.keys(a).length},t=function(a){return null!==a&&"array"==y(a)},m=function(a){return null!==a&&"string"==typeof a},x=function(a){return!isNaN(a)&&"number"==typeof Number(a)},C=function(a){return null!==a&&"function"==y(a)},D=function(a){return null!==a&&"element"==y(a)},w=function(a){return null!==a&&"object"==typeof a};d.isDef=A;d.isNull=function(a){return null===a};d.isEmpty=B;d.isEND=function(a){return B(a)||!A(a)};d.isBoolean=function(a){return!0===a||!1===a};d.isArray=t;d.isString=
m;d.isNumber=x;d.isFunction=C;d.isElement=D;d.isObject=w;d.id=z(32);d.createId=z;d.encode=function(a){return m(a)?encodeURIComponent(a):""};d.decode=function(a){return m(a)?decodeURIComponent(a.replace(/\+/g," ")):""};d.trim=function(a){return(a&&m(a)?a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""):a)||""};d.truncate=function(a,b){if(!a||!m(a))return"...";a=d.trim(a);if(""==a)return a;var c=b||140;if(a.length<=c)return a;var q=a.substring(0,c),e=q.split(" "),f="";1<e.length?(e.pop(),f+=e.join(" "),f.length<
a.length&&(f+="...")):(q.substring(0,c-3),f+="...");return f};d.stripTags=function(a){return m(a)?a.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,""):""};d.escapeHTML=function(a){return m(a)?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""};d.unescapeHTML=function(a){return m(a)?a.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"):""};d.strtolower=function(a){return m(a)?a.toLowerCase():""};d.strtoupper=function(a){return m(a)?
a.toUpperCase():""};d.ucfirst=function(a){return m(a)?a.charAt(0).toUpperCase()+a.slice(1):""};d.ucwords=function(a){if(m(a)){var b=[];a.split(" ").forEach(function(a){b.push(d.ucfirst(a))});return b.join(" ")}return""};d.leftPad=function(a,b,c){x(a)&&(a+="");return m(a)?(a+="",b=b||2,a.length>=b?a:Array(b-a.length+1).join(c||"0")+a):""};d.rightPad=function(a,b,c){x(a)&&(a+="");return m(a)?(a+="",b=b||2,a.length>=b?a:a+Array(b-a.length+1).join(c||"0")):""};d.replaceAll=function(a,b,c){if(!m(a))return"";
x(b)&&(b+="");x(c)&&(c+="");if(m(b)&&m(c))a=a.split(b).join(c);else if(t(b)&&m(c))b.forEach(function(b){a=d.replaceAll(a,b,c)});else if(t(b)&&t(c)&&b.length===c.length){var q=b.length;if(0<q)for(var e=0;e<q;e++)a=d.replaceAll(a,b[e],c[e])}return a};d.md5=function(){for(var a=[],b=0;64>b;)a[b]=0|4294967296*Math.abs(Math.sin(++b));return function(c){var b,e,f,k,d=[];c=unescape(encodeURI(c));for(var l=c.length,g=[b=1732584193,e=-271733879,~b,~e],h=0;h<=l;)d[h>>2]|=(c.charCodeAt(h)||128)<<8*(h++%4);d[c=
16*(l+8>>6)+14]=8*l;for(h=0;h<c;h+=16){l=g;for(k=0;64>k;)l=[f=l[3],(b=l[1]|0)+((f=l[0]+[b&(e=l[2])|~b&f,f&b|~f&e,b^e^f,e^(b|~f)][l=k>>4]+(a[k]+(d[[k,5*k+1,3*k+5,7*k][l]%16+h]|0)))<<(l=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*l+k++%4])|f>>>32-l),b,e];for(k=4;k;)g[--k]=g[k]+l[k]}for(c="";32>k;)c+=(g[k>>3]>>4*(1^k++&7)&15).toString(16);return c}}();d.sha1=function(a){var b=0,c=0,d=[],e,f,k,n,l,g,h=[e=1732584193,f=4023233417,~e,~f,3285377520],r=[],p=unescape(encodeURI(a));for(e=p.length;c<=e;)r[c>>
2]|=(p.charCodeAt(c)||128)<<8*(3-c++%4);for(r[a=(e+8>>6<<4)+15]=e<<3;b<=a;b+=16){e=h;for(c=0;80>c;e=[[(g=((p=e[0])<<5|p>>>27)+e[4]+(d[c]=16>c?~~r[b+c]:g<<1|g>>>31)+1518500249)+((f=e[1])&(k=e[2])|~f&(n=e[3])),l=g+(f^k^n)+341275144,g+(f&k|f&n|k&n)+882459459,l+1535694389][0|c++/20]|0,p,f<<30|f>>>2,k,n])g=d[c-3]^d[c-8]^d[c-14]^d[c-16];for(c=5;c;)h[--c]=h[c]+e[c]|0}for(a="";40>c;)a+=(h[c>>3]>>4*(7-c++%8)&15).toString(16);return a};d.sha256=function(){function a(a,b){return a>>>b|a<<32-b}for(var b=1,c,
d=[],e=[];18>++b;)for(c=b*b;312>c;c+=b)e[c]=1;b=1;for(c=0;313>b;)e[++b]||(e[c]=Math.pow(b,.5)%1*4294967296|0,d[c++]=Math.pow(b,1/3)%1*4294967296|0);return function(f){for(var k=e.slice(b=0),n=unescape(encodeURI(f)),l=[],g=n.length,h=[],r,p;b<g;)h[b>>2]|=(n.charCodeAt(b)&255)<<8*(3-b++%4);g*=8;h[g>>5]|=128<<24-g%32;h[p=(g+64>>9<<4)+15]=g;for(b=0;b<p;b+=16){for(n=k.slice(c=0,8);64>c;n[4]+=r)l[c]=16>c?h[c+b]:(a(r=l[c-2],17)^a(r,19)^r>>>10)+(l[c-7]|0)+(a(r=l[c-15],7)^a(r,18)^r>>>3)+(l[c-16]|0),n.unshift((r=
(n.pop()+(a(f=n[4],6)^a(f,11)^a(f,25))+((f&n[5]^~f&n[6])+d[c])|0)+(l[c++]|0))+(a(g=n[0],2)^a(g,13)^a(g,22))+(g&n[1]^n[1]&n[2]^n[2]&g));for(c=8;c--;)k[c]=n[c]+k[c]}for(n="";63>c;)n+=(k[++c>>3]>>4*(7-c%8)&15).toString(16);return n}}();d.unique=function(a){if(t(a)){for(var b=[],c=0;c<a.length;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b}return a};d.max=function(a){return t(a)?Math.max.apply({},a):a};d.min=function(a){return t(a)?Math.min.apply({},a):a};d.contains=function(a,b,c){if(t(a))for(var d=
0;d<a.length;d++){var e=a[d];if(c&&e[c]===b[c]||e===b)return!0}return!1};d.msort=function(a,b){var c=b||{};if(-1===b||1===b||"asc"===b||"desc"===b)c={order:b};if(t(a)&&0<a.length&&w(c)){var d=c.sortBy||null,c=c.order||"asc",e="asc"===c||1===c?1:-1,f=!1;d&&a.filter(function(a){return a.hasOwnProperty(d)}).length===a.length&&(f=d);f?a.sort(function(a,b){return a[f]>b[f]?e:a[f]<b[f]?-1*e:0}):a.sort(function(a,b){return a>b?e:a<b?-1*e:0})}return a};d.round=function(a,b){return Math.round(a*Math.pow(10,
b))/Math.pow(10,b)};d.inherits=Object.create;d.copies=function(a,b,c,q){c=c||!1;q=q||[];for(var e in a)if(!(0<q.length&&d.contains(q,e))&&(!c||c&&b.hasOwnProperty(e))){var f=a[e],k=b[e];w(k)&&w(f)||t(k)&&t(f)?b[e]=d.copies(f,b[e],c,q):b[e]=f}return b};d.clone=function(a){if(null==a||"object"!=typeof a)return a;if(a instanceof Date){var b=new Date;b.setTime(a.getTime());return b}if(a instanceof Array){b=[];a=a.slice(0);for(var c=0,q=a.length;c<q;++c)b[c]=d.clone(a[c]);return b}if(a instanceof Object){b=
{};for(c in a)"clone"!=c&&a.hasOwnProperty(c)&&(b[c]=d.clone(a[c]));return b}return!1};d.bind=function(a,b){return function(){return b.apply(a,arguments)}};if("browser"==d.ENV){d.device=function(){function a(a){return a.test(b)}var b=navigator.userAgent.toLowerCase();return{isStandard:window.localStorage,isWebkit:-1<b.indexOf("applewebkit"),isGecko:-1<b.indexOf("gecko")&&-1==b.indexOf("khtml"),isChrome:-1<b.indexOf("applewebkit")&&-1<b.indexOf("chrome")&&-1===b.indexOf("midori"),isSafari:-1<b.indexOf("applewebkit")&&
-1==b.indexOf("chrome")&&-1===b.indexOf("midori"),isFirefox:-1<b.indexOf("gecko")&&0<b.indexOf("firefox"),isMidori:-1<b.indexOf("midori"),isIE:window.attachEvent&&!window.opera,isOpera:window.opera,isLinux:-1!=b.indexOf("linux"),isWin:-1!=b.indexOf("win"),isMac:-1!=b.indexOf("mac"),isUnix:-1!=b.indexOf("x11"),isAndroid:a(/android/i),isIOS:a(/(ipad|iphone|ipod)/i),isKindle:a(/\W(kindle|silk)\W/i),isMobile:a(/(iphone|ipod|((?:android)?.*?mobile)|blackberry|nokia)/i),isTablet:a(/(ipad|android(?!.*mobile))/i),
isTV:a(/googletv|sonydtv/i),isIPad:a(/ipad/i),isIPhone:a(/iphone/i),isIPod:a(/ipod/i),isWPhone:a(/iemobile/i)}}();var u=function(a){var b=(m(a)?document.getElementById(a):a)||null;b&&D(b)&&(b.hasClass=function(a){var b=!0,d=this.className.split(" ");a=a.split(" ");for(var f=0;f<a.length;f++)if(-1===d.indexOf(a[f])){b=!1;break}return b},b.addClass=function(a){a=a.split(" ");var b=this.className.split(" ");a=a.concat(b);this.className=d.unique(a).join(" ");return this},b.removeClass=function(a){var b=
this.className.split(" ");a=a.split(" ");for(var d=0;d<a.length;d++)this.hasClass(a[d])&&b.splice(b.indexOf(a[d]),1);this.className=b.join(" ");return this},b.toggleClass=function(a){b.hasClass(a)?b.removeClass(a):b.addClass(a);return this},b.empty=function(){for(;b.firstChild;)b.removeChild(b.firstChild);return b},b.html=function(a){if(!a)return b.innerHTML;b.innerHTML=a;return b},b.text=function(a){if(!a)return b.innerText||b.textContent;b.innerText?b.innerText=a:b.textContent&&(b.textContent=a);
return b},b.destroy=function(){this.parentNode&&this.parentNode.removeChild(this)});return b};d.dom={one:function(a){var b=null;(a=document.querySelector(a))&&(b=u(a));return b},all:function(a){var b=[];if(a=document.querySelectorAll(a))for(var c=0;c<a.length;c++)b.push(u(a[c]));return b},get:u,add:function(a,b){var c=b?d.element(b):document.body,q=document.createElement(a);c.appendChild(q);return u(q)},create:function(a){return u(document.createElement(a))}};d.event=function(){return{listen:function(a,
b,c){"wheel"==b&&(b=d.device.isFirefox?"DOMMouseScroll":"mousewheel");a=m(a)?u(a):a;c=c||function(){};a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},ignore:function(a,b,c){a=m(a)?u(a):a;a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},simulate:function(a,b){var c,d=m(a)?u(a):a;document.createEventObject?(c=document.createEventObject(),d.fireEvent("on"+b,c)):(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0),
d.dispatchEvent(c))},exit:function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();return!1},locate:function(a){a=a||window.event;(a=a.target||a.srcElement)&&3==a.nodeType&&(a=a.parentNode);return u(a)}}}()}d.now=function(){return new Date};d.time=function(){return(new Date).getTime()};d.date=function(){var a="D, M d, Y H:i:s A",b="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),c="January February March April May June July August September October November December".split(" "),
q=function(){var a=(new Date).getTimezoneOffset(),b=Math.abs(a/60);return["GMT",0>a?"+":"-",d.leftPad(b,2)].join("")}(),e=function(f,e){var n=!1,l,g;e=e?(new Date(e)).getTime():d.time();f||(f=a);var h=function(a){return""+(10>a?"0"+a:a)};l=e instanceof Date?e:new Date(e);if(isNaN(l.getTime()))if(/^(\d+-\d+-\d+)\s(\d+:\d+:\d+)$/i.test(e))l=new Date(e.replace(" ","T"));else return e+" !";if(0<f.indexOf("a")||0<f.indexOf("A"))n=!0;g={Y:function(){return l.getFullYear()},y:function(){return(g.Y()+"").slice(-2)},
F:function(){return c[g.n()-1]},M:function(){return(g.F()+"").slice(0,3)},m:function(){return h(g.n())},n:function(){return l.getMonth()+1},S:function(){var a=g.j()+" ",b=a.charAt(a.length-2);return"1"===b?a+"st":"2"===b?a+"nd":"3"===b?a+"rd":a+"th"},j:function(){return l.getDate()},d:function(){return h(g.j())},t:function(){return(new Date(g.Y(),g.n(),0)).getDate()},w:function(){return l.getDay()},l:function(){return b[g.w()]},D:function(){return(g.l()+"").slice(0,3)},G:function(){return l.getHours()},
g:function(){return g.G()%12||12},h:function(){return h(g.g())},H:function(){return n?g.h():h(g.G())},i:function(){return h(l.getMinutes())},s:function(){return h(l.getSeconds())},a:function(){return 11<g.G()?"pm":"am"},A:function(){return g.a().toUpperCase()},O:function(){return q}};return f.replace(/\.*\\?([a-z])/gi,function(a,b){return g[a]?g[a]():b})};return{pattern:function(b){return b?a=b:a},utc:function(a){return(new Date(a||d.now())).toUTCString()},local:function(a){return e("D, j M Y H:i:s O",
a)},strtotime:function(a){return(new Date(a)).getTime()},format:e,relativize:function(a){var b=a instanceof Date?a:new Date(a);a=new Date-b;b=parseInt(b,10);isNaN(b)&&(b=0);if(a<=b)return"Just now";var b=null,c={millisecond:1,second:1E3,minute:60,hour:60,day:24,month:30,year:12},d;for(d in c)if(a<c[d])break;else b=d,a/=c[d];a=Math.floor(a);1!==a&&(b+="s");return[a,b].join(" ")+" ago"}}}();d.scheduler=function(){function a(){var a=d.time(),b=Math.round(a/1E3),k=d.date.format("Y m d H i s",a),a=d.date.format("l",
a);if(0<c.length)for(var n=c.length-1;0<=n;n--){var l=c[n],g;g=k;var h=a,r=b,p=l.time,m=Math.round(l.at/1E3);if(p.match(/^(sun|mon|tue|wed|thu|fri|sat)+(\w+)?(\s+)+(\d+(:\d)?)+$/gi)){p=p.split(" ");r=!1;if(1<p.length&&(m=d.trim(p[0]),p=d.trim(p[1]),h.match(new RegExp(m,"gi"))))for(h=p.split(":"),1===h.length&&(h=h.concat(["00","00"])),2===h.length&&(h=h.concat(["00"])),g=g.split(" ").slice(3,6),r=!0,m=0;m<g.length;m++)if(parseInt(g[m],10)!==parseInt(h[m],10)){r=!1;break}g=r}else if(p.match(/(d|h|m|s)/gi))g=
parseInt(p,10),p=p.replace(g,""),h=0,"s"===p?h=1:"m"===p?h=60:"h"===p?h=3600:"d"===p&&(h=86400),h*=g,g=r-m,g=0<h&&0===g%h;else{h=p.split(" ");g=g.split(" ");m=r="";for(p=0;p<h.length;p++)"*"===h[p]&&(g[p]="*"),r+=h[p],m+=g[p];g=r===m}g&&(l.fn(),l.repeat||c.splice(n,1))}else clearInterval(q),q=null}function b(b,f,k){k=k||!1;c.push({fn:f,time:b,at:d.time(),repeat:!k});q||(q=setInterval(a,1E3))}var c=[],q;return{yearly:function(a,c){b("* "+a,c)},monthly:function(a,c){b("* * "+a,c)},daily:function(a,
c){b("* * * "+a,c)},hourly:function(a,c){b("* * * * "+a,c)},every:function(a,c){b(a,c)},once:function(a,c){b(a,c,!0)}}}();"node"===d.ENV?module.exports=d:(v=v||window,C(v.define)&&v.define.amd&&v.define(function(){return d}),v.Bella=d)})();
b=!{toString:null}.propertyIsEnumerable("toString"),c="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),d=c.length;return function(e){if("object"!==typeof e&&("function"!==typeof e||null===e))throw new TypeError("Object.keys called on non-object");var g=[],k;for(k in e)a.call(e,k)&&g.push(k);if(b)for(k=0;k<d;k++)a.call(e,c[k])&&g.push(c[k]);return g}}());var A=function(a){return"undefined"!==a},B=function(a){return!a||null===a||q(a)&&0===a.length||
w(a)&&0===Object.keys(a).length},q=function(a){return null!==a&&"array"==y(a)},n=function(a){return null!==a&&"string"==typeof a},x=function(a){return!isNaN(a)&&"number"==typeof Number(a)},C=function(a){return null!==a&&"function"==y(a)},D=function(a){return null!==a&&"element"==y(a)},w=function(a){return null!==a&&"object"==typeof a};d.isDef=A;d.isNull=function(a){return null===a};d.isEmpty=B;d.isEND=function(a){return B(a)||!A(a)};d.isBoolean=function(a){return!0===a||!1===a};d.isArray=q;d.isString=
n;d.isNumber=x;d.isFunction=C;d.isElement=D;d.isObject=w;d.id=z(32);d.createId=z;d.encode=function(a){return n(a)?encodeURIComponent(a):""};d.decode=function(a){return n(a)?decodeURIComponent(a.replace(/\+/g," ")):""};d.trim=function(a){return(a&&n(a)?a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""):a)||""};d.truncate=function(a,b){if(!a||!n(a))return"...";a=d.trim(a);if(""==a)return a;var c=b||140;if(a.length<=c)return a;var r=a.substring(0,c),e=r.split(" "),g="";1<e.length?(e.pop(),g+=e.join(" "),g.length<
a.length&&(g+="...")):(r.substring(0,c-3),g+="...");return g};d.stripTags=function(a){return n(a)?a.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,""):""};d.escapeHTML=function(a){return n(a)?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""};d.unescapeHTML=function(a){return n(a)?a.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"):""};d.strtolower=function(a){return n(a)?a.toLowerCase():""};d.strtoupper=function(a){return n(a)?
a.toUpperCase():""};d.ucfirst=function(a){return n(a)?a.charAt(0).toUpperCase()+a.slice(1):""};d.ucwords=function(a){if(n(a)){var b=[];a.split(" ").forEach(function(a){b.push(d.ucfirst(a))});return b.join(" ")}return""};d.leftPad=function(a,b,c){x(a)&&(a+="");return n(a)?(a+="",b=b||2,a.length>=b?a:Array(b-a.length+1).join(c||"0")+a):""};d.rightPad=function(a,b,c){x(a)&&(a+="");return n(a)?(a+="",b=b||2,a.length>=b?a:a+Array(b-a.length+1).join(c||"0")):""};d.replaceAll=function(a,b,c){if(!n(a))return"";
x(b)&&(b+="");x(c)&&(c+="");if(n(b)&&n(c))a=a.split(b).join(c);else if(q(b)&&n(c))b.forEach(function(b){a=d.replaceAll(a,b,c)});else if(q(b)&&q(c)&&b.length===c.length){var r=b.length;if(0<r)for(var e=0;e<r;e++)a=d.replaceAll(a,b[e],c[e])}return a};d.md5=function(){for(var a=[],b=0;64>b;)a[b]=0|4294967296*Math.abs(Math.sin(++b));return function(b){var d,e,g,k,m=[];b=unescape(encodeURI(b));for(var l=b.length,f=[d=1732584193,e=-271733879,~d,~e],h=0;h<=l;)m[h>>2]|=(b.charCodeAt(h)||128)<<8*(h++%4);m[b=
16*(l+8>>6)+14]=8*l;for(h=0;h<b;h+=16){l=f;for(k=0;64>k;)l=[g=l[3],(d=l[1]|0)+((g=l[0]+[d&(e=l[2])|~d&g,g&d|~g&e,d^e^g,e^(d|~g)][l=k>>4]+(a[k]+(m[[k,5*k+1,3*k+5,7*k][l]%16+h]|0)))<<(l=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*l+k++%4])|g>>>32-l),d,e];for(k=4;k;)f[--k]=f[k]+l[k]}for(b="";32>k;)b+=(f[k>>3]>>4*(1^k++&7)&15).toString(16);return b}}();d.sha256=function(){function a(a,b){return a>>>b|a<<32-b}for(var b=1,c,d=[],e=[];18>++b;)for(c=b*b;312>c;c+=b)e[c]=1;b=1;for(c=0;313>b;)e[++b]||(e[c]=
Math.pow(b,.5)%1*4294967296|0,d[c++]=Math.pow(b,1/3)%1*4294967296|0);return function(g){for(var k=e.slice(b=0),m=unescape(encodeURI(g)),l=[],f=m.length,h=[],u,p;b<f;)h[b>>2]|=(m.charCodeAt(b)&255)<<8*(3-b++%4);f*=8;h[f>>5]|=128<<24-f%32;h[p=(f+64>>9<<4)+15]=f;for(b=0;b<p;b+=16){for(m=k.slice(c=0,8);64>c;m[4]+=u)l[c]=16>c?h[c+b]:(a(u=l[c-2],17)^a(u,19)^u>>>10)+(l[c-7]|0)+(a(u=l[c-15],7)^a(u,18)^u>>>3)+(l[c-16]|0),m.unshift((u=(m.pop()+(a(g=m[4],6)^a(g,11)^a(g,25))+((g&m[5]^~g&m[6])+d[c])|0)+(l[c++]|
0))+(a(f=m[0],2)^a(f,13)^a(f,22))+(f&m[1]^m[1]&m[2]^m[2]&f));for(c=8;c--;)k[c]=m[c]+k[c]}for(m="";63>c;)m+=(k[++c>>3]>>4*(7-c%8)&15).toString(16);return m}}();d.unique=function(a){if(q(a)){for(var b=[],c=0;c<a.length;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b}return a};d.max=function(a){return q(a)?Math.max.apply({},a):a};d.min=function(a){return q(a)?Math.min.apply({},a):a};d.contains=function(a,b,c){if(q(a))for(var d=0;d<a.length;d++){var e=a[d];if(c&&e[c]===b[c]||e===b)return!0}return!1};
d.msort=function(a,b){var c=b||{};if(-1===b||1===b||"asc"===b||"desc"===b)c={order:b};if(q(a)&&0<a.length&&w(c)){var d=c.sortBy||null,c=c.order||"asc",e="asc"===c||1===c?1:-1,g=!1;d&&a.filter(function(a){return a.hasOwnProperty(d)}).length===a.length&&(g=d);g?a.sort(function(a,b){return a[g]>b[g]?e:a[g]<b[g]?-1*e:0}):a.sort(function(a,b){return a>b?e:a<b?-1*e:0})}return a};d.inherits=Object.create;d.copies=function(a,b,c,r){c=c||!1;r=r||[];for(var e in a)if(!(0<r.length&&d.contains(r,e))&&(!c||c&&
b.hasOwnProperty(e))){var g=a[e],k=b[e];w(k)&&w(g)||q(k)&&q(g)?b[e]=d.copies(g,b[e],c,r):b[e]=g}return b};d.clone=function(a){if(null==a||"object"!=typeof a)return a;if(a instanceof Date){var b=new Date;b.setTime(a.getTime());return b}if(a instanceof Array){b=[];a=a.slice(0);for(var c=0,r=a.length;c<r;++c)b[c]=d.clone(a[c]);return b}if(a instanceof Object){b={};for(c in a)"clone"!=c&&a.hasOwnProperty(c)&&(b[c]=d.clone(a[c]));return b}return!1};if("browser"==d.ENV){d.device=function(){function a(a){return a.test(b)}
var b=navigator.userAgent.toLowerCase();return{isStandard:window.localStorage,isWebkit:-1<b.indexOf("applewebkit"),isGecko:-1<b.indexOf("gecko")&&-1==b.indexOf("khtml"),isChrome:-1<b.indexOf("applewebkit")&&-1<b.indexOf("chrome")&&-1===b.indexOf("midori"),isSafari:-1<b.indexOf("applewebkit")&&-1==b.indexOf("chrome")&&-1===b.indexOf("midori"),isFirefox:-1<b.indexOf("gecko")&&0<b.indexOf("firefox"),isMidori:-1<b.indexOf("midori"),isIE:window.attachEvent&&!window.opera,isOpera:window.opera,isLinux:-1!=
b.indexOf("linux"),isWin:-1!=b.indexOf("win"),isMac:-1!=b.indexOf("mac"),isUnix:-1!=b.indexOf("x11"),isAndroid:a(/android/i),isIOS:a(/(ipad|iphone|ipod)/i),isKindle:a(/\W(kindle|silk)\W/i),isMobile:a(/(iphone|ipod|((?:android)?.*?mobile)|blackberry|nokia)/i),isTablet:a(/(ipad|android(?!.*mobile))/i),isTV:a(/googletv|sonydtv/i),isIPad:a(/ipad/i),isIPhone:a(/iphone/i),isIPod:a(/ipod/i),isWPhone:a(/iemobile/i)}}();var t=function(a){var b=(n(a)?document.getElementById(a):a)||null;b&&D(b)&&(b.hasClass=
function(a){var b=!0,d=this.className.split(" ");a=a.split(" ");for(var g=0;g<a.length;g++)if(-1===d.indexOf(a[g])){b=!1;break}return b},b.addClass=function(a){a=a.split(" ");var b=this.className.split(" ");a=a.concat(b);this.className=d.unique(a).join(" ");return this},b.removeClass=function(a){var b=this.className.split(" ");a=a.split(" ");for(var d=0;d<a.length;d++)this.hasClass(a[d])&&b.splice(b.indexOf(a[d]),1);this.className=b.join(" ");return this},b.toggleClass=function(a){b.hasClass(a)?b.removeClass(a):
b.addClass(a);return this},b.empty=function(){for(;b.firstChild;)b.removeChild(b.firstChild);return b},b.html=function(a){if(!a)return b.innerHTML;b.innerHTML=a;return b},b.text=function(a){if(!a)return b.innerText||b.textContent;b.innerText?b.innerText=a:b.textContent&&(b.textContent=a);return b},b.destroy=function(){this.parentNode&&this.parentNode.removeChild(this)});return b};d.dom={one:function(a){var b=null;(a=document.querySelector(a))&&(b=t(a));return b},all:function(a){var b=[];if(a=document.querySelectorAll(a))for(var c=
0;c<a.length;c++)b.push(t(a[c]));return b},get:t,add:function(a,b){var c=b?d.element(b):document.body,r=document.createElement(a);c.appendChild(r);return t(r)},create:function(a){return t(document.createElement(a))}};d.event=function(){return{listen:function(a,b,c){"wheel"==b&&(b=d.device.isFirefox?"DOMMouseScroll":"mousewheel");a=n(a)?t(a):a;c=c||function(){};a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},ignore:function(a,b,c){a=n(a)?t(a):a;a.removeEventListener?
a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},simulate:function(a,b){var c,d=n(a)?t(a):a;document.createEventObject?(c=document.createEventObject(),d.fireEvent("on"+b,c)):(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0),d.dispatchEvent(c))},exit:function(a){a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();return!1},locate:function(a){a=a||window.event;(a=a.target||a.srcElement)&&3==a.nodeType&&(a=a.parentNode);return t(a)}}}()}d.now=
function(){return new Date};d.time=function(){return(new Date).getTime()};d.date=function(){var a="D, M d, Y H:i:s A",b="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),c="January February March April May June July August September October November December".split(" "),r=function(){var a=(new Date).getTimezoneOffset(),b=Math.abs(a/60);return["GMT",0>a?"+":"-",d.leftPad(b,2)].join("")}(),e=function(g,e){var m=!1,l,f;e=e?(new Date(e)).getTime():d.time();g||(g=a);var h=function(a){return""+
(10>a?"0"+a:a)};l=e instanceof Date?e:new Date(e);if(isNaN(l.getTime()))if(/^(\d+-\d+-\d+)\s(\d+:\d+:\d+)$/i.test(e))l=new Date(e.replace(" ","T"));else return e+" !";if(0<g.indexOf("a")||0<g.indexOf("A"))m=!0;f={Y:function(){return l.getFullYear()},y:function(){return(f.Y()+"").slice(-2)},F:function(){return c[f.n()-1]},M:function(){return(f.F()+"").slice(0,3)},m:function(){return h(f.n())},n:function(){return l.getMonth()+1},S:function(){var a=f.j()+" ",b=a.charAt(a.length-2);return"1"===b?a+"st":
"2"===b?a+"nd":"3"===b?a+"rd":a+"th"},j:function(){return l.getDate()},d:function(){return h(f.j())},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},w:function(){return l.getDay()},l:function(){return b[f.w()]},D:function(){return(f.l()+"").slice(0,3)},G:function(){return l.getHours()},g:function(){return f.G()%12||12},h:function(){return h(f.g())},H:function(){return m?f.h():h(f.G())},i:function(){return h(l.getMinutes())},s:function(){return h(l.getSeconds())},a:function(){return 11<f.G()?
"pm":"am"},A:function(){return f.a().toUpperCase()},O:function(){return r}};return g.replace(/\.*\\?([a-z])/gi,function(a,b){return f[a]?f[a]():b})};return{pattern:function(b){return b?a=b:a},utc:function(a){return(new Date(a||d.now())).toUTCString()},local:function(a){return e("D, j M Y H:i:s O",a)},strtotime:function(a){return(new Date(a)).getTime()},format:e,relativize:function(a){var b=a instanceof Date?a:new Date(a);a=new Date-b;b=parseInt(b,10);isNaN(b)&&(b=0);if(a<=b)return"Just now";var b=
null,c={millisecond:1,second:1E3,minute:60,hour:60,day:24,month:30,year:12},d;for(d in c)if(a<c[d])break;else b=d,a/=c[d];a=Math.floor(a);1!==a&&(b+="s");return[a,b].join(" ")+" ago"}}}();d.scheduler=function(){function a(){var a=d.time(),b=Math.round(a/1E3),k=d.date.format("Y m d H i s",a),a=d.date.format("l",a);if(0<c.length)for(var m=c.length-1;0<=m;m--){var l=c[m],f;f=k;var h=a,n=b,p=l.time,q=Math.round(l.at/1E3);if(p.match(/^(sun|mon|tue|wed|thu|fri|sat)+(\w+)?(\s+)+(\d+(:\d)?)+$/gi)){p=p.split(" ");
n=!1;if(1<p.length&&(q=d.trim(p[0]),p=d.trim(p[1]),h.match(new RegExp(q,"gi"))))for(h=p.split(":"),1===h.length&&(h=h.concat(["00","00"])),2===h.length&&(h=h.concat(["00"])),f=f.split(" ").slice(3,6),n=!0,q=0;q<f.length;q++)if(parseInt(f[q],10)!==parseInt(h[q],10)){n=!1;break}f=n}else if(p.match(/(d|h|m|s)/gi))f=parseInt(p,10),p=p.replace(f,""),h=0,"s"===p?h=1:"m"===p?h=60:"h"===p?h=3600:"d"===p&&(h=86400),h*=f,f=n-q,f=0<h&&0===f%h;else{h=p.split(" ");f=f.split(" ");q=n="";for(p=0;p<h.length;p++)"*"===
h[p]&&(f[p]="*"),n+=h[p],q+=f[p];f=n===q}f&&(l.fn(),l.repeat||c.splice(m,1))}else clearInterval(r),r=null}function b(b,g,k){k=k||!1;c.push({fn:g,time:b,at:d.time(),repeat:!k});r||(r=setInterval(a,1E3))}var c=[],r;return{yearly:function(a,c){b("* "+a,c)},monthly:function(a,c){b("* * "+a,c)},daily:function(a,c){b("* * * "+a,c)},hourly:function(a,c){b("* * * * "+a,c)},every:function(a,c){b(a,c)},once:function(a,c){b(a,c,!0)}}}();"node"===d.ENV?module.exports=d:(v=v||window,C(v.define)&&v.define.amd&&
v.define(function(){return d}),v.Bella=d)})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc