align-spaces 1.0.4 → 3.0.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 +30 -0
- package/README.md +12 -15
- package/bin/align-spaces.js +3 -5
- package/lib/align-spaces.js +3 -4
- package/package.json +12 -18
package/ChangeLog
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
2026.02.10, v3.0.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- b1a7c93 align-spaces: migrate to ESM
|
|
5
|
+
- 3fd9d3d align-spaces: try-catch v4.0.9
|
|
6
|
+
- 4b98e76 align-spaces: supertape v12.4.0
|
|
7
|
+
- 9cf1108 align-spaces: putout v41.20.1
|
|
8
|
+
- dffacb4 align-spaces: madrun v12.1.3
|
|
9
|
+
- e752d5b align-spaces: eslint-plugin-putout v30.0.2
|
|
10
|
+
- 6d07553 align-spaces: eslint v10.0.0
|
|
11
|
+
|
|
12
|
+
2025.02.09, v2.0.0
|
|
13
|
+
|
|
14
|
+
feature:
|
|
15
|
+
- 60bd85c align-spaces: drop support of node < 18
|
|
16
|
+
- 0f575d8 align-spaces: eslint-plugin-n v17.15.1
|
|
17
|
+
- c33fd25 align-spaces: eslint-plugin-putout v24.0.1
|
|
18
|
+
- ba856e7 align-spaces: eslint v9.20.0
|
|
19
|
+
- 7ef515c align-spaces: madrun v10.2.4
|
|
20
|
+
- 1b1871a align-spaces: nodemon v3.1.9
|
|
21
|
+
- abb8ddd align-spaces: c8 v10.1.3
|
|
22
|
+
- a100cec align-spaces: putout v38.0.9
|
|
23
|
+
- 66cea8e align-spaces: supertape v10.10.0
|
|
24
|
+
- 0a4942b (package) supertape v2.0.1
|
|
25
|
+
- a805089 (package) putout v9.1.0
|
|
26
|
+
- a0a1644 (package) madrun v7.0.0
|
|
27
|
+
- 43e7ec8 (package) eslint-plugin-putout v5.0.1
|
|
28
|
+
- 224c1a5 (package) eslint v7.3.1
|
|
29
|
+
- 1853e0c (package) try-catch v3.0.0
|
|
30
|
+
|
|
1
31
|
2020.02.24, v1.0.4
|
|
2
32
|
|
|
3
33
|
feature:
|
package/README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
# Align Spaces [![NPM version][NPMIMGURL]][NPMURL] [![
|
|
1
|
+
# Align Spaces [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
|
-
[NPMIMGURL]:
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
[CoverageURL]: https://coveralls.io/github/coderaiser/align-spaces?branch=master
|
|
11
|
-
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/align-spaces/badge.svg?branch=master&service=github
|
|
3
|
+
[NPMIMGURL]: https://img.shields.io/npm/v/align-spaces.svg?style=flat&longCache=true
|
|
4
|
+
[NPMURL]: https://npmjs.org/package/align-spaces "npm"
|
|
5
|
+
[BuildStatusURL]: https://github.com/coderaiser/align-spaces/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
|
6
|
+
[BuildStatusIMGURL]: https://github.com/coderaiser/align-spaces/workflows/Node%20CI/badge.svg
|
|
7
|
+
[CoverageURL]: https://coveralls.io/github/coderaiser/align-spaces?branch=master
|
|
8
|
+
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/align-spaces/badge.svg?branch=master&service=github
|
|
12
9
|
|
|
13
10
|
Align spaces on empty lines of a source code.
|
|
14
11
|
|
|
@@ -29,27 +26,28 @@ align-spaces unaligned.js
|
|
|
29
26
|
`align-spaces` can be used as a library:
|
|
30
27
|
|
|
31
28
|
```js
|
|
32
|
-
|
|
29
|
+
import {alignSpaces} from 'align-spaces';
|
|
33
30
|
|
|
34
31
|
alignSpaces(`
|
|
35
32
|
const t = 'hello';
|
|
36
33
|
|
|
37
34
|
module.exports = () => {
|
|
38
35
|
cosnt m = 'world';
|
|
39
|
-
|
|
36
|
+
|
|
40
37
|
return t + m;
|
|
41
38
|
};
|
|
42
39
|
`);
|
|
40
|
+
|
|
43
41
|
// returns
|
|
44
42
|
`
|
|
45
43
|
const t = 'hello';
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
export defualt function() {
|
|
48
46
|
cosnt m = 'world';
|
|
49
47
|
....
|
|
50
48
|
return t + m;
|
|
51
49
|
};
|
|
52
|
-
|
|
50
|
+
`;
|
|
53
51
|
```
|
|
54
52
|
|
|
55
53
|
## Related
|
|
@@ -60,4 +58,3 @@ module.exports = () => {
|
|
|
60
58
|
## License
|
|
61
59
|
|
|
62
60
|
MIT
|
|
63
|
-
|
package/bin/align-spaces.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import {alignSpaces} from '../lib/align-spaces.js';
|
|
4
6
|
|
|
5
7
|
const [name] = process.argv.slice(2);
|
|
6
8
|
|
|
@@ -9,10 +11,6 @@ if (!name) {
|
|
|
9
11
|
process.exit();
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
const alignSpaces = require('..');
|
|
14
|
-
|
|
15
14
|
const str = fs.readFileSync(name, 'utf8');
|
|
16
15
|
|
|
17
16
|
fs.writeFileSync(name, alignSpaces(str));
|
|
18
|
-
|
package/lib/align-spaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const isString = (a) => typeof a === 'string';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export const alignSpaces = (str) => {
|
|
4
4
|
check(str);
|
|
5
5
|
|
|
6
6
|
const array = str.split('\n');
|
|
@@ -46,7 +46,6 @@ function getSpaces(s) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function check(str) {
|
|
49
|
-
if (
|
|
49
|
+
if (!isString(str))
|
|
50
50
|
throw Error('str should be a string!');
|
|
51
51
|
}
|
|
52
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "align-spaces",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
6
|
"description": "align spaces on empty lines of a source code",
|
|
6
7
|
"homepage": "http://github.com/coderaiser/align-spaces",
|
|
@@ -10,13 +11,7 @@
|
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
|
-
"url": "git://github.com/coderaiser/align-spaces.git"
|
|
14
|
-
},
|
|
15
|
-
"nyc": {
|
|
16
|
-
"exclude": [
|
|
17
|
-
"test",
|
|
18
|
-
"madrun.js"
|
|
19
|
-
]
|
|
14
|
+
"url": "git+https://github.com/coderaiser/align-spaces.git"
|
|
20
15
|
},
|
|
21
16
|
"scripts": {
|
|
22
17
|
"test": "madrun test",
|
|
@@ -34,20 +29,19 @@
|
|
|
34
29
|
"align-whitespaces"
|
|
35
30
|
],
|
|
36
31
|
"devDependencies": {
|
|
32
|
+
"c8": "^10.1.3",
|
|
37
33
|
"coveralls": "^3.0.0",
|
|
38
|
-
"eslint": "^
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"supertape": "^1.2.0",
|
|
46
|
-
"try-catch": "^2.0.0"
|
|
34
|
+
"eslint": "^10.0.0",
|
|
35
|
+
"eslint-plugin-putout": "^30.0.2",
|
|
36
|
+
"madrun": "^12.1.3",
|
|
37
|
+
"nodemon": "^3.1.9",
|
|
38
|
+
"putout": "^41.20.1",
|
|
39
|
+
"supertape": "^12.4.0",
|
|
40
|
+
"try-catch": "^4.0.9"
|
|
47
41
|
},
|
|
48
42
|
"license": "MIT",
|
|
49
43
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
44
|
+
"node": ">=22"
|
|
51
45
|
},
|
|
52
46
|
"publishConfig": {
|
|
53
47
|
"access": "public"
|