@rnacanvas/utilities 6.3.0 → 6.4.0

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/README.md CHANGED
@@ -26,9 +26,25 @@ Throws for empty arrays.
26
26
  ```javascript
27
27
  first([5, 4, 3, 2, 1]); // 5
28
28
 
29
+ first(['b']); // "b"
30
+
29
31
  first([]); // throws
30
32
  ```
31
33
 
34
+ ## `function last()`
35
+
36
+ Returns the last item in an array.
37
+
38
+ Throws for empty arrays.
39
+
40
+ ```javascript
41
+ last([5, 4, 3, 2, 1]); // 1
42
+
43
+ last(['b']); // "b"
44
+
45
+ last([]); // throws
46
+ ```
47
+
32
48
  ## `function splitLines()`
33
49
 
34
50
  Splits a string into its constituent lines
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import { first } from './first';
2
2
  export { first };
3
3
  import { last } from './last';
4
4
  export { last };
5
+ import { middleThree } from './middleThree';
6
+ export { middleThree };
5
7
  import { splitLines } from './splitLines';
6
8
  export { splitLines };
7
9
  import { isJSONSerializable } from './isJSONSerializable';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.utilities=t():e.utilities=t()}(this,()=>(()=>{var e={992:function(e){var t;t=()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{KeyBinding:()=>p});var r,n,i,o,s,a,l,h,c,u,d=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},f=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class p{constructor(e,t,a){r.add(this),this.key=e,n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),s.set(this,void 0),d(this,n,t,"f"),d(this,i,e=>f(this,r,"m",u).call(this,e),"f"),d(this,o,a,"f")}get owner(){return f(this,s,"f")}set owner(e){var t;null===(t=f(this,s,"f"))||void 0===t||t.removeEventListener("keydown",f(this,i,"f")),null==e||e.addEventListener("keydown",f(this,i,"f"),{passive:!1}),d(this,s,e,"f")}}return n=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,r=new WeakSet,a=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.altKey)&&void 0!==t&&t},l=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.ctrlKey)&&void 0!==t&&t},h=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.metaKey)&&void 0!==t&&t},c=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.shiftKey)&&void 0!==t&&t},u=function(e){this.owner&&this.owner===document.activeElement&&e.key.toUpperCase()===this.key.toUpperCase()&&e.altKey===f(this,r,"a",a)&&e.ctrlKey===f(this,r,"a",l)&&e.metaKey===f(this,r,"a",h)&&e.shiftKey===f(this,r,"a",c)&&(e.preventDefault(),f(this,n,"f").call(this))},t})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(e){if(e.length>0)return e[0];throw new Error("Array is empty.")}function t(e){if(e.length>0)return e[e.length-1];throw new Error("Array is empty.")}function i(e){return e.split(/\r\n|\r|\n/)}function o(e){try{return JSON.stringify(e),!0}catch(e){return!1}}function s(e){return e.map(e=>({v:e,priority:Math.random()})).sort((e,t)=>e.priority-t.priority).map(({v:e})=>e)}function a(e){return e===document.activeElement}function l(e){return!!document.activeElement&&e.contains(document.activeElement)}r.r(n),r.d(n,{DownloadableFile:()=>v,EventfulSet:()=>y,FiniteStack:()=>S,KeyBinding:()=>h.KeyBinding,containsFocus:()=>l,detectMacOS:()=>u,detectWindows:()=>c,first:()=>e,hasFocus:()=>a,isJSONSerializable:()=>o,isURL:()=>L,last:()=>t,shuffled:()=>s,splitLines:()=>i});var h=r(992);function c(){return-1!==navigator.userAgent.indexOf("Windows")}function u(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}var d,f=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},p=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class v{constructor(e,t,r){d.set(this,void 0),this.name=null!=e?e:"Unnamed.txt",this.content=null!=t?t:"",f(this,d,null==r?void 0:r.type,"f")}get type(){return null!=p(this,d,"f")?p(this,d,"f"):this.content instanceof Blob?this.content.type:"text/plain"}set type(e){f(this,d,e,"f")}download(){let e=new File([this.content],this.name,{type:this.type}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(t)}}d=new WeakMap;class y{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(e){return this.underlyingSet.has(e)}include(e){return this.includes(e)}addAll(e){let t=[...e];0!=t.length&&(t.every(e=>this.includes(e))||(t.forEach(e=>this.underlyingSet.add(e)),this.callEventListeners("change")))}removeAll(e){let t=[...e];0!=t.length&&(t.every(e=>!this.includes(e))||(t.forEach(e=>this.underlyingSet.delete(e)),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(e,t){this.eventListeners[e].push(t)}callEventListeners(e){this.eventListeners[e].forEach(e=>e())}removeEventListener(e,t){this.eventListeners[e]=this.eventListeners[e].filter(e=>e!==t)}}var w,m,g,b,E=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class S{constructor(e){w.add(this),this.maxSize=e,m.set(this,[]),g.set(this,{change:[]})}get size(){return E(this,m,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,m,[],"f"),E(this,w,"m",b).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return E(this,m,"f")[E(this,m,"f").length-1]}push(e){E(this,m,"f").push(e),this.size>this.maxSize&&E(this,m,"f").shift(),E(this,w,"m",b).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=E(this,m,"f").pop();return E(this,w,"m",b).call(this,"change"),e}addEventListener(e,t){E(this,g,"f")[e].push(t)}removeEventListener(e,t){E(this,g,"f")[e]=E(this,g,"f")[e].filter(e=>e!==t)}}function L(e){try{return new URL(e),!0}catch(e){return!1}}m=new WeakMap,g=new WeakMap,w=new WeakSet,b=function(e){E(this,g,"f")[e].forEach(e=>e())}})(),n})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.utilities=t():e.utilities=t()}(this,()=>(()=>{var e={992:function(e){var t;t=()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{KeyBinding:()=>p});var r,n,i,o,s,a,l,h,c,u,d=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},f=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class p{constructor(e,t,a){r.add(this),this.key=e,n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),s.set(this,void 0),d(this,n,t,"f"),d(this,i,e=>f(this,r,"m",u).call(this,e),"f"),d(this,o,a,"f")}get owner(){return f(this,s,"f")}set owner(e){var t;null===(t=f(this,s,"f"))||void 0===t||t.removeEventListener("keydown",f(this,i,"f")),null==e||e.addEventListener("keydown",f(this,i,"f"),{passive:!1}),d(this,s,e,"f")}}return n=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,r=new WeakSet,a=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.altKey)&&void 0!==t&&t},l=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.ctrlKey)&&void 0!==t&&t},h=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.metaKey)&&void 0!==t&&t},c=function(){var e,t;return null!==(t=null===(e=f(this,o,"f"))||void 0===e?void 0:e.shiftKey)&&void 0!==t&&t},u=function(e){this.owner&&this.owner===document.activeElement&&e.key.toUpperCase()===this.key.toUpperCase()&&e.altKey===f(this,r,"a",a)&&e.ctrlKey===f(this,r,"a",l)&&e.metaKey===f(this,r,"a",h)&&e.shiftKey===f(this,r,"a",c)&&(e.preventDefault(),f(this,n,"f").call(this))},t})(),e.exports=t()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";function e(e){if(e.length>0)return e[0];throw new Error("Array is empty.")}function t(e){if(e.length>0)return e[e.length-1];throw new Error("Array is empty.")}function i(e){if(e.length<3)throw new Error("Array has less than 3 items.");if(e.length%2==0)throw new Error("Array has an even number of items.");let t=Math.floor(e.length/2);return[e[t-1],e[t],e[t+1]]}function o(e){return e.split(/\r\n|\r|\n/)}function s(e){try{return JSON.stringify(e),!0}catch(e){return!1}}function a(e){return e.map(e=>({v:e,priority:Math.random()})).sort((e,t)=>e.priority-t.priority).map(({v:e})=>e)}function l(e){return e===document.activeElement}function h(e){return!!document.activeElement&&e.contains(document.activeElement)}r.r(n),r.d(n,{DownloadableFile:()=>w,EventfulSet:()=>y,FiniteStack:()=>L,KeyBinding:()=>c.KeyBinding,containsFocus:()=>h,detectMacOS:()=>d,detectWindows:()=>u,first:()=>e,hasFocus:()=>l,isJSONSerializable:()=>s,isURL:()=>T,last:()=>t,middleThree:()=>i,shuffled:()=>a,splitLines:()=>o});var c=r(992);function u(){return-1!==navigator.userAgent.indexOf("Windows")}function d(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}var f,p=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},v=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class w{constructor(e,t,r){f.set(this,void 0),this.name=null!=e?e:"Unnamed.txt",this.content=null!=t?t:"",p(this,f,null==r?void 0:r.type,"f")}get type(){return null!=v(this,f,"f")?v(this,f,"f"):this.content instanceof Blob?this.content.type:"text/plain"}set type(e){p(this,f,e,"f")}download(){let e=new File([this.content],this.name,{type:this.type}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(t)}}f=new WeakMap;class y{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(e){return this.underlyingSet.has(e)}include(e){return this.includes(e)}addAll(e){let t=[...e];0!=t.length&&(t.every(e=>this.includes(e))||(t.forEach(e=>this.underlyingSet.add(e)),this.callEventListeners("change")))}removeAll(e){let t=[...e];0!=t.length&&(t.every(e=>!this.includes(e))||(t.forEach(e=>this.underlyingSet.delete(e)),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(e,t){this.eventListeners[e].push(t)}callEventListeners(e){this.eventListeners[e].forEach(e=>e())}removeEventListener(e,t){this.eventListeners[e]=this.eventListeners[e].filter(e=>e!==t)}}var m,g,b,E,S=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class L{constructor(e){m.add(this),this.maxSize=e,g.set(this,[]),b.set(this,{change:[]})}get size(){return S(this,g,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,g,[],"f"),S(this,m,"m",E).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return S(this,g,"f")[S(this,g,"f").length-1]}push(e){S(this,g,"f").push(e),this.size>this.maxSize&&S(this,g,"f").shift(),S(this,m,"m",E).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=S(this,g,"f").pop();return S(this,m,"m",E).call(this,"change"),e}addEventListener(e,t){S(this,b,"f")[e].push(t)}removeEventListener(e,t){S(this,b,"f")[e]=S(this,b,"f")[e].filter(e=>e!==t)}}function T(e){try{return new URL(e),!0}catch(e){return!1}}g=new WeakMap,b=new WeakMap,m=new WeakSet,E=function(e){S(this,b,"f")[e].forEach(e=>e())}})(),n})());
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns the middle three items in an array.
3
+ *
4
+ * Throws if the array has less than three items
5
+ * or has an even number of items.
6
+ */
7
+ export declare function middleThree<T>(items: T[]): [T, T, T];
8
+ //# sourceMappingURL=middleThree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleThree.d.ts","sourceRoot":"","sources":["../src/middleThree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAUpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/utilities",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "General utilities",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {