string-split-by-whitespace 4.0.22 → 4.0.32
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name string-split-by-whitespace
|
|
3
3
|
* @fileoverview Split string into array by chunks of whitespace
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.32
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-split-by-whitespace/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{isIndexWithin as
|
|
10
|
+
import{isIndexWithin as o}from"ranges-is-index-within";var p="4.0.32";var y=p,g={ignoreRanges:[]};function b(t,l){if(t===void 0)throw new Error("string-split-by-whitespace: [THROW_ID_01] The input is missing!");if(typeof t!="string")return t;if(t.trim()==="")return[];let s={...g,...l};if(s.ignoreRanges.length&&!s.ignoreRanges.every(e=>Array.isArray(e)))throw new Error("string-split-by-whitespace: [THROW_ID_03] The resolvedOpts.ignoreRanges contains elements which are not arrays!");let n=null,i=[];for(let e=0,a=t.length;e<a;e++)n===null&&t[e].trim()&&(!s?.ignoreRanges?.length||s.ignoreRanges.length&&!o(e,s.ignoreRanges.map(r=>[r[0],r[1]-1]),{inclusiveRangeEnds:!0}))&&(n=e),n!==null&&(t[e].trim()?s.ignoreRanges.length&&o(e,s.ignoreRanges)?(i.push(t.slice(n,e-1)),n=null):t[e+1]===void 0&&i.push(t.slice(n,e+1)):(i.push(t.slice(n,e)),n=null));return i}export{g as defaults,b as splitByW,y as version};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name string-split-by-whitespace
|
|
3
3
|
* @fileoverview Split string into array by chunks of whitespace
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.32
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-split-by-whitespace/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var stringSplitByWhitespace=(()=>{var o=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames,
|
|
10
|
+
"use strict";var stringSplitByWhitespace=(()=>{var o=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var c=(e,t,n)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))d.call(t,n)&&c(e,n,t[n]);if(g)for(var n of g(t))b.call(t,n)&&c(e,n,t[n]);return e};var v=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of R(t))!d.call(e,s)&&s!==n&&o(e,s,{get:()=>t[s],enumerable:!(i=y(t,s))||i.enumerable});return e};var x=e=>w(o({},"__esModule",{value:!0}),e);var T={};v(T,{defaults:()=>h,splitByW:()=>O,version:()=>E});var j={inclusiveRangeEnds:!1,returnMatchedRangeInsteadOfTrue:!1};function a(e,t,n){let i=p(p({},j),n);if(!Number.isInteger(e))throw new Error("ranges-is-index-within: [THROW_ID_01] the first input argument should be string index, a natural number (or zero). It was given as ".concat(e," (type ").concat(typeof e,")"));return Array.isArray(t)?i.returnMatchedRangeInsteadOfTrue?t.find(s=>i.inclusiveRangeEnds?e>=s[0]&&e<=s[1]:e>s[0]&&e<s[1])||!1:t.some(s=>i.inclusiveRangeEnds?e>=s[0]&&e<=s[1]:e>s[0]&&e<s[1]):!1}var m="4.0.32";var E=m,h={ignoreRanges:[]};function O(e,t){var l;if(e===void 0)throw new Error("string-split-by-whitespace: [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(e.trim()==="")return[];let n=p(p({},h),t);if(n.ignoreRanges.length&&!n.ignoreRanges.every(r=>Array.isArray(r)))throw new Error("string-split-by-whitespace: [THROW_ID_03] The resolvedOpts.ignoreRanges contains elements which are not arrays!");let i=null,s=[];for(let r=0,f=e.length;r<f;r++)i===null&&e[r].trim()&&(!((l=n==null?void 0:n.ignoreRanges)!=null&&l.length)||n.ignoreRanges.length&&!a(r,n.ignoreRanges.map(u=>[u[0],u[1]-1]),{inclusiveRangeEnds:!0}))&&(i=r),i!==null&&(e[r].trim()?n.ignoreRanges.length&&a(r,n.ignoreRanges)?(s.push(e.slice(i,r-1)),i=null):e[r+1]===void 0&&s.push(e.slice(i,r+1)):(s.push(e.slice(i,r)),i=null));return s}return x(T);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name ranges-is-index-within
|
|
13
13
|
* @fileoverview Checks if index is within any of the given string index ranges
|
|
14
|
-
* @version 4.0.
|
|
14
|
+
* @version 4.0.22
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/ranges-is-index-within/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "string-split-by-whitespace",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.32",
|
|
4
4
|
"description": "Split string into array by chunks of whitespace",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alt",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
|
|
47
47
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
48
48
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
49
|
-
"letspublish": "npm publish || :",
|
|
49
|
+
"letspublish": "npm publish --provenance || :",
|
|
50
50
|
"lint": "eslint . --fix",
|
|
51
51
|
"perf": "node perf/check.js",
|
|
52
52
|
"prep": "echo 'ready'",
|
|
@@ -74,9 +74,12 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"ranges-is-index-within": "^4.0.
|
|
77
|
+
"ranges-is-index-within": "^4.0.22"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"string-find-heads-tails": "^6.0.
|
|
80
|
+
"string-find-heads-tails": "^6.0.32"
|
|
81
|
+
},
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"registry": "https://registry.npmjs.org/"
|
|
81
84
|
}
|
|
82
85
|
}
|
package/types/index.d.ts
CHANGED