string-trim-spaces-only 4.1.2 → 4.1.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/CHANGELOG.md CHANGED
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
  ## 4.0.13 (2022-04-18)
13
13
 
14
- ### Bug Fixes
14
+ ### Fixed
15
15
 
16
16
  - tweak types ([e1e4166](https://github.com/codsen/codsen/commit/e1e4166157c90b0a8561b1d4c65defeffae84112))
17
17
 
@@ -23,7 +23,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
23
23
 
24
24
  ### BREAKING CHANGES
25
25
 
26
- - programs now are in ES Modules and won't work with Common JS require()
26
+ - programs now are in ES Modules and won't work with Common JS `require()`
27
27
 
28
28
  ## 3.1.0 (2021-05-24)
29
29
 
@@ -39,9 +39,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
39
39
 
40
40
  ## 3.0.1 (2021-01-28)
41
41
 
42
- ### Bug Fixes
42
+ ### Fixed
43
43
 
44
- - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
44
+ - add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
45
45
 
46
46
  ## 3.0.0 (2021-01-23)
47
47
 
@@ -55,7 +55,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55
55
 
56
56
  ## 2.9.0 (2020-11-28)
57
57
 
58
- Accidental version bump during migration to sourcehut. Sorry about that.
58
+ Accidental version bump during migration to SourceHut. Sorry about that.
59
59
 
60
60
  ## 2.8.0 (2019-09-11)
61
61
 
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * @name string-trim-spaces-only
3
3
  * @fileoverview Like String.trim() but you can choose granularly what to trim
4
- * @version 4.1.2
4
+ * @version 4.1.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-trim-spaces-only/}
8
8
  */
9
9
 
10
- var i="4.1.2";var g=i,u={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function d(e,l){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
10
+ var i="4.1.4";var g=i,u={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function d(e,l){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
11
11
  ${JSON.stringify(e,null,4)}`);let n={...u,...l};function o(t){return n.classicTrim&&!t.trim()||!n.classicTrim&&(n.space&&t===" "||n.cr&&t==="\r"||n.lf&&t===`
12
12
  `||n.tab&&t===" "||n.nbsp&&t==="\xA0")}let r,s;if(e.length){if(o(e[0]))for(let t=0,a=e.length;t<a;t++){if(!o(e[t])){r=t;break}if(t===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(o(e[e.length-1])){for(let t=e.length;t--;)if(!o(e[t])){s=t+1;break}}return r?s?{res:e.slice(r,s),ranges:[[0,r],[s,e.length]]}:{res:e.slice(r),ranges:[[0,r]]}:s?{res:e.slice(0,s),ranges:[[s,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}export{u as defaults,d as trimSpaces,g as version};
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * @name string-trim-spaces-only
3
3
  * @fileoverview Like String.trim() but you can choose granularly what to trim
4
- * @version 4.1.2
4
+ * @version 4.1.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-trim-spaces-only/}
8
8
  */
9
9
 
10
- "use strict";var stringTrimSpacesOnly=(()=>{var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var u=(e,n,t)=>n in e?l(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))p.call(n,t)&&u(e,t,n[t]);if(c)for(var t of c(n))f.call(n,t)&&u(e,t,n[t]);return e};var y=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of $(n))!p.call(e,r)&&r!==t&&l(e,r,{get:()=>n[r],enumerable:!(o=b(n,r))||o.enumerable});return e};var E=e=>h(l({},"__esModule",{value:!0}),e);var S={};y(S,{defaults:()=>g,trimSpaces:()=>x,version:()=>D});var m="4.1.2";var D=m,g={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function x(e,n){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
10
+ "use strict";var stringTrimSpacesOnly=(()=>{var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var u=(e,n,t)=>n in e?l(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))p.call(n,t)&&u(e,t,n[t]);if(c)for(var t of c(n))f.call(n,t)&&u(e,t,n[t]);return e};var y=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of $(n))!p.call(e,r)&&r!==t&&l(e,r,{get:()=>n[r],enumerable:!(o=b(n,r))||o.enumerable});return e};var E=e=>h(l({},"__esModule",{value:!0}),e);var S={};y(S,{defaults:()=>g,trimSpaces:()=>D,version:()=>x});var m="4.1.4";var x=m,g={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function D(e,n){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
11
11
  ${JSON.stringify(e,null,4)}`);let t=a(a({},g),n);function o(s){return t.classicTrim&&!s.trim()||!t.classicTrim&&(t.space&&s===" "||t.cr&&s==="\r"||t.lf&&s===`
12
12
  `||t.tab&&s===" "||t.nbsp&&s==="\xA0")}let r,i;if(e.length){if(o(e[0]))for(let s=0,d=e.length;s<d;s++){if(!o(e[s])){r=s;break}if(s===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(o(e[e.length-1])){for(let s=e.length;s--;)if(!o(e[s])){i=s+1;break}}return r?i?{res:e.slice(r,i),ranges:[[0,r],[i,e.length]]}:{res:e.slice(r),ranges:[[0,r]]}:i?{res:e.slice(0,i),ranges:[[i,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}return E(S);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-trim-spaces-only",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "Like String.trim() but you can choose granularly what to trim",
5
5
  "keywords": [
6
6
  "characters",
@@ -41,7 +41,7 @@
41
41
  "examples": "node '../../ops/scripts/run-examples.js'",
42
42
  "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
43
43
  "letspublish": "yarn publish || :",
44
- "lint": "eslint . --fix",
44
+ "lint": "eslint . --ext .js --ext .ts --fix",
45
45
  "perf": "node perf/check.js",
46
46
  "prepare": "echo 'ready'",
47
47
  "prettier": "prettier",
@@ -1,21 +0,0 @@
1
- // Quick Take
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { trimSpaces } from "../dist/string-trim-spaces-only.esm.js";
6
-
7
- assert.deepEqual(trimSpaces(" aaa "), {
8
- res: "aaa",
9
- ranges: [
10
- [0, 2],
11
- [5, 8],
12
- ],
13
- });
14
-
15
- assert.deepEqual(trimSpaces(" \t zz \n "), {
16
- res: "\t zz \n",
17
- ranges: [
18
- [0, 3],
19
- [12, 16],
20
- ],
21
- });