@rnacanvas/utilities 7.0.1 → 7.2.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 +39 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/removeWhitespace.d.ts +5 -0
- package/dist/removeWhitespace.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,25 +105,55 @@ splitLines('qwer\r'); // ["qwer", ""]
|
|
|
105
105
|
splitLines('asdf\n\n\nqwer'); // ["asdf", "", "", "qwer"]
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
## `function
|
|
108
|
+
## `function isJSON()`
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
using the `JSON.stringify()` method
|
|
112
|
-
without the `JSON.stringify()` method throwing.
|
|
110
|
+
Returns `true` if a value is a string in JSON format.
|
|
113
111
|
|
|
114
112
|
Returns `false` otherwise.
|
|
115
113
|
|
|
116
114
|
```javascript
|
|
117
|
-
|
|
115
|
+
isJSON('{ "a": 1, "b": 2 }'); // true
|
|
116
|
+
|
|
117
|
+
isJSON('[1, 2, 3]'); // true
|
|
118
|
+
|
|
119
|
+
isJSON('"asdf"'); // true
|
|
120
|
+
|
|
121
|
+
isJSON('2'); // true
|
|
122
|
+
|
|
123
|
+
// no double-quotes
|
|
124
|
+
isJSON('asdf'); // false
|
|
125
|
+
|
|
126
|
+
// missing closing bracket
|
|
127
|
+
isJSON('{ "a": 1, "b": 2'); // false
|
|
128
|
+
|
|
129
|
+
// not a string
|
|
130
|
+
isJSON({ "a": 1, "b": 2 }); // false
|
|
131
|
+
|
|
132
|
+
// some more non-string values
|
|
133
|
+
isJSON([1, 2, 3]); // false
|
|
134
|
+
isJSON(2); // false
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## `function isJSONSerializable()`
|
|
138
|
+
|
|
139
|
+
Returns `true` if a value can be serialized to a JSON string.
|
|
118
140
|
|
|
119
|
-
|
|
141
|
+
Returns `false` otherwise.
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
isJSONSerializable({ "a": 1, "b": 2 }); // true
|
|
120
145
|
|
|
121
|
-
var
|
|
146
|
+
var o = {};
|
|
122
147
|
|
|
123
148
|
// a circular reference
|
|
124
|
-
|
|
149
|
+
o.o = o;
|
|
150
|
+
|
|
151
|
+
isJSONSerializable(o); // false
|
|
125
152
|
|
|
126
|
-
|
|
153
|
+
// some simple cases
|
|
154
|
+
isJSONSerializable([1, 2, 3]); // true
|
|
155
|
+
isJSONSerializable('asdf'); // true
|
|
156
|
+
isJSONSerializable(2); // true
|
|
127
157
|
```
|
|
128
158
|
|
|
129
159
|
## `function shuffled()`
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,12 @@ import { middleThree } from './middleThree';
|
|
|
6
6
|
export { middleThree };
|
|
7
7
|
import { middleFour } from './middleFour';
|
|
8
8
|
export { middleFour };
|
|
9
|
+
import { removeWhitespace } from './removeWhitespace';
|
|
10
|
+
export { removeWhitespace };
|
|
9
11
|
import { splitLines } from './splitLines';
|
|
10
12
|
export { splitLines };
|
|
13
|
+
import { isJSON } from '@rnacanvas/value-check';
|
|
14
|
+
export { isJSON };
|
|
11
15
|
import { isJSONSerializable } from '@rnacanvas/value-check';
|
|
12
16
|
export { isJSONSerializable };
|
|
13
17
|
import { shuffled } from './shuffled';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAA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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(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:()=>y});var r,n,i,o,s,a,u,l,c,h,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},d=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 y{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),f(this,n,t,"f"),f(this,i,e=>d(this,r,"m",h).call(this,e),"f"),f(this,o,a,"f")}get owner(){return d(this,s,"f")}set owner(e){var t;null===(t=d(this,s,"f"))||void 0===t||t.removeEventListener("keydown",d(this,i,"f")),null==e||e.addEventListener("keydown",d(this,i,"f"),{passive:!1}),f(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=d(this,o,"f"))||void 0===e?void 0:e.altKey)&&void 0!==t&&t},u=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.ctrlKey)&&void 0!==t&&t},l=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.metaKey)&&void 0!==t&&t},c=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.shiftKey)&&void 0!==t&&t},h=function(e){this.owner&&this.owner===document.activeElement&&e.key.toUpperCase()===this.key.toUpperCase()&&e.altKey===d(this,r,"a",a)&&e.ctrlKey===d(this,r,"a",u)&&e.metaKey===d(this,r,"a",l)&&e.shiftKey===d(this,r,"a",c)&&(e.preventDefault(),d(this,n,"f").call(this))},t})(),e.exports=t()},854(e){e.exports=(()=>{"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={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function s(e){return n(e)&&e>=0}function a(e){return"string"==typeof e}function u(e){if(!a(e))return!1;try{return JSON.parse(e),!0}catch{return!1}}function
|
|
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(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:()=>y});var r,n,i,o,s,a,u,l,c,h,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},d=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 y{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),f(this,n,t,"f"),f(this,i,e=>d(this,r,"m",h).call(this,e),"f"),f(this,o,a,"f")}get owner(){return d(this,s,"f")}set owner(e){var t;null===(t=d(this,s,"f"))||void 0===t||t.removeEventListener("keydown",d(this,i,"f")),null==e||e.addEventListener("keydown",d(this,i,"f"),{passive:!1}),f(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=d(this,o,"f"))||void 0===e?void 0:e.altKey)&&void 0!==t&&t},u=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.ctrlKey)&&void 0!==t&&t},l=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.metaKey)&&void 0!==t&&t},c=function(){var e,t;return null!==(t=null===(e=d(this,o,"f"))||void 0===e?void 0:e.shiftKey)&&void 0!==t&&t},h=function(e){this.owner&&this.owner===document.activeElement&&e.key.toUpperCase()===this.key.toUpperCase()&&e.altKey===d(this,r,"a",a)&&e.ctrlKey===d(this,r,"a",u)&&e.metaKey===d(this,r,"a",l)&&e.shiftKey===d(this,r,"a",c)&&(e.preventDefault(),d(this,n,"f").call(this))},t})(),e.exports=t()},854(e){e.exports=(()=>{"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={};function r(e){return"number"==typeof e}function n(e){return r(e)&&Number.isFinite(e)}function i(e){return r(e)&&!Number.isFinite(e)}function o(e){return n(e)&&e>0}function s(e){return n(e)&&e>=0}function a(e){return"string"==typeof e}function u(e){return!!a(e)&&0==e.trim().length}function l(e){if(!a(e))return!1;try{return JSON.parse(e),!0}catch{return!1}}function c(e){try{return JSON.stringify(e),!0}catch{return!1}}function h(e){return null==e}function f(e){return"object"==typeof e&&null!==e}function d(e){return Array.isArray(e)}function y(e){return d(e)&&0==e.length}function p(e){return d(e)&&e.length>0}function v(e){return d(e)&&e.every(r)}function m(e){return v(e)&&e.length>0}function w(e){return d(e)&&e.every(n)}function g(e){return d(e)&&e.every(i)}function b(e){return d(e)&&e.every(a)}function E(e){return b(e)&&e.length>0}return e.r(t),e.d(t,{isArray:()=>d,isEmptyArray:()=>y,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>w,isJSON:()=>l,isJSONSerializable:()=>c,isNonEmptyArray:()=>p,isNonEmptyNumbersArray:()=>m,isNonEmptyStringsArray:()=>E,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>g,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>f,isNullish:()=>h,isNumber:()=>r,isNumbersArray:()=>v,isPositiveFiniteNumber:()=>o,isString:()=>a,isStringsArray:()=>b,isWhitespace:()=>u}),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){if(e.length<4)throw new Error("Array has less than 4 items.");if(e.length%2!=0)throw new Error("Array has an odd number of items.");let t=Math.floor(e.length/2);return[e[t-2],e[t-1],e[t],e[t+1]]}r.r(n),r.d(n,{DownloadableFile:()=>w,EventfulSet:()=>g,FiniteStack:()=>j,KeyBinding:()=>f.KeyBinding,containsFocus:()=>h,detectMacOS:()=>y,detectWindows:()=>d,first:()=>e,hasFocus:()=>c,isJSON:()=>s.isJSON,isJSONSerializable:()=>s.isJSONSerializable,isURL:()=>T,last:()=>t,middleFour:()=>o,middleThree:()=>i,removeWhitespace:()=>a,shuffled:()=>l,splitLines:()=>u});var s=r(854);function a(e){return[...e].filter(e=>!(0,s.isWhitespace)(e)).join("")}function u(e){return e.split(/\r\n|\r|\n/)}function l(e){return e.map(e=>({v:e,priority:Math.random()})).sort((e,t)=>e.priority-t.priority).map(({v:e})=>e)}function c(e){return e===document.activeElement}function h(e){return!!document.activeElement&&e.contains(document.activeElement)}var f=r(992);function d(){return-1!==navigator.userAgent.indexOf("Windows")}function y(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}var p,v=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},m=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){p.set(this,void 0),this.name=null!=e?e:"Unnamed.txt",this.content=null!=t?t:"",v(this,p,null==r?void 0:r.type,"f")}get type(){return null!=m(this,p,"f")?m(this,p,"f"):this.content instanceof Blob?this.content.type:"text/plain"}set type(e){v(this,p,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)}}p=new WeakMap;class g{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 b,E,S,N,O=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 j{constructor(e){b.add(this),this.maxSize=e,E.set(this,[]),S.set(this,{change:[]})}get size(){return O(this,E,"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,E,[],"f"),O(this,b,"m",N).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return O(this,E,"f")[O(this,E,"f").length-1]}push(e){O(this,E,"f").push(e),this.size>this.maxSize&&O(this,E,"f").shift(),O(this,b,"m",N).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=O(this,E,"f").pop();return O(this,b,"m",N).call(this,"change"),e}addEventListener(e,t){O(this,S,"f")[e].push(t)}removeEventListener(e,t){O(this,S,"f")[e]=O(this,S,"f")[e].filter(e=>e!==t)}}function T(e){try{return new URL(e),!0}catch(e){return!1}}E=new WeakMap,S=new WeakMap,b=new WeakSet,N=function(e){O(this,S,"f")[e].forEach(e=>e())}})(),n})());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeWhitespace.d.ts","sourceRoot":"","sources":["../src/removeWhitespace.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|