@blackbyte/sugar 1.0.0-beta.13 → 1.0.0-beta.16

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.
@@ -17,5 +17,6 @@ import whenRemoved from './whenRemoved.js';
17
17
  import whenScriptLoaded from './whenScriptLoaded.js';
18
18
  import whenStylesheetsReady from './whenStylesheetsReady.js';
19
19
  import whenTransitionEnd from './whenTransitionEnd.js';
20
+ import whenVideoReady from './whenVideoReady.js';
20
21
  import whenVisible from './whenVisible.js';
21
- export { when as __when, whenAnimationEnd as __whenAnimationEnd, whenAttribute as __whenAttribute, whenBackgroundImageLoaded as __whenBackgroundImageLoaded, whenDomReady as __whenDomReady, whenEntersViewport as __whenEntersViewport, whenEventListener as __whenEventListener, whenIframeReady as __whenIframeReady, whenImageLoaded as __whenImageLoaded, whenImagesLoaded as __whenImagesLoaded, whenInteract as __whenInteract, whenInViewport as __whenInViewport, whenLinkLoaded as __whenLinkLoaded, whenNearViewport as __whenNearViewport, whenOutOfViewport as __whenOutOfViewport, whenRemoved as __whenRemoved, whenScriptLoaded as __whenScriptLoaded, whenStylesheetsReady as __whenStylesheetsReady, whenTransitionEnd as __whenTransitionEnd, whenVisible as __whenVisible, when, whenAnimationEnd, whenAttribute, whenBackgroundImageLoaded, whenDomReady, whenEntersViewport, whenEventListener, whenIframeReady, whenImageLoaded, whenImagesLoaded, whenInteract, whenInViewport, whenLinkLoaded, whenNearViewport, whenOutOfViewport, whenRemoved, whenScriptLoaded, whenStylesheetsReady, whenTransitionEnd, WhenTriggers, whenVisible, };
22
+ export { when as __when, whenAnimationEnd as __whenAnimationEnd, whenAttribute as __whenAttribute, whenBackgroundImageLoaded as __whenBackgroundImageLoaded, whenDomReady as __whenDomReady, whenEntersViewport as __whenEntersViewport, whenEventListener as __whenEventListener, whenIframeReady as __whenIframeReady, whenImageLoaded as __whenImageLoaded, whenImagesLoaded as __whenImagesLoaded, whenInteract as __whenInteract, whenInViewport as __whenInViewport, whenLinkLoaded as __whenLinkLoaded, whenNearViewport as __whenNearViewport, whenOutOfViewport as __whenOutOfViewport, whenRemoved as __whenRemoved, whenScriptLoaded as __whenScriptLoaded, whenStylesheetsReady as __whenStylesheetsReady, whenTransitionEnd as __whenTransitionEnd, whenVideoReady as __whenVideoReady, whenVisible as __whenVisible, when, whenAnimationEnd, whenAttribute, whenBackgroundImageLoaded, whenDomReady, whenEntersViewport, whenEventListener, whenIframeReady, whenImageLoaded, whenImagesLoaded, whenInteract, whenInViewport, whenLinkLoaded, whenNearViewport, whenOutOfViewport, whenRemoved, whenScriptLoaded, whenStylesheetsReady, whenTransitionEnd, WhenTriggers, whenVideoReady, whenVisible, };
@@ -17,6 +17,7 @@ import whenRemoved from './whenRemoved.js';
17
17
  import whenScriptLoaded from './whenScriptLoaded.js';
18
18
  import whenStylesheetsReady from './whenStylesheetsReady.js';
19
19
  import whenTransitionEnd from './whenTransitionEnd.js';
20
+ import whenVideoReady from './whenVideoReady.js';
20
21
  import whenVisible from './whenVisible.js';
21
- export { when as __when, whenAnimationEnd as __whenAnimationEnd, whenAttribute as __whenAttribute, whenBackgroundImageLoaded as __whenBackgroundImageLoaded, whenDomReady as __whenDomReady, whenEntersViewport as __whenEntersViewport, whenEventListener as __whenEventListener, whenIframeReady as __whenIframeReady, whenImageLoaded as __whenImageLoaded, whenImagesLoaded as __whenImagesLoaded, whenInteract as __whenInteract, whenInViewport as __whenInViewport, whenLinkLoaded as __whenLinkLoaded, whenNearViewport as __whenNearViewport, whenOutOfViewport as __whenOutOfViewport, whenRemoved as __whenRemoved, whenScriptLoaded as __whenScriptLoaded, whenStylesheetsReady as __whenStylesheetsReady, whenTransitionEnd as __whenTransitionEnd, whenVisible as __whenVisible, when, whenAnimationEnd, whenAttribute, whenBackgroundImageLoaded, whenDomReady, whenEntersViewport, whenEventListener, whenIframeReady, whenImageLoaded, whenImagesLoaded, whenInteract, whenInViewport, whenLinkLoaded, whenNearViewport, whenOutOfViewport, whenRemoved, whenScriptLoaded, whenStylesheetsReady, whenTransitionEnd, WhenTriggers, whenVisible, };
22
+ export { when as __when, whenAnimationEnd as __whenAnimationEnd, whenAttribute as __whenAttribute, whenBackgroundImageLoaded as __whenBackgroundImageLoaded, whenDomReady as __whenDomReady, whenEntersViewport as __whenEntersViewport, whenEventListener as __whenEventListener, whenIframeReady as __whenIframeReady, whenImageLoaded as __whenImageLoaded, whenImagesLoaded as __whenImagesLoaded, whenInteract as __whenInteract, whenInViewport as __whenInViewport, whenLinkLoaded as __whenLinkLoaded, whenNearViewport as __whenNearViewport, whenOutOfViewport as __whenOutOfViewport, whenRemoved as __whenRemoved, whenScriptLoaded as __whenScriptLoaded, whenStylesheetsReady as __whenStylesheetsReady, whenTransitionEnd as __whenTransitionEnd, whenVideoReady as __whenVideoReady, whenVisible as __whenVisible, when, whenAnimationEnd, whenAttribute, whenBackgroundImageLoaded, whenDomReady, whenEntersViewport, whenEventListener, whenIframeReady, whenImageLoaded, whenImagesLoaded, whenInteract, whenInViewport, whenLinkLoaded, whenNearViewport, whenOutOfViewport, whenRemoved, whenScriptLoaded, whenStylesheetsReady, whenTransitionEnd, WhenTriggers, whenVideoReady, whenVisible, };
22
23
  //# sourceMappingURL=_exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exports.js","sourceRoot":"","sources":["../../../../src/js/dom/when/_exports.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AACvE,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,eAAe,MAAM,sBAAsB,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Ae,IAAI,iBAAiB,EACpC,gBAAgB,IAAI,kBAAkB,EACtC,YAAY,IAAI,cAAc,EAC9B,cAAc,IAAI,gBAAgB,EAClC,cAAc,IAAI,gBAAgB,EAClC,gBAAgB,IAAI,kBAAkB,EACtC,iBAAiB,IAAI,mBAAmB,EACxC,WAAW,IAAI,aAAa,EAC5B,gBAAgB,IAAI,kBAAkB,EACtC,oBAAoB,IAAI,sBAAsB,EAC9C,iBAAiB,IAAI,mBAAmB,EACxC,cAAc,IAAI,gBAAgB,EAClC,WAAW,IAAI,aAAa,EAC5B,IAAI,EACJ,gBAAgB,EAChB,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @name whenVideoReady
3
+ * @namespace js.dom.when
4
+ * @type Function
5
+ * @platform js
6
+ * @status stable
7
+ *
8
+ * Wait until the passed video is ready to play.
9
+ * It checks if the video metadata has been loaded, and if not it waits for the `loadedmetadata` event.
10
+ *
11
+ * @feature Promise based API
12
+ *
13
+ * @param {HTMLVideoElement} $video The video to check the ready state
14
+ * @return {Promise} The promise that will be resolved when the video is ready to play
15
+ *
16
+ * @snippet whenVideoReady($1)
17
+ * whenVideoReady($1).then(\$video => {
18
+ * $2
19
+ * });
20
+ *
21
+ * @todo tests
22
+ *
23
+ * @example js
24
+ * import { whenVideoReady } from '@blackbyte/sugar/dom'
25
+ * whenVideoReady($myCoolHTMLVideoElement).then(($video) => {
26
+ * // do something when the video is ready to play
27
+ * });
28
+ *
29
+ * @since 1.0.0
30
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
31
+ */
32
+ export default function whenVideoReady($video: HTMLVideoElement): Promise<HTMLVideoElement>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @name whenVideoReady
3
+ * @namespace js.dom.when
4
+ * @type Function
5
+ * @platform js
6
+ * @status stable
7
+ *
8
+ * Wait until the passed video is ready to play.
9
+ * It checks if the video metadata has been loaded, and if not it waits for the `loadedmetadata` event.
10
+ *
11
+ * @feature Promise based API
12
+ *
13
+ * @param {HTMLVideoElement} $video The video to check the ready state
14
+ * @return {Promise} The promise that will be resolved when the video is ready to play
15
+ *
16
+ * @snippet whenVideoReady($1)
17
+ * whenVideoReady($1).then(\$video => {
18
+ * $2
19
+ * });
20
+ *
21
+ * @todo tests
22
+ *
23
+ * @example js
24
+ * import { whenVideoReady } from '@blackbyte/sugar/dom'
25
+ * whenVideoReady($myCoolHTMLVideoElement).then(($video) => {
26
+ * // do something when the video is ready to play
27
+ * });
28
+ *
29
+ * @since 1.0.0
30
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
31
+ */
32
+ export default function whenVideoReady($video) {
33
+ return new Promise((resolve) => {
34
+ if ($video.duration > 0) {
35
+ resolve($video);
36
+ }
37
+ else {
38
+ $video.addEventListener('loadedmetadata', () => {
39
+ resolve($video);
40
+ });
41
+ }
42
+ });
43
+ }
44
+ //# sourceMappingURL=whenVideoReady.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whenVideoReady.js","sourceRoot":"","sources":["../../../../src/js/dom/when/whenVideoReady.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,MAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,GAAG,EAAE;gBAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -7,7 +7,8 @@ import { type TCommonFileExtensionsSettings } from './commonFileExtensions.js';
7
7
  * @platform js
8
8
  * @status stable
9
9
  *
10
- * This function allows you to get an array of common media file extensions with or without the dot
10
+ * This function allows you to get an array of common media file extensions with or without the dot.
11
+ * This includes image, video and audio file extensions.
11
12
  *
12
13
  * @param {TCommonFileExtensionsSettings} [settings={}] Settings to customize the function behavior
13
14
  * @return {Array<String>} The array of extensions
@@ -10,7 +10,8 @@ import commonVideoFileExtensions from './commonVideoFileExtensions.js';
10
10
  * @platform js
11
11
  * @status stable
12
12
  *
13
- * This function allows you to get an array of common media file extensions with or without the dot
13
+ * This function allows you to get an array of common media file extensions with or without the dot.
14
+ * This includes image, video and audio file extensions.
14
15
  *
15
16
  * @param {TCommonFileExtensionsSettings} [settings={}] Settings to customize the function behavior
16
17
  * @return {Array<String>} The array of extensions
@@ -1 +1 @@
1
- {"version":3,"file":"commonMediaFileExtensions.js","sourceRoot":"","sources":["../../../src/shared/extension/commonMediaFileExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AAEvE,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AACvE,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,WAAmD,EAAE;IAErD,MAAM,aAAa,mBACjB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,EAAE,EACX,QAAQ,EAAE,KAAK,IACZ,QAAQ,CACZ,CAAC;IACF,OAAO,MAAM,CAAC;QACZ,GAAG,yBAAyB,CAAC,aAAa,CAAC;QA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,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -1,24 +1,24 @@
1
1
  import camelCaseProps from './camelCaseProps.js';
2
+ import cleanDeep from './cleanDeep.js';
2
3
  import clone from './clone.js';
4
+ import cloneInstance from './cloneInstance.js';
3
5
  import decycle from './decycle.js';
4
- import cleanDeep from './cleanDeep.js';
5
- import filterDeep from './filterDeep.js';
6
- import unflatten from './unflatten.js';
7
- import mapDeep from './mapDeep.js';
8
- import mergeDeep from './mergeDeep.js';
9
- import proxyDeep from './proxyDeep.js';
10
- import findDeep from './findDeep.js';
11
6
  import deleteProperty from './deleteProperty.js';
12
7
  import diff from './diff.js';
13
8
  import ensurePropertyExists from './ensurePropertyExists.js';
9
+ import filterDeep from './filterDeep.js';
14
10
  import filterObject from './filterObject.js';
11
+ import findDeep from './findDeep.js';
15
12
  import flatten from './flatten.js';
16
13
  import get from './get.js';
17
14
  import getGlob from './getGlob.js';
18
15
  import getKeyByValue from './getKeyByValue.js';
19
16
  import map from './map.js';
17
+ import mapDeep from './mapDeep.js';
18
+ import mergeDeep from './mergeDeep.js';
20
19
  import objectHash from './objectHash.js';
21
20
  import propertyProxy from './propertyProxy.js';
21
+ import proxyDeep from './proxyDeep.js';
22
22
  import remove from './remove.js';
23
23
  import set from './set.js';
24
24
  import sort from './sort.js';
@@ -26,4 +26,5 @@ import sortDeep from './sortDeep.js';
26
26
  import toJson from './toJson.js';
27
27
  import toPlainObject from './toPlainObject.js';
28
28
  import toQueryString from './toQueryString.js';
29
- export { camelCaseProps as __camelCaseProps, clone as __clone, decycle as __decycle, cleanDeep as __cleanDeep, cleanDeep as __deepClean, filterDeep as __filterDeep, filterDeep as __deepFilter, unflatten as __unflatten, unflatten as __deepize, mapDeep as __deepMap, mapDeep as __mapDeep, mergeDeep as __mergeDeep, mergeDeep as __deepMerge, proxyDeep as __proxyDeep, proxyDeep as __deepProxy, findDeep as __findDeep, findDeep as __deepSearch, deleteProperty as __deleteProperty, diff as __diff, ensurePropertyExists as __ensurePropertyExists, filterObject as __filterObject, flatten as __flatten, get as __get, getGlob as __getGlob, getKeyByValue as __getKeyByValue, map as __map, objectHash as __objectHash, propertyProxy as __propertyProxy, remove as __remove, set as __set, sort as __sort, sortDeep as __sortDeep, toJson as __toJson, toPlainObject as __toPlainObject, toQueryString as __toQueryString, camelCaseProps, clone, decycle, cleanDeep, cleanDeep as deepClean, filterDeep, filterDeep as deepFilter, unflatten, unflatten as deepize, mapDeep, mapDeep as deepMap, mergeDeep, mergeDeep as deepMerge, proxyDeep, proxyDeep as deepProxy, findDeep, findDeep as deepSearch, deleteProperty, diff, ensurePropertyExists, filterObject, flatten, get, getGlob, getKeyByValue, map, objectHash, propertyProxy, remove, set, sort, sortDeep, toJson, toPlainObject, toQueryString, };
29
+ import unflatten from './unflatten.js';
30
+ export { camelCaseProps as __camelCaseProps, cleanDeep as __cleanDeep, clone as __clone, cloneInstance as __cloneInstance, decycle as __decycle, cleanDeep as __deepClean, filterDeep as __deepFilter, unflatten as __deepize, mapDeep as __deepMap, mergeDeep as __deepMerge, proxyDeep as __deepProxy, findDeep as __deepSearch, deleteProperty as __deleteProperty, diff as __diff, ensurePropertyExists as __ensurePropertyExists, filterDeep as __filterDeep, filterObject as __filterObject, findDeep as __findDeep, flatten as __flatten, get as __get, getGlob as __getGlob, getKeyByValue as __getKeyByValue, map as __map, mapDeep as __mapDeep, mergeDeep as __mergeDeep, objectHash as __objectHash, propertyProxy as __propertyProxy, proxyDeep as __proxyDeep, remove as __remove, set as __set, sort as __sort, sortDeep as __sortDeep, toJson as __toJson, toPlainObject as __toPlainObject, toQueryString as __toQueryString, unflatten as __unflatten, camelCaseProps, cleanDeep, clone, cloneInstance, decycle, cleanDeep as deepClean, filterDeep as deepFilter, unflatten as deepize, mapDeep as deepMap, mergeDeep as deepMerge, proxyDeep as deepProxy, findDeep as deepSearch, deleteProperty, diff, ensurePropertyExists, filterDeep, filterObject, findDeep, flatten, get, getGlob, getKeyByValue, map, mapDeep, mergeDeep, objectHash, propertyProxy, proxyDeep, remove, set, sort, sortDeep, toJson, toPlainObject, toQueryString, unflatten, };
@@ -1,24 +1,24 @@
1
1
  import camelCaseProps from './camelCaseProps.js';
2
+ import cleanDeep from './cleanDeep.js';
2
3
  import clone from './clone.js';
4
+ import cloneInstance from './cloneInstance.js';
3
5
  import decycle from './decycle.js';
4
- import cleanDeep from './cleanDeep.js';
5
- import filterDeep from './filterDeep.js';
6
- import unflatten from './unflatten.js';
7
- import mapDeep from './mapDeep.js';
8
- import mergeDeep from './mergeDeep.js';
9
- import proxyDeep from './proxyDeep.js';
10
- import findDeep from './findDeep.js';
11
6
  import deleteProperty from './deleteProperty.js';
12
7
  import diff from './diff.js';
13
8
  import ensurePropertyExists from './ensurePropertyExists.js';
9
+ import filterDeep from './filterDeep.js';
14
10
  import filterObject from './filterObject.js';
11
+ import findDeep from './findDeep.js';
15
12
  import flatten from './flatten.js';
16
13
  import get from './get.js';
17
14
  import getGlob from './getGlob.js';
18
15
  import getKeyByValue from './getKeyByValue.js';
19
16
  import map from './map.js';
17
+ import mapDeep from './mapDeep.js';
18
+ import mergeDeep from './mergeDeep.js';
20
19
  import objectHash from './objectHash.js';
21
20
  import propertyProxy from './propertyProxy.js';
21
+ import proxyDeep from './proxyDeep.js';
22
22
  import remove from './remove.js';
23
23
  import set from './set.js';
24
24
  import sort from './sort.js';
@@ -26,5 +26,6 @@ import sortDeep from './sortDeep.js';
26
26
  import toJson from './toJson.js';
27
27
  import toPlainObject from './toPlainObject.js';
28
28
  import toQueryString from './toQueryString.js';
29
- export { camelCaseProps as __camelCaseProps, clone as __clone, decycle as __decycle, cleanDeep as __cleanDeep, cleanDeep as __deepClean, filterDeep as __filterDeep, filterDeep as __deepFilter, unflatten as __unflatten, unflatten as __deepize, mapDeep as __deepMap, mapDeep as __mapDeep, mergeDeep as __mergeDeep, mergeDeep as __deepMerge, proxyDeep as __proxyDeep, proxyDeep as __deepProxy, findDeep as __findDeep, findDeep as __deepSearch, deleteProperty as __deleteProperty, diff as __diff, ensurePropertyExists as __ensurePropertyExists, filterObject as __filterObject, flatten as __flatten, get as __get, getGlob as __getGlob, getKeyByValue as __getKeyByValue, map as __map, objectHash as __objectHash, propertyProxy as __propertyProxy, remove as __remove, set as __set, sort as __sort, sortDeep as __sortDeep, toJson as __toJson, toPlainObject as __toPlainObject, toQueryString as __toQueryString, camelCaseProps, clone, decycle, cleanDeep, cleanDeep as deepClean, filterDeep, filterDeep as deepFilter, unflatten, unflatten as deepize, mapDeep, mapDeep as deepMap, mergeDeep, mergeDeep as deepMerge, proxyDeep, proxyDeep as deepProxy, findDeep, findDeep as deepSearch, deleteProperty, diff, ensurePropertyExists, filterObject, flatten, get, getGlob, getKeyByValue, map, objectHash, propertyProxy, remove, set, sort, sortDeep, toJson, toPlainObject, toQueryString, };
29
+ import unflatten from './unflatten.js';
30
+ export { camelCaseProps as __camelCaseProps, cleanDeep as __cleanDeep, clone as __clone, cloneInstance as __cloneInstance, decycle as __decycle, cleanDeep as __deepClean, filterDeep as __deepFilter, unflatten as __deepize, mapDeep as __deepMap, mergeDeep as __deepMerge, proxyDeep as __deepProxy, findDeep as __deepSearch, deleteProperty as __deleteProperty, diff as __diff, ensurePropertyExists as __ensurePropertyExists, filterDeep as __filterDeep, filterObject as __filterObject, findDeep as __findDeep, flatten as __flatten, get as __get, getGlob as __getGlob, getKeyByValue as __getKeyByValue, map as __map, mapDeep as __mapDeep, mergeDeep as __mergeDeep, objectHash as __objectHash, propertyProxy as __propertyProxy, proxyDeep as __proxyDeep, remove as __remove, set as __set, sort as __sort, sortDeep as __sortDeep, toJson as __toJson, toPlainObject as __toPlainObject, toQueryString as __toQueryString, unflatten as __unflatten, camelCaseProps, cleanDeep, clone, cloneInstance, decycle, cleanDeep as deepClean, filterDeep as deepFilter, unflatten as deepize, mapDeep as deepMap, mergeDeep as deepMerge, proxyDeep as deepProxy, findDeep as deepSearch, deleteProperty, diff, ensurePropertyExists, filterDeep, filterObject, findDeep, flatten, get, getGlob, getKeyByValue, map, mapDeep, mergeDeep, objectHash, propertyProxy, proxyDeep, remove, set, sort, sortDeep, toJson, toPlainObject, toQueryString, unflatten, };
30
31
  //# sourceMappingURL=_exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exports.js","sourceRoot":"","sources":["../../../src/shared/object/_exports.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,aAAa,MAAM,oBAAoB,CAAC;A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IAAI,UAAU,EACtB,cAAc,EACd,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,GAAG,EACH,OAAO,EACP,aAAa,EACb,GAAG,EACH,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,EACb,SAAS,EACT,MAAM,EACN,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,GACV,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @name cloneInstance
3
+ * @namespace shared.object
4
+ * @type Function
5
+ * @platform js
6
+ * @platform node
7
+ * @status stable
8
+ *
9
+ * This function allows you to clone an object instance.
10
+ *
11
+ * @param {Object} instance The object instance to clone
12
+ * @return {Object} The cloned object
13
+ *
14
+ * @todo tests
15
+ *
16
+ * @snippet cloneInstance($1)
17
+ *
18
+ * @example js
19
+ * import { cloneInstance } from '@blackbyte/sugar/object';
20
+ * const myInstance = new MyClass();
21
+ * const myInstanceClone = cloneInstance(myInstance);
22
+ *
23
+ * @since 1.0.0
24
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
25
+ */
26
+ export default function cloneInstance<T = any>(instance: T): T;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @name cloneInstance
3
+ * @namespace shared.object
4
+ * @type Function
5
+ * @platform js
6
+ * @platform node
7
+ * @status stable
8
+ *
9
+ * This function allows you to clone an object instance.
10
+ *
11
+ * @param {Object} instance The object instance to clone
12
+ * @return {Object} The cloned object
13
+ *
14
+ * @todo tests
15
+ *
16
+ * @snippet cloneInstance($1)
17
+ *
18
+ * @example js
19
+ * import { cloneInstance } from '@blackbyte/sugar/object';
20
+ * const myInstance = new MyClass();
21
+ * const myInstanceClone = cloneInstance(myInstance);
22
+ *
23
+ * @since 1.0.0
24
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
25
+ */
26
+ export default function cloneInstance(instance) {
27
+ return Object.assign(Object.create(Object.getPrototypeOf(instance)), instance);
28
+ }
29
+ //# sourceMappingURL=cloneInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloneInstance.js","sourceRoot":"","sources":["../../../src/shared/object/cloneInstance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAU,QAAW;IACxD,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,EAC9C,QAAQ,CACT,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
+ import getYoutubeVideoIdFromUrl from './getYoutubeVideoIdFromUrl.js';
1
2
  import gravatarUrl from './gravatarUrl.js';
2
3
  import parseSchema from './parseSchema.js';
3
4
  import queryStringToObject from './queryStringToObject.js';
4
5
  import urlFromString from './urlFromString.js';
5
- export { gravatarUrl, parseSchema, queryStringToObject, urlFromString, gravatarUrl as __gravatarUrl, parseSchema as __parseSchema, queryStringToObject as __queryStringToObject, urlFromString as __urlFromString, };
6
+ export { getYoutubeVideoIdFromUrl as __getYoutubeVideoIdFromUrl, gravatarUrl as __gravatarUrl, parseSchema as __parseSchema, queryStringToObject as __queryStringToObject, urlFromString as __urlFromString, getYoutubeVideoIdFromUrl, gravatarUrl, parseSchema, queryStringToObject, urlFromString, };
@@ -1,6 +1,7 @@
1
+ import getYoutubeVideoIdFromUrl from './getYoutubeVideoIdFromUrl.js';
1
2
  import gravatarUrl from './gravatarUrl.js';
2
3
  import parseSchema from './parseSchema.js';
3
4
  import queryStringToObject from './queryStringToObject.js';
4
5
  import urlFromString from './urlFromString.js';
5
- export { gravatarUrl, parseSchema, queryStringToObject, urlFromString, gravatarUrl as __gravatarUrl, parseSchema as __parseSchema, queryStringToObject as __queryStringToObject, urlFromString as __urlFromString, };
6
+ export { getYoutubeVideoIdFromUrl as __getYoutubeVideoIdFromUrl, gravatarUrl as __gravatarUrl, parseSchema as __parseSchema, queryStringToObject as __queryStringToObject, urlFromString as __urlFromString, getYoutubeVideoIdFromUrl, gravatarUrl, parseSchema, queryStringToObject, urlFromString, };
6
7
  //# sourceMappingURL=_exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exports.js","sourceRoot":"","sources":["../../../src/shared/url/_exports.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EACL,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,IAAI,aAAa,EAC5B,WAAW,IAAI,aAAa,EAC5B,mBAAmB,IAAI,qBAAqB,EAC5C,aAAa,IAAI,eAAe,GACjC,CAAC"}
1
+ {"version":3,"file":"_exports.js","sourceRoot":"","sources":["../../../src/shared/url/_exports.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EACL,wBAAwB,IAAI,0BAA0B,EACtD,WAAW,IAAI,aAAa,EAC5B,WAAW,IAAI,aAAa,EAC5B,mBAAmB,IAAI,qBAAqB,EAC5C,aAAa,IAAI,eAAe,EAChC,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,aAAa,GACd,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @name getYoutubeVideoIdFromUrl
3
+ * @namespace shared.url
4
+ * @type Function
5
+ * @platform js
6
+ * @platform node
7
+ * @status stable
8
+ *
9
+ * Return a YouTube video ID extracted from the given URL
10
+ *
11
+ * @param {String} url The YouTube video URL
12
+ * @return {String|null} The extracted video ID or null if not found
13
+ *
14
+ * @todo tests
15
+ *
16
+ * @snippet getYoutubeVideoIdFromUrl($1)
17
+ *
18
+ * @example js
19
+ * import { getYoutubeVideoIdFromUrl } from '@blackbyte/sugar/url';
20
+ * getYoutubeVideoIdFromUrl('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); // dQw4w9WgXcQ
21
+ *
22
+ * @see https://stackoverflow.com/questions/3452546/how-do-i-get-the-youtube-video-id-from-a-url
23
+ * @since 1.0.0
24
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
25
+ */
26
+ export default function getYoutubeVideoIdFromUrl(url: string): string | null;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @name getYoutubeVideoIdFromUrl
3
+ * @namespace shared.url
4
+ * @type Function
5
+ * @platform js
6
+ * @platform node
7
+ * @status stable
8
+ *
9
+ * Return a YouTube video ID extracted from the given URL
10
+ *
11
+ * @param {String} url The YouTube video URL
12
+ * @return {String|null} The extracted video ID or null if not found
13
+ *
14
+ * @todo tests
15
+ *
16
+ * @snippet getYoutubeVideoIdFromUrl($1)
17
+ *
18
+ * @example js
19
+ * import { getYoutubeVideoIdFromUrl } from '@blackbyte/sugar/url';
20
+ * getYoutubeVideoIdFromUrl('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); // dQw4w9WgXcQ
21
+ *
22
+ * @see https://stackoverflow.com/questions/3452546/how-do-i-get-the-youtube-video-id-from-a-url
23
+ * @since 1.0.0
24
+ * @author Olivier Bossel <olivier.bossel@gmail.com> (https://blackbyte.space)
25
+ */
26
+ export default function getYoutubeVideoIdFromUrl(url) {
27
+ var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
28
+ var match = url.match(regExp);
29
+ return match && match[7].length == 11 ? match[7] : null;
30
+ }
31
+ //# sourceMappingURL=getYoutubeVideoIdFromUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getYoutubeVideoIdFromUrl.js","sourceRoot":"","sources":["../../../src/shared/url/getYoutubeVideoIdFromUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,GAAW;IAC1D,IAAI,MAAM,GACR,2EAA2E,CAAC;IAC9E,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackbyte/sugar",
3
3
  "description": "The toolkit that you missed... like a sugar in your coffee!",
4
- "version": "1.0.0-beta.13",
4
+ "version": "1.0.0-beta.16",
5
5
  "keywords": [
6
6
  "javascript",
7
7
  "typescript",