@putout/printer 18.2.3 → 18.2.5
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
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
isInsideArray,
|
|
14
14
|
} from '#is';
|
|
15
15
|
|
|
16
|
+
const isZero = (length) => !length;
|
|
17
|
+
|
|
16
18
|
const isParentProperty = (path) => path.find(isObjectProperty);
|
|
17
19
|
|
|
18
20
|
const isNumbersArray = createTypeChecker([
|
|
@@ -201,6 +203,7 @@ const isBodyWithOneElement = createTypeChecker([
|
|
|
201
203
|
]);
|
|
202
204
|
|
|
203
205
|
export const isMultiLine = createTypeChecker([
|
|
206
|
+
['-: node.elements.length', isZero],
|
|
204
207
|
['+', isBodyWithOneElement],
|
|
205
208
|
['+', isMoreThenMaxElementLengthInOneLine],
|
|
206
209
|
['+', isElementsMoreThenMaxWithFirstString],
|
|
@@ -225,9 +228,9 @@ export const isMultiLine = createTypeChecker([
|
|
|
225
228
|
['-', isSimpleAndObject],
|
|
226
229
|
['-', isSiblingIsArray],
|
|
227
230
|
['-', isStringsInsideArray],
|
|
231
|
+
['-', isNumbersArray],
|
|
228
232
|
['+', tooLong],
|
|
229
233
|
['+', isCoupleLines],
|
|
230
|
-
['-', isNumbersArray],
|
|
231
234
|
]);
|
|
232
235
|
|
|
233
236
|
function isOneSimple(path) {
|
|
@@ -3,6 +3,8 @@ import {instrument as _instrument} from '#type-checker/instrument';
|
|
|
3
3
|
import {parseOperation, parseTypeNames} from './parsers.js';
|
|
4
4
|
import {equal, maybeCall} from './comparators.js';
|
|
5
5
|
|
|
6
|
+
const isUndefined = (a) => typeof a === 'undefined';
|
|
7
|
+
|
|
6
8
|
const SKIP = [
|
|
7
9
|
Infinity,
|
|
8
10
|
false,
|
|
@@ -22,12 +24,10 @@ export const createTypeChecker = (typeNames, overrides = {}) => {
|
|
|
22
24
|
if (selector)
|
|
23
25
|
currentPath = jessy(selector, path);
|
|
24
26
|
|
|
25
|
-
if (
|
|
27
|
+
if (isUndefined(currentPath))
|
|
26
28
|
return SKIP;
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (equal(not, type, typeName))
|
|
30
|
+
if (currentPath && equal(not, currentPath.type, typeName))
|
|
31
31
|
return [index, result];
|
|
32
32
|
|
|
33
33
|
if (maybeCall(typeName, not, currentPath, options))
|
package/package.json
CHANGED