string-trim-spaces-only 5.1.3 → 5.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/CHANGELOG.md CHANGED
@@ -3,11 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## 5.1.0 (2025-10-15)
6
+ ## 5.2.0 (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
+ - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
12
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
13
+ - standardise trim validation errs ([1e73be7](https://github.com/codsen/codsen/commit/1e73be76fbecb5fe65f6507b90a8e2a70a30a076))
7
14
 
8
15
  ### Features
9
16
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
17
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
18
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
19
+
20
+ ### Reverts
21
+
22
+ - Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
23
+ - Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
11
24
 
12
25
  ## 5.0.0 (2022-12-01)
13
26
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2026 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -32,7 +32,7 @@ npm i string-trim-spaces-only
32
32
  ## Quick Take
33
33
 
34
34
  ```js
35
- import { strict as assert } from "assert";
35
+ import { strict as assert } from "node:assert";
36
36
 
37
37
  import { trimSpaces } from "string-trim-spaces-only";
38
38
 
@@ -43,19 +43,12 @@ assert.deepEqual(trimSpaces(" aaa "), {
43
43
  [5, 8],
44
44
  ],
45
45
  });
46
-
47
- assert.deepEqual(trimSpaces(" \t zz \n "), {
48
- res: "\t zz \n",
49
- ranges: [
50
- [0, 3],
51
- [12, 16],
52
- ],
53
- });
54
46
  ```
55
47
 
48
+
56
49
  ## Documentation
57
50
 
58
- Please [visit codsen.com](https://codsen.com/os/string-trim-spaces-only/) for a full description of the API.
51
+ Please [visit codsen.com](https://codsen.com/os/string-trim-spaces-only/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/string-trim-spaces-only/CHANGELOG.md).
59
52
 
60
53
  ## Contributing
61
54
 
@@ -65,6 +58,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
65
58
 
66
59
  MIT License
67
60
 
68
- Copyright © 2010-2025 Roy Revelt and other contributors
61
+ Copyright © 2010-2026 Roy Revelt and other contributors
69
62
 
70
63
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -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 5.1.3
4
+ * @version 5.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-trim-spaces-only/}
8
8
  */
9
9
 
10
- var i="5.1.3";var g=i,p={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
- ${JSON.stringify(e,null,4)}`);let n={...p,...l};function o(t){return n.classicTrim&&!t.trim()||!n.classicTrim&&(n.space&&t===" "||n.cr&&t==="\r"||n.lf&&t===`
12
- `||n.tab&&t===" "||n.nbsp&&t==="\xA0")}let r,s;if(e.length){if(o(e[0]))for(let t=0,c=e.length;t<c;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{p as defaults,d as trimSpaces,g as version};
10
+ import{formatDiagnosticValue as m}from"codsen-utils";var i="5.2.0";var b=i,p={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function f(e,l){if(typeof e!="string")throw new Error(`string-trim-spaces-only/trimSpaces(): [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
11
+ ${m(e,4)}`);let n={...p,...l};function o(t){return n.classicTrim&&!t.trim()||!n.classicTrim&&(n.space&&t===" "||n.cr&&t==="\r"||n.lf&&t===`
12
+ `||n.tab&&t===" "||n.nbsp&&t==="\xA0")}let r,s;if(e.length){if(o(e[0]))for(let t=0,c=e.length;t<c;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{p as defaults,f as trimSpaces,b as version};
@@ -1,10 +1,18 @@
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 5.1.3
4
+ * @version 5.2.0
5
5
  * @author Roy Revelt
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 f=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var p=(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={}))u.call(n,t)&&p(e,t,n[t]);if(a)for(var t of a(n))$.call(n,t)&&p(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 f(n))!u.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 D={};y(D,{defaults:()=>g,trimSpaces:()=>x,version:()=>v});var m="5.1.3";var v=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 ".concat(typeof e,", equal to:\n").concat(JSON.stringify(e,null,4)));let t=c(c({},g),n);function o(s){return t.classicTrim&&!s.trim()||!t.classicTrim&&(t.space&&s===" "||t.cr&&s==="\r"||t.lf&&s==="\n"||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(D);})();
10
+ "use strict";var stringTrimSpacesOnly=(()=>{var d=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames,$=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var A=(t,n,e)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,b=(t,n)=>{for(var e in n||(n={}))S.call(n,e)&&A(t,e,n[e]);if($)for(var e of $(n))B.call(n,e)&&A(t,e,n[e]);return t};var I=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},L=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of M(n))!S.call(t,o)&&o!==e&&d(t,o,{get:()=>n[o],enumerable:!(i=W(n,o))||i.enumerable});return t};var T=t=>L(d({},"__esModule",{value:!0}),t);var H={};I(H,{defaults:()=>D,trimSpaces:()=>_,version:()=>F});function V(){let t=[],n=0,e=!1;return{append(i){return e?!1:n+i.length>1999?(t.push("\u2026"),n+=1,e=!0,!1):(t.push(i),n+=i.length,!0)},result(){return t.join("")},stopped(){return e}}}function N(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function m(t,n){if(t.append('"')){for(let e=0;e<n.length&&!t.stopped();e+=1){let i=n.charCodeAt(e);i===34?t.append('\\"'):i===92?t.append("\\\\"):i===8?t.append("\\b"):i===9?t.append("\\t"):i===10?t.append("\\n"):i===12?t.append("\\f"):i===13?t.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?t.append(N(i)):t.append(n[e])}t.append('"')}}function P(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function x(t,n){t.append("Symbol(");let e=String(n);e.length>8&&m(t,e.slice(7,-1)),t.append(")")}function k(t,n){typeof n=="symbol"?x(t,n):m(t,String(n))}function C(t,n=0){let e=V(),i=n===4?4:0,o=new WeakSet,u=0;function l(r){i&&e.append(" ".repeat(r*i))}function g(r,s){r&&e.append(","),i&&(e.append("\n"),l(s+1))}function y(r,s,a){i&&s&&(e.append("\n"),l(a)),e.append(r)}function v(r,s){Object.prototype.hasOwnProperty.call(r,"value")?w(r.value,s):e.append(P(r))}function E(r,s){let a;try{a=Reflect.getOwnPropertyDescriptor(r,"length")}catch(c){e.append("[Uninspectable]");return}let f=a==null?void 0:a.value;if(!Number.isSafeInteger(f)||f<0){e.append("[Uninspectable]");return}e.append("[");let p=!1;for(let c=0;c<f&&!e.stopped();c+=1){if(g(p,s),p=!0,u>=50){e.append("[MaxEntries]");break}u+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(r,String(c))}catch(J){e.append("[Uninspectable]");continue}h!=null&&h.enumerable?v(h,s+1):e.append("[Empty]")}y("]",p,s)}function j(r,s){let a;try{a=Reflect.ownKeys(r)}catch(p){e.append("[Uninspectable]");return}e.append("{");let f=!1;for(let p of a){if(e.stopped())break;if(u>=50){g(f,s),f=!0,m(e,"\u2026"),e.append(i?": ":":"),e.append("[MaxEntries]");break}u+=1;let c;try{c=Reflect.getOwnPropertyDescriptor(r,p)}catch(h){g(f,s),f=!0,k(e,p),e.append(i?": ":":"),e.append("[Uninspectable]");continue}c!=null&&c.enumerable&&(g(f,s),f=!0,k(e,p),e.append(i?": ":":"),v(c,s+1))}y("}",f,s)}function R(r,s){if(o.has(r)){e.append("[Circular]");return}if(s>=5){e.append("[MaxDepth]");return}let a;try{a=Array.isArray(r)}catch(f){e.append("[Uninspectable]");return}o.add(r);try{a?E(r,s):j(r,s)}finally{o.delete(r)}}function w(r,s){r===null?e.append("null"):typeof r=="string"?m(e,r):typeof r=="number"?e.append(Object.is(r,-0)?"-0":String(r)):typeof r=="boolean"?e.append(r?"true":"false"):typeof r>"u"?e.append("undefined"):typeof r=="bigint"?e.append("".concat(r,"n")):typeof r=="symbol"?x(e,r):typeof r=="function"?e.append("[Function]"):R(r,s)}try{return w(t,0),e.result()}catch(r){return"[Uninspectable]"}}var q=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var O="5.2.0";var F=O,D={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function _(t,n){if(typeof t!="string")throw new Error("string-trim-spaces-only/trimSpaces(): [THROW_ID_01] input must be string! It was given as ".concat(typeof t,", equal to:\n").concat(C(t,4)));let e=b(b({},D),n);function i(l){return e.classicTrim&&!l.trim()||!e.classicTrim&&(e.space&&l===" "||e.cr&&l==="\r"||e.lf&&l==="\n"||e.tab&&l===" "||e.nbsp&&l==="\xA0")}let o,u;if(t.length){if(i(t[0]))for(let l=0,g=t.length;l<g;l++){if(!i(t[l])){o=l;break}if(l===t.length-1)return{res:"",ranges:[[0,t.length]]}}if(i(t[t.length-1])){for(let l=t.length;l--;)if(!i(t[l])){u=l+1;break}}return o?u?{res:t.slice(o,u),ranges:[[0,o],[u,t.length]]}:{res:t.slice(o),ranges:[[0,o]]}:u?{res:t.slice(0,u),ranges:[[u,t.length]]}:{res:t,ranges:[]}}return{res:"",ranges:[]}}return T(H);})();
11
+ /**
12
+ * @name codsen-utils
13
+ * @fileoverview Various utility functions
14
+ * @version 1.8.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-utils/}
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-trim-spaces-only",
3
- "version": "5.1.3",
3
+ "version": "5.2.0",
4
4
  "description": "Like String.trim() but you can choose granularly what to trim",
5
5
  "keywords": [
6
6
  "characters",
@@ -34,41 +34,46 @@
34
34
  },
35
35
  "types": "types/index.d.ts",
36
36
  "scripts": {
37
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
38
- "cjs-off": "exit 0",
39
- "cjs-on": "exit 0",
40
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
37
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
38
+ "coverage": "c8 uvu test",
39
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
41
40
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
42
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
41
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
43
42
  "examples": "node '../../ops/scripts/run-examples.js'",
44
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
- "letspublish": "npm publish --provenance || :",
46
- "lint": "eslint . --fix --concurrency=auto --cache",
43
+ "lect": "node '../../ops/lect/lect.js'",
44
+ "lect:check": "node '../../ops/lect/lect.js' --check",
45
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
46
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
47
47
  "perf": "node perf/check.js",
48
48
  "prep": "echo 'ready'",
49
- "prettier": "prettier",
50
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
51
- "pretest": "npm run lect && npm run build",
49
+ "prettier": "biome format",
50
+ "prettier:format": "biome format --write .",
51
+ "pretest": "npm run lect:check && npm run build",
52
52
  "test": "npm run devtest",
53
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
53
54
  "unit": "uvu test"
54
55
  },
55
- "engines": {
56
- "node": ">=14.18.0"
57
- },
58
56
  "c8": {
57
+ "all": true,
58
+ "branches": 100,
59
59
  "check-coverage": true,
60
- "exclude": [
61
- "**/test/**/*.*"
62
- ],
63
- "lines": 100
60
+ "exclude": ["**/test/**/*.*"],
61
+ "functions": 100,
62
+ "include": ["dist/*.esm.js"],
63
+ "lines": 100,
64
+ "statements": 100
64
65
  },
65
66
  "lect": {
66
67
  "licence": {
67
- "extras": [
68
- ""
69
- ]
68
+ "extras": [""]
70
69
  }
71
70
  },
71
+ "dependencies": {
72
+ "codsen-utils": "^1.8.0"
73
+ },
74
+ "engines": {
75
+ "node": ">=18.20.8"
76
+ },
72
77
  "publishConfig": {
73
78
  "registry": "https://registry.npmjs.org/"
74
79
  }