string-trim-spaces-only 5.3.0 → 5.3.1
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, 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, 3.1.0 (`npm i string-trim-spaces-only@3.1.0`).
|
|
@@ -48,7 +50,7 @@ assert.deepEqual(trimSpaces(" aaa "), {
|
|
|
48
50
|
|
|
49
51
|
## Documentation
|
|
50
52
|
|
|
51
|
-
Please [visit codsen.com](https://codsen.com/os/string-trim-spaces-only/) for a full description of the API.
|
|
53
|
+
Please [visit codsen.com](https://codsen.com/os/string-trim-spaces-only/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/string-trim-spaces-only/CHANGELOG.md) or [the website](https://codsen.com/os/string-trim-spaces-only/changelog).
|
|
52
54
|
|
|
53
55
|
## Contributing
|
|
54
56
|
|
|
@@ -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.3.
|
|
4
|
+
* @version 5.3.1
|
|
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
|
-
import{formatDiagnosticValue as h}from"codsen-format-diagnostic-value";var m="5.3.
|
|
10
|
+
import{formatDiagnosticValue as h}from"codsen-format-diagnostic-value";var m="5.3.1";var D=m,u={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function V(t,i){if(typeof t!="string")throw new Error(`string-trim-spaces-only/trimSpaces(): [THROW_ID_01] input must be string! It was given as ${typeof t}, equal to:
|
|
11
11
|
${h(t,4)}`);let p=i?{...u,...i}:u,{classicTrim:l,cr:d,lf:g,tab:f,space:b,nbsp:$}=p;function c(e){return l&&!e.trim()||!l&&(b&&e===" "||d&&e==="\r"||g&&e===`
|
|
12
12
|
`||f&&e===" "||$&&e==="\xA0")}let s=t.length;if(s){let e=0;for(;e<s&&c(t[e]);)e+=1;if(e===s)return{res:"",ranges:[[0,s]]};let n=s;for(;n>e;){let a=n-1;if(!c(t[a])){n<s;break}n=a}let o=e||void 0,r=n<s?n:void 0;return o!==void 0?r!==void 0?{res:t.slice(o,r),ranges:[[0,o],[r,s]]}:{res:t.slice(o),ranges:[[0,o]]}:r!==void 0?{res:t.slice(0,r),ranges:[[r,s]]}:{res:t,ranges:[]}}return{res:"",ranges:[]}}export{u as defaults,V as trimSpaces,D as version};
|
|
@@ -1,17 +1,17 @@
|
|
|
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.3.
|
|
4
|
+
* @version 5.3.1
|
|
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 w=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var x=(t,r,e)=>r in t?w(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))R.call(r,e)&&x(t,e,r[e]);if(k)for(var e of k(r))A.call(r,e)&&x(t,e,r[e]);return t};var J=(t,r)=>{for(var e in r)w(t,e,{get:r[e],enumerable:!0})},P=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of N(r))!R.call(t,c)&&c!==e&&w(t,c,{get:()=>r[c],enumerable:!(s=U(r,c))||s.enumerable});return t};var C=t=>P(w({},"__esModule",{value:!0}),t);var W={};J(W,{defaults:()=>v,trimSpaces:()=>G,version:()=>B});function I(){let t=[],r=0,e=!1;return{append(s){return e?!1:r+s.length>1999?(t.push("\u2026"),r+=1,e=!0,!1):(t.push(s),r+=s.length,!0)},result(){return t.join("")},stopped(){return e}}}function M(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function S(t,r){if(t.append('"')){for(let e=0;e<r.length&&!t.stopped();e+=1){let s=r.charCodeAt(e);s===34?t.append('\\"'):s===92?t.append("\\\\"):s===8?t.append("\\b"):s===9?t.append("\\t"):s===10?t.append("\\n"):s===12?t.append("\\f"):s===13?t.append("\\r"):s<32||s===8232||s===8233||s>=55296&&s<=57343?t.append(M(s)):t.append(r[e])}t.append('"')}}function K(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function j(t,r){t.append("Symbol(");let e=String(r);e.length>8&&S(t,e.slice(7,-1)),t.append(")")}function V(t,r){typeof r=="symbol"?j(t,r):S(t,String(r))}function O(t,r=0){let e=I(),s=r===4?4:0,c=new WeakSet,g=0;function h(n){s&&e.append(" ".repeat(n*s))}function b(n,o){n&&e.append(","),s&&(e.append("\n"),h(o+1))}function E(n,o,a){s&&o&&(e.append("\n"),h(a)),e.append(n)}function $(n,o){Object.prototype.hasOwnProperty.call(n,"value")?f(n.value,o):e.append(K(n))}function p(n,o){let a;try{a=Reflect.getOwnPropertyDescriptor(n,"length")}catch(u){e.append("[Uninspectable]");return}let l=a==null?void 0:a.value;if(!Number.isSafeInteger(l)||l<0){e.append("[Uninspectable]");return}e.append("[");let m=!1;for(let u=0;u<l&&!e.stopped();u+=1){if(b(m,o),m=!0,g>=50){e.append("[MaxEntries]");break}g+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(n,String(u))}catch(Y){e.append("[Uninspectable]");continue}y!=null&&y.enumerable?$(y,o+1):e.append("[Empty]")}E("]",m,o)}function i(n,o){let a;try{a=Reflect.ownKeys(n)}catch(m){e.append("[Uninspectable]");return}e.append("{");let l=!1;for(let m of a){if(e.stopped())break;if(g>=50){b(l,o),l=!0,S(e,"\u2026"),e.append(s?": ":":"),e.append("[MaxEntries]");break}g+=1;let u;try{u=Reflect.getOwnPropertyDescriptor(n,m)}catch(y){b(l,o),l=!0,V(e,m),e.append(s?": ":":"),e.append("[Uninspectable]");continue}u!=null&&u.enumerable&&(b(l,o),l=!0,V(e,m),e.append(s?": ":":"),$(u,o+1))}E("}",l,o)}function d(n,o){if(c.has(n)){e.append("[Circular]");return}if(o>=5){e.append("[MaxDepth]");return}let a;try{a=Array.isArray(n)}catch(l){e.append("[Uninspectable]");return}c.add(n);try{a?p(n,o):i(n,o)}finally{c.delete(n)}}function f(n,o){n===null?e.append("null"):typeof n=="string"?S(e,n):typeof n=="number"?e.append(Object.is(n,-0)?"-0":String(n)):typeof n=="boolean"?e.append(n?"true":"false"):typeof n>"u"?e.append("undefined"):typeof n=="bigint"?e.append("".concat(n,"n")):typeof n=="symbol"?j(e,n):typeof n=="function"?e.append("[Function]"):d(n,o)}try{return f(t,0),e.result()}catch(n){return"[Uninspectable]"}}var T="5.3.
|
|
10
|
+
"use strict";var stringTrimSpacesOnly=(()=>{var w=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var x=(t,r,e)=>r in t?w(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))R.call(r,e)&&x(t,e,r[e]);if(k)for(var e of k(r))A.call(r,e)&&x(t,e,r[e]);return t};var J=(t,r)=>{for(var e in r)w(t,e,{get:r[e],enumerable:!0})},P=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of N(r))!R.call(t,c)&&c!==e&&w(t,c,{get:()=>r[c],enumerable:!(s=U(r,c))||s.enumerable});return t};var C=t=>P(w({},"__esModule",{value:!0}),t);var W={};J(W,{defaults:()=>v,trimSpaces:()=>G,version:()=>B});function I(){let t=[],r=0,e=!1;return{append(s){return e?!1:r+s.length>1999?(t.push("\u2026"),r+=1,e=!0,!1):(t.push(s),r+=s.length,!0)},result(){return t.join("")},stopped(){return e}}}function M(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function S(t,r){if(t.append('"')){for(let e=0;e<r.length&&!t.stopped();e+=1){let s=r.charCodeAt(e);s===34?t.append('\\"'):s===92?t.append("\\\\"):s===8?t.append("\\b"):s===9?t.append("\\t"):s===10?t.append("\\n"):s===12?t.append("\\f"):s===13?t.append("\\r"):s<32||s===8232||s===8233||s>=55296&&s<=57343?t.append(M(s)):t.append(r[e])}t.append('"')}}function K(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function j(t,r){t.append("Symbol(");let e=String(r);e.length>8&&S(t,e.slice(7,-1)),t.append(")")}function V(t,r){typeof r=="symbol"?j(t,r):S(t,String(r))}function O(t,r=0){let e=I(),s=r===4?4:0,c=new WeakSet,g=0;function h(n){s&&e.append(" ".repeat(n*s))}function b(n,o){n&&e.append(","),s&&(e.append("\n"),h(o+1))}function E(n,o,a){s&&o&&(e.append("\n"),h(a)),e.append(n)}function $(n,o){Object.prototype.hasOwnProperty.call(n,"value")?f(n.value,o):e.append(K(n))}function p(n,o){let a;try{a=Reflect.getOwnPropertyDescriptor(n,"length")}catch(u){e.append("[Uninspectable]");return}let l=a==null?void 0:a.value;if(!Number.isSafeInteger(l)||l<0){e.append("[Uninspectable]");return}e.append("[");let m=!1;for(let u=0;u<l&&!e.stopped();u+=1){if(b(m,o),m=!0,g>=50){e.append("[MaxEntries]");break}g+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(n,String(u))}catch(Y){e.append("[Uninspectable]");continue}y!=null&&y.enumerable?$(y,o+1):e.append("[Empty]")}E("]",m,o)}function i(n,o){let a;try{a=Reflect.ownKeys(n)}catch(m){e.append("[Uninspectable]");return}e.append("{");let l=!1;for(let m of a){if(e.stopped())break;if(g>=50){b(l,o),l=!0,S(e,"\u2026"),e.append(s?": ":":"),e.append("[MaxEntries]");break}g+=1;let u;try{u=Reflect.getOwnPropertyDescriptor(n,m)}catch(y){b(l,o),l=!0,V(e,m),e.append(s?": ":":"),e.append("[Uninspectable]");continue}u!=null&&u.enumerable&&(b(l,o),l=!0,V(e,m),e.append(s?": ":":"),$(u,o+1))}E("}",l,o)}function d(n,o){if(c.has(n)){e.append("[Circular]");return}if(o>=5){e.append("[MaxDepth]");return}let a;try{a=Array.isArray(n)}catch(l){e.append("[Uninspectable]");return}c.add(n);try{a?p(n,o):i(n,o)}finally{c.delete(n)}}function f(n,o){n===null?e.append("null"):typeof n=="string"?S(e,n):typeof n=="number"?e.append(Object.is(n,-0)?"-0":String(n)):typeof n=="boolean"?e.append(n?"true":"false"):typeof n>"u"?e.append("undefined"):typeof n=="bigint"?e.append("".concat(n,"n")):typeof n=="symbol"?j(e,n):typeof n=="function"?e.append("[Function]"):d(n,o)}try{return f(t,0),e.result()}catch(n){return"[Uninspectable]"}}var T="5.3.1";var B=T,v={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function G(t,r){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(O(t,4)));let e=r?D(D({},v),r):v,{classicTrim:s,cr:c,lf:g,tab:h,space:b,nbsp:E}=e;function $(i){return s&&!i.trim()||!s&&(b&&i===" "||c&&i==="\r"||g&&i==="\n"||h&&i===" "||E&&i==="\xA0")}let p=t.length;if(p){let i=0;for(;i<p&&$(t[i]);)i+=1;if(i===p)return{res:"",ranges:[[0,p]]};let d=p;for(;d>i;){let o=d-1;if(!$(t[o])){d<p;break}d=o}let f=i||void 0,n=d<p?d:void 0;return f!==void 0?n!==void 0?{res:t.slice(f,n),ranges:[[0,f],[n,p]]}:{res:t.slice(f),ranges:[[0,f]]}:n!==void 0?{res:t.slice(0,n),ranges:[[n,p]]}:{res:t,ranges:[]}}return{res:"",ranges:[]}}return C(W);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-format-diagnostic-value
|
|
13
13
|
* @fileoverview Safely format untrusted JavaScript values for diagnostics
|
|
14
|
-
* @version 1.1.
|
|
14
|
+
* @version 1.1.1
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-format-diagnostic-value/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "string-trim-spaces-only",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Like String.trim() but you can choose granularly what to trim",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"characters",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"codsen-format-diagnostic-value": "^1.1.
|
|
72
|
+
"codsen-format-diagnostic-value": "^1.1.1"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=18.20.8"
|