@putout/operator-match-files 1.2.0 → 1.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/lib/match-files.js +9 -0
- package/package.json +1 -2
package/lib/match-files.js
CHANGED
|
@@ -16,10 +16,12 @@ const {
|
|
|
16
16
|
writeFileContent,
|
|
17
17
|
} = require('@putout/operator-filesystem');
|
|
18
18
|
|
|
19
|
+
const isObject = (a) => a && typeof a === 'object';
|
|
19
20
|
const {entries} = Object;
|
|
20
21
|
const report = ({message}) => message;
|
|
21
22
|
|
|
22
23
|
module.exports.matchFiles = (files) => {
|
|
24
|
+
check(files);
|
|
23
25
|
const traverse = createTraverse(files);
|
|
24
26
|
|
|
25
27
|
return {
|
|
@@ -95,3 +97,10 @@ function magicPrint(name, ast) {
|
|
|
95
97
|
|
|
96
98
|
return print(ast);
|
|
97
99
|
}
|
|
100
|
+
|
|
101
|
+
function check(files) {
|
|
102
|
+
for (const [, plugin] of entries(files)) {
|
|
103
|
+
if (!isObject(plugin))
|
|
104
|
+
throw Error(`☝️ Looks like provided to 'matchFiles()' typeof of plugin is not an 'object' but '${typeof plugin}'`);
|
|
105
|
+
}
|
|
106
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-match-files",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to match files to plugins",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@putout/engine-parser": "^9.0.0",
|
|
29
29
|
"@putout/operator-filesystem": "^2.1.1",
|
|
30
30
|
"@putout/operator-json": "^1.3.0",
|
|
31
|
-
"@putout/printer": "^6.4.1",
|
|
32
31
|
"putout": "^33.6.2"
|
|
33
32
|
},
|
|
34
33
|
"keywords": [
|