string-trim-spaces-only 4.1.0 → 4.1.2
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
|
@@ -65,22 +65,22 @@ Accidental version bump during migration to sourcehut. Sorry about that.
|
|
|
65
65
|
|
|
66
66
|
## 2.7.0 (2019-01-20)
|
|
67
67
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
68
|
+
- Various documentation and setup tweaks after we migrated to monorepo
|
|
69
|
+
- Setup refresh: updated dependencies and all config files using automated tools
|
|
70
70
|
|
|
71
71
|
## 2.3.0 (2018-12-26)
|
|
72
72
|
|
|
73
|
-
-
|
|
73
|
+
- Add `opts.classicTrim`
|
|
74
74
|
|
|
75
75
|
## 2.2.0 (2018-10-26)
|
|
76
76
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
77
|
+
- Updated all dependencies
|
|
78
|
+
- Restored coveralls.io reporting
|
|
79
|
+
- Restored unit test linting
|
|
80
80
|
|
|
81
81
|
## 2.1.0 (2018-10-15)
|
|
82
82
|
|
|
83
|
-
-
|
|
83
|
+
- Updated all dependencies and restored unit test coverage tracking: reporting in terminal and coveralls.io
|
|
84
84
|
|
|
85
85
|
## 2.0.0 (2018-07-26)
|
|
86
86
|
|
|
@@ -98,22 +98,22 @@ Additionally, we also supply ranges of what was deleted under key `ranges`.
|
|
|
98
98
|
|
|
99
99
|
Additionally, now only string input is allowed. Non-string input will cause error `throw`s. We need to make API stricter because output type is different from the input type (string vs plain object) and if an accidentally wrong type, a plain object was given, if we returned it without causing an error, it could be interpreted as a valid output type and cause errors when keys `res` or `ranges` would not be found (or worse, found and consumed from a wrong place)!
|
|
100
100
|
|
|
101
|
-
-
|
|
101
|
+
- PLUS, added `opts.classicTrim`. It's the same as `String.trim()` except you get both string and corresponding ranges. Native `String.trim()` does not give the latter.
|
|
102
102
|
|
|
103
103
|
## 1.2.0 (2018-06-16)
|
|
104
104
|
|
|
105
105
|
GitHub sold us out. In the meantime, we:
|
|
106
106
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
107
|
+
- Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
|
|
108
|
+
- Dropped BitHound (RIP) and Travis
|
|
109
109
|
|
|
110
110
|
## 1.1.0 (2018-05-25)
|
|
111
111
|
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
112
|
+
- Set up [Prettier](https://prettier.io) on a custom ESLint rule set.
|
|
113
|
+
- Removed `package.lock` and `.editorconfig`
|
|
114
|
+
- Wired Rollup to remove comments from non-dev builds. This means we can now leave the `console.log`s in the source code — there's no need to comment-out `console.log` statements or care about them not spilling into production. Now it's done automatically.
|
|
115
|
+
- Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed. It is important because now code coverage is real again and now there are no excuses not to perfect it.
|
|
116
116
|
|
|
117
117
|
## 1.0.0 (2018-02-13)
|
|
118
118
|
|
|
119
|
-
-
|
|
119
|
+
- First public release
|
|
@@ -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.
|
|
4
|
+
* @version 4.1.2
|
|
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.
|
|
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:
|
|
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.
|
|
4
|
+
* @version 4.1.2
|
|
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 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.
|
|
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:
|
|
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.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "Like String.trim() but you can choose granularly what to trim",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"characters",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"text",
|
|
15
15
|
"trim"
|
|
16
16
|
],
|
|
17
|
-
"homepage": "https://codsen.com/os/string-trim-spaces-only
|
|
17
|
+
"homepage": "https://codsen.com/os/string-trim-spaces-only",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "https://github.com/codsen/codsen.git",
|