@putout/printer
Advanced tools
Comparing version 1.49.0 to 1.49.1
'use strict'; | ||
const {isCoupleLines} = require('../is'); | ||
const { | ||
isFunction, | ||
isIfStatement, | ||
isStatement, | ||
} = require('@babel/types'); | ||
isCoupleLines, | ||
isForOf, | ||
isIf, | ||
} = require('../is'); | ||
const {isFunction} = require('@babel/types'); | ||
const isBodyOfArrow = (path) => path.parentPath.node.body === path.node; | ||
const isLogical = (path) => path.get('argument').isLogicalExpression(); | ||
const isValue = (path) => path.get('properties.0.value').node; | ||
const isIfOrStatement = (a) => isIfStatement(a) || isStatement(a); | ||
const isIf = (path) => isIfStatement(path.find( | ||
isIfOrStatement, | ||
)); | ||
const isParentExpression = (path) => path.parentPath.isExpressionStatement(); | ||
const isForOf = (path) => { | ||
if (path.parentPath.isForOfStatement()) | ||
return true; | ||
return path.parentPath?.parentPath?.isForOfStatement(); | ||
}; | ||
module.exports.ObjectExpression = (path, {print, maybe, indent}) => { | ||
@@ -28,0 +17,0 @@ indent.inc(); |
'use strict'; | ||
const {isIdentifier} = require('@babel/types'); | ||
const isForOf = (path) => path.parentPath?.parentPath?.parentPath?.isForOfStatement(); | ||
const {isForOf} = require('../is'); | ||
@@ -6,0 +6,0 @@ module.exports.ObjectPattern = (path, {indent, print, maybe}) => { |
@@ -8,2 +8,6 @@ 'use strict'; | ||
isIdentifier, | ||
isIfStatement, | ||
isStatement, | ||
isForOfStatement, | ||
isVariableDeclaration, | ||
} = require('@babel/types'); | ||
@@ -52,1 +56,20 @@ | ||
module.exports.isStringAndIdentifier = ([a, b]) => isStringLiteral(a) && isIdentifier(b); | ||
const isIfOrStatement = (a) => isIfStatement(a) || isStatement(a); | ||
const isForOfOrStatement = (a) => isForOfStatement(a) || isStatement(a); | ||
module.exports.isIf = (path) => isIfStatement(path.find( | ||
isIfOrStatement, | ||
)); | ||
module.exports.isForOf = (path) => { | ||
const current = path.find(isForOfOrStatement); | ||
if (isForOfStatement(current)) | ||
return true; | ||
if (isVariableDeclaration(current)) | ||
return isForOfStatement(current.parentPath); | ||
return false; | ||
}; |
{ | ||
"name": "@putout/printer", | ||
"version": "1.49.0", | ||
"version": "1.49.1", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85398
2324