multi-rename 2.0.2 → 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 +16 -0
- package/README.md +10 -17
- package/lib/multi-rename.js +9 -11
- package/package.json +14 -12
package/ChangeLog
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
2026.01.15, v3.0.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 6bc19a9 multi-rename: drop support of node < 22
|
|
5
|
+
- bba7a76 multi-rename: migrate to ESM
|
|
6
|
+
- 7a4587a multi-rename: c8 v10.1.3
|
|
7
|
+
- 2a9056d multi-rename: try-catch v4.0.7
|
|
8
|
+
- bad7807 multi-rename: supertape v12.0.12
|
|
9
|
+
- 5a076f1 multi-rename: putout v41.7.3
|
|
10
|
+
- d76fa59 multi-rename: nyc v17.1.0
|
|
11
|
+
- b6e12f8 multi-rename: nodemon v3.1.11
|
|
12
|
+
- 51ce5a8 multi-rename: madrun v12.1.0
|
|
13
|
+
- 3c187a9 multi-rename: eslint-plugin-putout v29.4.0
|
|
14
|
+
- a0d4902 multi-rename: eslint-plugin-node v11.1.0
|
|
15
|
+
- 86ffb0a multi-rename: eslint v9.39.2
|
|
16
|
+
|
|
1
17
|
2019.10.16, v2.0.2
|
|
2
18
|
|
|
3
19
|
fix:
|
package/README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
# Multi Rename [![NPM version][NPMIMGURL]][NPMURL] [![
|
|
1
|
+
# Multi Rename [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
[CoverageURL]: https://coveralls.io/github/coderaiser/multi-rename?branch=master
|
|
11
|
-
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/multi-rename/badge.svg?branch=master&service=github
|
|
3
|
+
[NPMURL]: https://npmjs.org/package/multi-rename "npm"
|
|
4
|
+
[NPMIMGURL]: https://img.shields.io/npm/v/multi-rename.svg?style=flat&longCache=true
|
|
5
|
+
[BuildStatusURL]: https://github.com/coderaiser/multi-rename/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
|
6
|
+
[BuildStatusIMGURL]: https://github.com/coderaiser/multi-rename/workflows/Node%20CI/badge.svg
|
|
7
|
+
[CoverageURL]: https://coveralls.io/github/coderaiser/multi-rename?branch=master
|
|
8
|
+
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/multi-rename/badge.svg?branch=master&service=github
|
|
12
9
|
|
|
13
10
|
Rename strings from an array according to pattern.
|
|
14
11
|
|
|
@@ -21,14 +18,11 @@ npm i multi-rename
|
|
|
21
18
|
## Usage
|
|
22
19
|
|
|
23
20
|
```js
|
|
24
|
-
|
|
21
|
+
import {multiRename} from 'multi-rename';
|
|
25
22
|
|
|
26
|
-
multiRename('[c] - [ymd] - [n][e]', [
|
|
27
|
-
'hello.txt',
|
|
28
|
-
]);
|
|
23
|
+
multiRename('[c] - [ymd] - [n][e]', ['hello.txt']);
|
|
29
24
|
// returns
|
|
30
|
-
|
|
31
|
-
'01 - 2019-04-15 - hello.txt'
|
|
25
|
+
'01 - 2019-04-15 - hello.txt';
|
|
32
26
|
```
|
|
33
27
|
|
|
34
28
|
## Patterns
|
|
@@ -41,4 +35,3 @@ multiRename('[c] - [ymd] - [n][e]', [
|
|
|
41
35
|
## License
|
|
42
36
|
|
|
43
37
|
MIT
|
|
44
|
-
|
package/lib/multi-rename.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import _shortdate from 'shortdate';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = (pattern, names) => {
|
|
3
|
+
export const multiRename = (pattern, names, overrides) => {
|
|
6
4
|
check(pattern, names);
|
|
7
5
|
|
|
8
|
-
return names.map(parse(pattern));
|
|
6
|
+
return names.map(parse(pattern, overrides));
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
const parse = (pattern) => (full, i) => {
|
|
9
|
+
const parse = (pattern, overrides = {}) => (full, i) => {
|
|
10
|
+
const {
|
|
11
|
+
shortdate = _shortdate,
|
|
12
|
+
} = overrides;
|
|
13
|
+
|
|
12
14
|
const [name, ext] = splitName(full);
|
|
13
15
|
const date = shortdate(new Date(), {
|
|
14
16
|
sep: '-',
|
|
@@ -25,10 +27,7 @@ function splitName(str) {
|
|
|
25
27
|
const index = str.lastIndexOf('.');
|
|
26
28
|
|
|
27
29
|
if (!~index)
|
|
28
|
-
return [
|
|
29
|
-
str,
|
|
30
|
-
'',
|
|
31
|
-
];
|
|
30
|
+
return [str, ''];
|
|
32
31
|
|
|
33
32
|
return [
|
|
34
33
|
str.substr(0, index),
|
|
@@ -43,4 +42,3 @@ function check(pattern, names) {
|
|
|
43
42
|
if (!Array.isArray(names))
|
|
44
43
|
throw Error('names should be an array!');
|
|
45
44
|
}
|
|
46
|
-
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multi-rename",
|
|
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": "rename strings of an array according to pattern",
|
|
6
7
|
"homepage": "http://github.com/coderaiser/multi-rename",
|
|
7
8
|
"main": "lib/multi-rename.js",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
|
-
"url": "git://github.com/coderaiser/multi-rename.git"
|
|
11
|
+
"url": "git+https://github.com/coderaiser/multi-rename.git"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"test": "madrun test",
|
|
@@ -26,21 +27,22 @@
|
|
|
26
27
|
"multi"
|
|
27
28
|
],
|
|
28
29
|
"devDependencies": {
|
|
30
|
+
"c8": "^10.1.3",
|
|
29
31
|
"coveralls": "^3.0.0",
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"eslint-plugin-node": "^
|
|
32
|
-
"eslint-plugin-putout": "^
|
|
33
|
-
"madrun": "^
|
|
32
|
+
"eslint": "^9.39.2",
|
|
33
|
+
"eslint-plugin-node": "^11.1.0",
|
|
34
|
+
"eslint-plugin-putout": "^29.4.0",
|
|
35
|
+
"madrun": "^12.1.0",
|
|
34
36
|
"mock-require": "^3.0.3",
|
|
35
|
-
"nodemon": "^1.
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"supertape": "^
|
|
39
|
-
"try-catch": "^
|
|
37
|
+
"nodemon": "^3.1.11",
|
|
38
|
+
"putout": "^41.8.1",
|
|
39
|
+
"redlint": "^5.0.4",
|
|
40
|
+
"supertape": "^12.0.12",
|
|
41
|
+
"try-catch": "^4.0.7"
|
|
40
42
|
},
|
|
41
43
|
"license": "MIT",
|
|
42
44
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
45
|
+
"node": ">=22"
|
|
44
46
|
},
|
|
45
47
|
"publishConfig": {
|
|
46
48
|
"access": "public"
|