ranges-push
Advanced tools
Comparing version 6.2.3 to 6.2.4
@@ -15,3 +15,3 @@ # Change Log | ||
### Bug Fixes | ||
### Fixed | ||
@@ -50,3 +50,3 @@ - tweak types ([275af61](https://github.com/codsen/codsen/commit/275af6157971be62636ff7a9c95c7bd800ef009d)) | ||
### Bug Fixes | ||
### Fixed | ||
@@ -53,0 +53,0 @@ - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29)) |
/** | ||
* @name ranges-push | ||
* @fileoverview Gather string index ranges | ||
* @version 6.2.3 | ||
* @version 6.2.4 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -10,3 +10,3 @@ * @license MIT | ||
import{collWhitespace as y}from"string-collapse-leading-whitespace";var b={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function h(a,r){if(!Array.isArray(a)||!a.length)return a;let t={...b,...r},e,l;if(t.strictlyTwoElementsInRangeArrays&&!a.every((o,g)=>!Array.isArray(o)||o.length!==2?(e=g,l=o.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${e}th range (${JSON.stringify(a[e],null,4)}) has not two but ${l} elements!`);if(!a.every((o,g)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(e=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${e}th range (${JSON.stringify(a[e],null,4)}) does not consist of only natural numbers!`);let n=a.length**2,i=0;return Array.from(a).sort((o,g)=>(t.progressFn&&(i+=1,t.progressFn(Math.floor(i*100/n))),o[0]===g[0]?o[1]<g[1]?-1:o[1]>g[1]?1:0:o[0]<g[0]?-1:1))}var d="6.2.3";var c={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function f(a,r){function t(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(a)||!a.length)return null;let e;if(r)if(t(r)){if(e={...c,...r},e.progressFn&&t(e.progressFn)&&!Object.keys(e.progressFn).length)e.progressFn=null;else if(e.progressFn&&typeof e.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof e.progressFn}", equal to ${JSON.stringify(e.progressFn,null,4)}`);if(![1,2,"1","2"].includes(e.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof e.mergeType}", equal to ${JSON.stringify(e.mergeType,null,4)}`);if(typeof e.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof e.joinRangesThatTouchEdges}", equal to ${JSON.stringify(e.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as: | ||
import{collWhitespace as y}from"string-collapse-leading-whitespace";var b={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function h(a,r){if(!Array.isArray(a)||!a.length)return a;let t={...b,...r},e,l;if(t.strictlyTwoElementsInRangeArrays&&!a.every((o,g)=>!Array.isArray(o)||o.length!==2?(e=g,l=o.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${e}th range (${JSON.stringify(a[e],null,4)}) has not two but ${l} elements!`);if(!a.every((o,g)=>!Array.isArray(o)||!Number.isInteger(o[0])||o[0]<0||!Number.isInteger(o[1])||o[1]<0?(e=g,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${e}th range (${JSON.stringify(a[e],null,4)}) does not consist of only natural numbers!`);let n=a.length**2,i=0;return Array.from(a).sort((o,g)=>(t.progressFn&&(i+=1,t.progressFn(Math.floor(i*100/n))),o[0]===g[0]?o[1]<g[1]?-1:o[1]>g[1]?1:0:o[0]<g[0]?-1:1))}var d="6.2.4";var c={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function f(a,r){function t(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(a)||!a.length)return null;let e;if(r)if(t(r)){if(e={...c,...r},e.progressFn&&t(e.progressFn)&&!Object.keys(e.progressFn).length)e.progressFn=null;else if(e.progressFn&&typeof e.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof e.progressFn}", equal to ${JSON.stringify(e.progressFn,null,4)}`);if(![1,2,"1","2"].includes(e.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof e.mergeType}", equal to ${JSON.stringify(e.mergeType,null,4)}`);if(typeof e.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof e.joinRangesThatTouchEdges}", equal to ${JSON.stringify(e.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as: | ||
${JSON.stringify(r,null,4)} (type ${typeof r})`);else e={...c};let l=a.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),n,i,o;e.progressFn?n=h(l,{progressFn:s=>{o=Math.floor(s/5),o!==i&&(i=o,e.progressFn(o))}}):n=h(l);let g=n.length-1;for(let s=g;s>0;s--)e.progressFn&&(o=Math.floor((1-s/g)*78)+21,o!==i&&o>i&&(i=o,e.progressFn(o))),(n[s][0]<=n[s-1][0]||!e.joinRangesThatTouchEdges&&n[s][0]<n[s-1][1]||e.joinRangesThatTouchEdges&&n[s][0]<=n[s-1][1])&&(n[s-1][0]=Math.min(n[s][0],n[s-1][0]),n[s-1][1]=Math.max(n[s][1],n[s-1][1]),n[s][2]!==void 0&&(n[s-1][0]>=n[s][0]||n[s-1][1]<=n[s][1])&&n[s-1][2]!==null&&(n[s][2]===null&&n[s-1][2]!==null?n[s-1][2]=null:n[s-1][2]!=null?+e.mergeType==2&&n[s-1][0]===n[s][0]?n[s-1][2]=n[s][2]:n[s-1][2]+=n[s][2]:n[s-1][2]=n[s][2]),n.splice(s,1),s=n.length);return n.length?n:null}var I=d;function u(a){return a!=null}function p(a){return Number.isInteger(a)&&a>=0}function m(a){return typeof a=="string"}var T={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},$=class{constructor(r){let t={...T,...r};if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(m(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(m(t.mergeType)&&t.mergeType.trim()==="2")t.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);this.opts=t,this.ranges=[]}ranges;opts;add(r,t,e){if(r==null&&t==null)return;if(u(r)&&!u(t)){if(Array.isArray(r)){if(r.length){if(r.some(i=>Array.isArray(i))){r.forEach(i=>{Array.isArray(i)&&this.add(...i)});return}r.length&&p(+r[0])&&p(+r[1])&&this.add(...r)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(r,null,0)}) but second-one, "to" is not (${JSON.stringify(t,null,0)})`)}else if(!u(r)&&u(t))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(t,null,0)}) but first-one, "from" is not (${JSON.stringify(r,null,0)})`);let l=+r,n=+t;if(p(e)&&(e=String(e)),p(l)&&p(n)){if(u(e)&&!m(e)&&!p(e))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof e}, equal to: | ||
@@ -17,3 +17,3 @@ ${JSON.stringify(e,null,4)}`);if(u(this.ranges)&&Array.isArray(this.last())&&l===this.last()[1]){if(this.last()[1]=n,this.last()[2],this.last()[2]!==null&&u(e)){let i=this.last()[2]&&this.last()[2].length&&(!this.opts?.mergeType||this.opts.mergeType===1)?`${this.last()[2]}${e}`:e;this.opts.limitToBeAddedWhitespace&&(i=y(i,this.opts.limitLinebreaksCount)),m(i)&&!i.length||(this.last()[2]=i)}}else{this.ranges||(this.ranges=[]);let i=e!==void 0&&!(m(e)&&!e.length)?[l,n,e&&this.opts.limitToBeAddedWhitespace?y(e,this.opts.limitLinebreaksCount):e]:[l,n];this.ranges.push(i)}}else throw p(l)&&l>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof n}" equal to: ${JSON.stringify(n,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof l}" equal to: ${JSON.stringify(l,null,4)}`)}push(r,t,e){this.add(r,t,e)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=f(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(r=>u(r[2])?[r[0],r[1],y(r[2],this.opts.limitLinebreaksCount)]:r):this.ranges):null}wipe(){this.ranges=[]}replace(r){if(Array.isArray(r)&&r.length)if(Array.isArray(r[0])&&p(r[0][0]))this.ranges=Array.from(r);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(r[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};export{$ as Ranges,T as defaults,I as version}; | ||
* @fileoverview Sort string index ranges | ||
* @version 5.1.2 | ||
* @version 5.1.3 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -20,0 +20,0 @@ * @license MIT |
/** | ||
* @name ranges-push | ||
* @fileoverview Gather string index ranges | ||
* @version 6.2.3 | ||
* @version 6.2.4 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -13,3 +13,3 @@ * @license MIT | ||
`;if(!e)return e;let O=0,y=0,c="";for(let u=0,v=e.length;u<v;u++)(e[u]===a||e[u]===t&&e[u-1]!==a)&&y++,`\r | ||
`.includes(e[u])||e[u]===o?(O=0,e[u]===o?c+=e[u]:e[u]===a?y<=g&&(c+=e[u],e[u+1]===t&&(c+=e[u+1],u++)):e[u]===t&&(e==null?void 0:e[u-1])!==a&&y<=g&&(c+=e[u])):(O++,!e[u+1]&&!y&&(c+=" "));return c}if(typeof r=="string"&&r.length){let e=1;typeof+n=="number"&&Number.isInteger(+n)&&+n>=0&&(e=+n);let g="",i="";if(!r.trim())g=r;else if(!r[0].trim()){for(let a=0,t=r.length;a<t;a++)if(r[a].trim()){g=r.slice(0,a);break}}if(r.trim()&&(r.slice(-1).trim()===""||r.slice(-1)===o)){for(let a=r.length;a--;)if(r[a].trim()){i=r.slice(a+1);break}}return`${l(g,e,!1)}${r.trim()}${s(l(s(i),e,!0))}`}return r}var F={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function T(r,n){if(!Array.isArray(r)||!r.length)return r;let o=p(p({},F),n),s,l;if(o.strictlyTwoElementsInRangeArrays&&!r.every((i,a)=>!Array.isArray(i)||i.length!==2?(s=a,l=i.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) has not two but ${l} elements!`);if(!r.every((i,a)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(s=a,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) does not consist of only natural numbers!`);let e=r.length**2,g=0;return Array.from(r).sort((i,a)=>(o.progressFn&&(g+=1,o.progressFn(Math.floor(g*100/e))),i[0]===a[0]?i[1]<a[1]?-1:i[1]>a[1]?1:0:i[0]<a[0]?-1:1))}var A="6.2.3";var N={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function S(r,n){function o(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}if(!Array.isArray(r)||!r.length)return null;let s;if(n)if(o(n)){if(s=p(p({},N),n),s.progressFn&&o(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as: | ||
`.includes(e[u])||e[u]===o?(O=0,e[u]===o?c+=e[u]:e[u]===a?y<=g&&(c+=e[u],e[u+1]===t&&(c+=e[u+1],u++)):e[u]===t&&(e==null?void 0:e[u-1])!==a&&y<=g&&(c+=e[u])):(O++,!e[u+1]&&!y&&(c+=" "));return c}if(typeof r=="string"&&r.length){let e=1;typeof+n=="number"&&Number.isInteger(+n)&&+n>=0&&(e=+n);let g="",i="";if(!r.trim())g=r;else if(!r[0].trim()){for(let a=0,t=r.length;a<t;a++)if(r[a].trim()){g=r.slice(0,a);break}}if(r.trim()&&(r.slice(-1).trim()===""||r.slice(-1)===o)){for(let a=r.length;a--;)if(r[a].trim()){i=r.slice(a+1);break}}return`${l(g,e,!1)}${r.trim()}${s(l(s(i),e,!0))}`}return r}var F={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function T(r,n){if(!Array.isArray(r)||!r.length)return r;let o=p(p({},F),n),s,l;if(o.strictlyTwoElementsInRangeArrays&&!r.every((i,a)=>!Array.isArray(i)||i.length!==2?(s=a,l=i.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) has not two but ${l} elements!`);if(!r.every((i,a)=>!Array.isArray(i)||!Number.isInteger(i[0])||i[0]<0||!Number.isInteger(i[1])||i[1]<0?(s=a,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(r[s],null,4)}) does not consist of only natural numbers!`);let e=r.length**2,g=0;return Array.from(r).sort((i,a)=>(o.progressFn&&(g+=1,o.progressFn(Math.floor(g*100/e))),i[0]===a[0]?i[1]<a[1]?-1:i[1]>a[1]?1:0:i[0]<a[0]?-1:1))}var A="6.2.4";var N={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function S(r,n){function o(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}if(!Array.isArray(r)||!r.length)return null;let s;if(n)if(o(n)){if(s=p(p({},N),n),s.progressFn&&o(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof s.progressFn}", equal to ${JSON.stringify(s.progressFn,null,4)}`);if(![1,2,"1","2"].includes(s.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof s.mergeType}", equal to ${JSON.stringify(s.mergeType,null,4)}`);if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof s.joinRangesThatTouchEdges}", equal to ${JSON.stringify(s.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as: | ||
${JSON.stringify(n,null,4)} (type ${typeof n})`);else s=p({},N);let l=r.filter(t=>Array.isArray(t)).map(t=>[...t]).filter(t=>t[2]!==void 0||t[0]!==t[1]),e,g,i;s.progressFn?e=T(l,{progressFn:t=>{i=Math.floor(t/5),i!==g&&(g=i,s.progressFn(i))}}):e=T(l);let a=e.length-1;for(let t=a;t>0;t--)s.progressFn&&(i=Math.floor((1-t/a)*78)+21,i!==g&&i>g&&(g=i,s.progressFn(i))),(e[t][0]<=e[t-1][0]||!s.joinRangesThatTouchEdges&&e[t][0]<e[t-1][1]||s.joinRangesThatTouchEdges&&e[t][0]<=e[t-1][1])&&(e[t-1][0]=Math.min(e[t][0],e[t-1][0]),e[t-1][1]=Math.max(e[t][1],e[t-1][1]),e[t][2]!==void 0&&(e[t-1][0]>=e[t][0]||e[t-1][1]<=e[t][1])&&e[t-1][2]!==null&&(e[t][2]===null&&e[t-1][2]!==null?e[t-1][2]=null:e[t-1][2]!=null?+s.mergeType==2&&e[t-1][0]===e[t][0]?e[t-1][2]=e[t][2]:e[t-1][2]+=e[t][2]:e[t-1][2]=e[t][2]),e.splice(t,1),t=e.length);return e.length?e:null}var H=A;function m(r){return r!=null}function h(r){return Number.isInteger(r)&&r>=0}function f(r){return typeof r=="string"}var V={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},E=class{constructor(n){R(this,"ranges");R(this,"opts");let o=p(p({},V),n);if(o.mergeType&&o.mergeType!==1&&o.mergeType!==2)if(f(o.mergeType)&&o.mergeType.trim()==="1")o.mergeType=1;else if(f(o.mergeType)&&o.mergeType.trim()==="2")o.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);this.opts=o,this.ranges=[]}add(n,o,s){var g;if(n==null&&o==null)return;if(m(n)&&!m(o)){if(Array.isArray(n)){if(n.length){if(n.some(i=>Array.isArray(i))){n.forEach(i=>{Array.isArray(i)&&this.add(...i)});return}n.length&&h(+n[0])&&h(+n[1])&&this.add(...n)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(n,null,0)}) but second-one, "to" is not (${JSON.stringify(o,null,0)})`)}else if(!m(n)&&m(o))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(o,null,0)}) but first-one, "from" is not (${JSON.stringify(n,null,0)})`);let l=+n,e=+o;if(h(s)&&(s=String(s)),h(l)&&h(e)){if(m(s)&&!f(s)&&!h(s))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof s}, equal to: | ||
@@ -20,3 +20,3 @@ ${JSON.stringify(s,null,4)}`);if(m(this.ranges)&&Array.isArray(this.last())&&l===this.last()[1]){if(this.last()[1]=e,this.last()[2],this.last()[2]!==null&&m(s)){let i=this.last()[2]&&this.last()[2].length&&(!((g=this.opts)!=null&&g.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${s}`:s;this.opts.limitToBeAddedWhitespace&&(i=$(i,this.opts.limitLinebreaksCount)),f(i)&&!i.length||(this.last()[2]=i)}}else{this.ranges||(this.ranges=[]);let i=s!==void 0&&!(f(s)&&!s.length)?[l,e,s&&this.opts.limitToBeAddedWhitespace?$(s,this.opts.limitLinebreaksCount):s]:[l,e];this.ranges.push(i)}}else throw h(l)&&l>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof e}" equal to: ${JSON.stringify(e,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof l}" equal to: ${JSON.stringify(l,null,4)}`)}push(n,o,s){this.add(n,o,s)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=S(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(n=>m(n[2])?[n[0],n[1],$(n[2],this.opts.limitLinebreaksCount)]:n):this.ranges):null}wipe(){this.ranges=[]}replace(n){if(Array.isArray(n)&&n.length)if(Array.isArray(n[0])&&h(n[0][0]))this.ranges=Array.from(n);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(n[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};return j(k);})(); | ||
* @fileoverview Sort string index ranges | ||
* @version 5.1.2 | ||
* @version 5.1.3 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -29,3 +29,3 @@ * @license MIT | ||
* @fileoverview Collapse the leading and trailing whitespace of a string | ||
* @version 6.1.3 | ||
* @version 6.1.4 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -32,0 +32,0 @@ * @license MIT |
{ | ||
"name": "ranges-push", | ||
"version": "6.2.3", | ||
"version": "6.2.4", | ||
"description": "Gather string index ranges", | ||
@@ -72,5 +72,5 @@ "keywords": [ | ||
"dependencies": { | ||
"string-collapse-leading-whitespace": "^6.1.3", | ||
"string-trim-spaces-only": "^4.1.2" | ||
"string-collapse-leading-whitespace": "^6.1.4", | ||
"string-trim-spaces-only": "^4.1.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34162