@putout/printer 1.52.0 → 1.52.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/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2023.04.17, v1.52.1
2
+
3
+ feature:
4
+ - cf83bcb @putout/printer: move out satisfy
5
+
1
6
  2023.04.17, v1.52.0
2
7
 
3
8
  feature:
@@ -76,3 +76,12 @@ module.exports.isNewlineBetweenStatements = (path) => {
76
76
 
77
77
  return startNext - endCurrent > 1;
78
78
  };
79
+
80
+ module.exports.satisfy = (conditions) => (path) => {
81
+ for (const condition of conditions) {
82
+ if (condition(path))
83
+ return true;
84
+ }
85
+
86
+ return false;
87
+ };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const {satisfy} = require('../is');
3
4
  module.exports = (plugin) => {
4
5
  if (!plugin.afterSatisfy && !plugin.beforeSatisfy)
5
6
  return plugin;
@@ -11,13 +12,7 @@ module.exports = (plugin) => {
11
12
  };
12
13
  };
13
14
 
14
- const createIf = (getConditions) => (path) => {
15
+ const createIf = (getConditions) => {
15
16
  const conditions = getConditions?.() || [];
16
-
17
- for (const condition of conditions) {
18
- if (condition(path))
19
- return true;
20
- }
21
-
22
- return false;
17
+ return satisfy(conditions);
23
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.52.0",
3
+ "version": "1.52.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",