string-split-by-whitespace 4.2.2 → 4.2.4
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
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
|
+
**No 3rd party dependencies.** All dependencies and devDependencies, checked recursively, are Codsen packages.
|
|
25
|
+
|
|
24
26
|
## Install
|
|
25
27
|
|
|
26
28
|
This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 2.1.0 (`npm i string-split-by-whitespace@2.1.0`).
|
|
@@ -43,7 +45,7 @@ assert.deepEqual(splitByW("\n \n a\t \nb \n \t"), ["a", "b"]);
|
|
|
43
45
|
|
|
44
46
|
## Documentation
|
|
45
47
|
|
|
46
|
-
Please [visit codsen.com](https://codsen.com/os/string-split-by-whitespace/) for a full description of the API.
|
|
48
|
+
Please [visit codsen.com](https://codsen.com/os/string-split-by-whitespace/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/string-split-by-whitespace/CHANGELOG.md) or [the website](https://codsen.com/os/string-split-by-whitespace/changelog).
|
|
47
49
|
|
|
48
50
|
## Contributing
|
|
49
51
|
|
|
@@ -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.2.
|
|
4
|
+
* @version 4.2.4
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-split-by-whitespace/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{isIndexWithin as p}from"ranges-is-index-within";var o="4.2.
|
|
10
|
+
import{isIndexWithin as p}from"ranges-is-index-within";var o="4.2.4";var h=o,g={ignoreRanges:[]};function y(t,l){if(t===void 0)throw new Error("string-split-by-whitespace/splitByW(): [THROW_ID_01] The input is missing!");if(typeof t!="string")return t;if(t.trim()==="")return[];let n={...g,...l};if(n.ignoreRanges.length&&!n.ignoreRanges.every(e=>Array.isArray(e)))throw new Error("string-split-by-whitespace/splitByW(): [THROW_ID_02] The resolvedOpts.ignoreRanges contains elements which are not arrays!");let s=null,i=[];for(let e=0,c=t.length;e<c;e++)s===null&&t[e].trim()&&(!n?.ignoreRanges?.length||n.ignoreRanges.length&&!p(e,n.ignoreRanges.map(r=>[r[0],r[1]-1]),{inclusiveRangeEnds:!0}))&&(s=e),s!==null&&(t[e].trim()?n.ignoreRanges.length&&p(e,n.ignoreRanges)?(i.push(t.slice(s,e-1)),s=null):t[e+1]===void 0&&i.push(t.slice(s,e+1)):(i.push(t.slice(s,e)),s=null));return i}export{g as defaults,y as splitByW,h 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.2.
|
|
4
|
+
* @version 4.2.4
|
|
5
5
|
* @author Roy Revelt
|
|
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 l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var d=(e,n,t)=>n in e?l(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,c=(e,n)=>{for(var t in n||(n={}))m.call(n,t)&&d(e,t,n[t]);if(u)for(var t of u(n))w.call(n,t)&&d(e,t,n[t]);return e};var v=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},R=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of b(n))!m.call(e,r)&&r!==t&&l(e,r,{get:()=>n[r],enumerable:!(i=y(n,r))||i.enumerable});return e};var x=e=>R(l({},"__esModule",{value:!0}),e);var T={};v(T,{defaults:()=>f,splitByW:()=>I,version:()=>k});function g(e,n,t){var p,s;if(!Number.isInteger(e)||e<0)throw new TypeError("ranges-is-index-within/isIndexWithin(): [THROW_ID_01] The first input argument should be a string index: a natural number or zero. It was ".concat(e," (type ").concat(typeof e,")."));if(!Array.isArray(n))return!1;let i=(p=t==null?void 0:t.inclusiveRangeEnds)!=null?p:!1,r=(s=t==null?void 0:t.returnMatchedRangeInsteadOfTrue)!=null?s:!1;for(let a=0;a<n.length;a++){let o=n[a];if(i?e>=o[0]&&e<=o[1]:e>o[0]&&e<o[1])return r?o:!0}return!1}var h="4.2.
|
|
10
|
+
"use strict";var stringSplitByWhitespace=(()=>{var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var d=(e,n,t)=>n in e?l(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,c=(e,n)=>{for(var t in n||(n={}))m.call(n,t)&&d(e,t,n[t]);if(u)for(var t of u(n))w.call(n,t)&&d(e,t,n[t]);return e};var v=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},R=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of b(n))!m.call(e,r)&&r!==t&&l(e,r,{get:()=>n[r],enumerable:!(i=y(n,r))||i.enumerable});return e};var x=e=>R(l({},"__esModule",{value:!0}),e);var T={};v(T,{defaults:()=>f,splitByW:()=>I,version:()=>k});function g(e,n,t){var p,s;if(!Number.isInteger(e)||e<0)throw new TypeError("ranges-is-index-within/isIndexWithin(): [THROW_ID_01] The first input argument should be a string index: a natural number or zero. It was ".concat(e," (type ").concat(typeof e,")."));if(!Array.isArray(n))return!1;let i=(p=t==null?void 0:t.inclusiveRangeEnds)!=null?p:!1,r=(s=t==null?void 0:t.returnMatchedRangeInsteadOfTrue)!=null?s:!1;for(let a=0;a<n.length;a++){let o=n[a];if(i?e>=o[0]&&e<=o[1]:e>o[0]&&e<o[1])return r?o:!0}return!1}var h="4.2.4";var k=h,f={ignoreRanges:[]};function I(e,n){var p;if(e===void 0)throw new Error("string-split-by-whitespace/splitByW(): [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(e.trim()==="")return[];let t=c(c({},f),n);if(t.ignoreRanges.length&&!t.ignoreRanges.every(s=>Array.isArray(s)))throw new Error("string-split-by-whitespace/splitByW(): [THROW_ID_02] The resolvedOpts.ignoreRanges contains elements which are not arrays!");let i=null,r=[];for(let s=0,a=e.length;s<a;s++)i===null&&e[s].trim()&&(!((p=t==null?void 0:t.ignoreRanges)!=null&&p.length)||t.ignoreRanges.length&&!g(s,t.ignoreRanges.map(o=>[o[0],o[1]-1]),{inclusiveRangeEnds:!0}))&&(i=s),i!==null&&(e[s].trim()?t.ignoreRanges.length&&g(s,t.ignoreRanges)?(r.push(e.slice(i,s-1)),i=null):e[s+1]===void 0&&r.push(e.slice(i,s+1)):(r.push(e.slice(i,s)),i=null));return r}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.2.
|
|
14
|
+
* @version 4.2.1
|
|
15
15
|
* @author Roy Revelt
|
|
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.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Split string into array by chunks of whitespace",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alt",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"ranges-is-index-within": "^4.2.
|
|
73
|
+
"ranges-is-index-within": "^4.2.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"string-find-heads-tails": "^6.2.
|
|
76
|
+
"string-find-heads-tails": "^6.2.4"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=18.20.8"
|