@bbn/bbn 1.0.421 → 1.0.423
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/datetime/getChrono.d.ts +12 -0
- package/dist/fn/datetime/getChrono.js +17 -0
- package/dist/fn/datetime/startChrono.js +0 -3
- package/dist/fn/init.js +6 -4
- package/dist/fn/object/filter.js +1 -1
- package/dist/fn/type/isDataURL.d.ts +16 -0
- package/dist/fn/type/isDataURL.js +31 -0
- package/dist/fn.d.ts +4 -0
- package/dist/fn.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts a timer and gives it a name.
|
|
3
|
+
* @method getChrono
|
|
4
|
+
* @global
|
|
5
|
+
* ``` javascript
|
|
6
|
+
* bbn.fn.getChrono('myChrono');
|
|
7
|
+
* ```
|
|
8
|
+
* @memberof bbn.fn
|
|
9
|
+
*
|
|
10
|
+
* @returns {Number} The elapsed time in milliseconds since the timer was started
|
|
11
|
+
*/
|
|
12
|
+
export default function getChrono(name?: string): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts a timer and gives it a name.
|
|
3
|
+
* @method getChrono
|
|
4
|
+
* @global
|
|
5
|
+
* ``` javascript
|
|
6
|
+
* bbn.fn.getChrono('myChrono');
|
|
7
|
+
* ```
|
|
8
|
+
* @memberof bbn.fn
|
|
9
|
+
*
|
|
10
|
+
* @returns {Number} The elapsed time in milliseconds since the timer was started
|
|
11
|
+
*/
|
|
12
|
+
export default function getChrono(name) {
|
|
13
|
+
if (name === void 0) { name = 'default'; }
|
|
14
|
+
var now = bbn.fn.microtimestamp();
|
|
15
|
+
return now - this.constructor.chronos[name];
|
|
16
|
+
}
|
|
17
|
+
;
|
package/dist/fn/init.js
CHANGED
|
@@ -8,6 +8,7 @@ import resize from './style/resize.js';
|
|
|
8
8
|
import isMobile from './browser/isMobile.js';
|
|
9
9
|
import isTabletDevice from './browser/isTabletDevice.js';
|
|
10
10
|
import isFunction from './type/isFunction.js';
|
|
11
|
+
import isDataURL from './type/isDataURL.js';
|
|
11
12
|
import log from './browser/log.js';
|
|
12
13
|
import timestamp from './datetime/timestamp.js';
|
|
13
14
|
/**
|
|
@@ -129,10 +130,11 @@ export default function init(cfg, force) {
|
|
|
129
130
|
target = null;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
if (target instanceof HTMLElement
|
|
133
|
-
target.hasAttribute("href")
|
|
134
|
-
!target.
|
|
135
|
-
!target.
|
|
133
|
+
if (target instanceof HTMLElement
|
|
134
|
+
&& target.hasAttribute("href")
|
|
135
|
+
&& !isDataURL(target.getAttribute("href"))
|
|
136
|
+
&& !target.hasAttribute("target")
|
|
137
|
+
&& !target.classList.contains("bbn-no")) {
|
|
136
138
|
e.preventDefault();
|
|
137
139
|
e.stopPropagation();
|
|
138
140
|
link(target.getAttribute("href"));
|
package/dist/fn/object/filter.js
CHANGED
|
@@ -61,7 +61,6 @@ export default function filter(arr, prop, val, operator) {
|
|
|
61
61
|
if (!prop || !arr.length) {
|
|
62
62
|
return arr;
|
|
63
63
|
}
|
|
64
|
-
bbn.env._enumerated.push(true);
|
|
65
64
|
if (typeof prop === 'object') {
|
|
66
65
|
operator = val;
|
|
67
66
|
cfg = prop;
|
|
@@ -72,6 +71,7 @@ export default function filter(arr, prop, val, operator) {
|
|
|
72
71
|
else if (!isFn) {
|
|
73
72
|
throw new Error('Search function error: The prop argument should be a string or an object');
|
|
74
73
|
}
|
|
74
|
+
bbn.env._enumerated.push(true);
|
|
75
75
|
if (typeof (prop) === 'function') {
|
|
76
76
|
for (var i = 0; i < arr.length; i++) {
|
|
77
77
|
if (prop(arr[i], i)) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the given argument is a date object.
|
|
3
|
+
* @method isDataURL
|
|
4
|
+
* @global
|
|
5
|
+
* @example
|
|
6
|
+
* ```javascript
|
|
7
|
+
* console.log(isDataURL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...")); // true
|
|
8
|
+
* console.log(isDataURL("data:text/plain,HelloWorld")); // true
|
|
9
|
+
* console.log(isDataURL("https://example.com/image.png")); // false
|
|
10
|
+
* console.log(isDataURL("data:,Hello%2C%20World!")); // true
|
|
11
|
+
* console.log(isDataURL("data:image/png;xyz,")); // false
|
|
12
|
+
* ```
|
|
13
|
+
* @memberof bbn.fn
|
|
14
|
+
* @returns {Boolean}
|
|
15
|
+
*/
|
|
16
|
+
export default function isDataURL(...args: any[]): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the given argument is a date object.
|
|
3
|
+
* @method isDataURL
|
|
4
|
+
* @global
|
|
5
|
+
* @example
|
|
6
|
+
* ```javascript
|
|
7
|
+
* console.log(isDataURL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...")); // true
|
|
8
|
+
* console.log(isDataURL("data:text/plain,HelloWorld")); // true
|
|
9
|
+
* console.log(isDataURL("https://example.com/image.png")); // false
|
|
10
|
+
* console.log(isDataURL("data:,Hello%2C%20World!")); // true
|
|
11
|
+
* console.log(isDataURL("data:image/png;xyz,")); // false
|
|
12
|
+
* ```
|
|
13
|
+
* @memberof bbn.fn
|
|
14
|
+
* @returns {Boolean}
|
|
15
|
+
*/
|
|
16
|
+
export default function isDataURL() {
|
|
17
|
+
var args = [];
|
|
18
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
19
|
+
args[_i] = arguments[_i];
|
|
20
|
+
}
|
|
21
|
+
if (!args.length)
|
|
22
|
+
return false;
|
|
23
|
+
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
|
24
|
+
var a = args_1[_a];
|
|
25
|
+
if (!/^data:([a-z]+\/[a-z0-9\-\+\.]+(;[a-z\-]+\=[a-z0-9\-\.]+)?)?(;base64)?,/i.test(a)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
;
|
package/dist/fn.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ import getAncestors from './fn/html/getAncestors.js';
|
|
|
94
94
|
import getAttributes from './fn/html/getAttributes.js';
|
|
95
95
|
import getBrowserName from './fn/browser/getBrowserName.js';
|
|
96
96
|
import getBrowserVersion from './fn/browser/getBrowserVersion.js';
|
|
97
|
+
import getChrono from './fn/datetime/getChrono.js';
|
|
97
98
|
import getCookie from './fn/browser/getCookie.js';
|
|
98
99
|
import getCssVar from './fn/style/getCssVar.js';
|
|
99
100
|
import getDay from './fn/datetime/getDay.js';
|
|
@@ -131,6 +132,7 @@ import isCanvas from './fn/type/isCanvas.js';
|
|
|
131
132
|
import isColor from './fn/type/isColor.js';
|
|
132
133
|
import isComment from './fn/type/isComment.js';
|
|
133
134
|
import isCp from './fn/type/isCp.js';
|
|
135
|
+
import isDataURL from './fn/type/isDataURL.js';
|
|
134
136
|
import isDate from './fn/type/isDate.js';
|
|
135
137
|
import isDesktopDevice from './fn/browser/isDesktopDevice.js';
|
|
136
138
|
import isDimension from './fn/type/isDimension.js';
|
|
@@ -338,6 +340,7 @@ declare const _default: {
|
|
|
338
340
|
getAttributes: typeof getAttributes;
|
|
339
341
|
getBrowserName: typeof getBrowserName;
|
|
340
342
|
getBrowserVersion: typeof getBrowserVersion;
|
|
343
|
+
getChrono: typeof getChrono;
|
|
341
344
|
getCookie: typeof getCookie;
|
|
342
345
|
getCssVar: typeof getCssVar;
|
|
343
346
|
getDay: typeof getDay;
|
|
@@ -375,6 +378,7 @@ declare const _default: {
|
|
|
375
378
|
isColor: typeof isColor;
|
|
376
379
|
isComment: typeof isComment;
|
|
377
380
|
isCp: typeof isCp;
|
|
381
|
+
isDataURL: typeof isDataURL;
|
|
378
382
|
isDate: typeof isDate;
|
|
379
383
|
isDesktopDevice: typeof isDesktopDevice;
|
|
380
384
|
isDimension: typeof isDimension;
|
package/dist/fn.js
CHANGED
|
@@ -94,6 +94,7 @@ import getAncestors from './fn/html/getAncestors.js';
|
|
|
94
94
|
import getAttributes from './fn/html/getAttributes.js';
|
|
95
95
|
import getBrowserName from './fn/browser/getBrowserName.js';
|
|
96
96
|
import getBrowserVersion from './fn/browser/getBrowserVersion.js';
|
|
97
|
+
import getChrono from './fn/datetime/getChrono.js';
|
|
97
98
|
import getCookie from './fn/browser/getCookie.js';
|
|
98
99
|
import getCssVar from './fn/style/getCssVar.js';
|
|
99
100
|
import getDay from './fn/datetime/getDay.js';
|
|
@@ -131,6 +132,7 @@ import isCanvas from './fn/type/isCanvas.js';
|
|
|
131
132
|
import isColor from './fn/type/isColor.js';
|
|
132
133
|
import isComment from './fn/type/isComment.js';
|
|
133
134
|
import isCp from './fn/type/isCp.js';
|
|
135
|
+
import isDataURL from './fn/type/isDataURL.js';
|
|
134
136
|
import isDate from './fn/type/isDate.js';
|
|
135
137
|
import isDesktopDevice from './fn/browser/isDesktopDevice.js';
|
|
136
138
|
import isDimension from './fn/type/isDimension.js';
|
|
@@ -338,6 +340,7 @@ export default {
|
|
|
338
340
|
getAttributes: getAttributes,
|
|
339
341
|
getBrowserName: getBrowserName,
|
|
340
342
|
getBrowserVersion: getBrowserVersion,
|
|
343
|
+
getChrono: getChrono,
|
|
341
344
|
getCookie: getCookie,
|
|
342
345
|
getCssVar: getCssVar,
|
|
343
346
|
getDay: getDay,
|
|
@@ -375,6 +378,7 @@ export default {
|
|
|
375
378
|
isColor: isColor,
|
|
376
379
|
isComment: isComment,
|
|
377
380
|
isCp: isCp,
|
|
381
|
+
isDataURL: isDataURL,
|
|
378
382
|
isDate: isDate,
|
|
379
383
|
isDesktopDevice: isDesktopDevice,
|
|
380
384
|
isDimension: isDimension,
|