You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@putout/printer

Package Overview
Dependencies
Maintainers
1
Versions
835
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/printer - npm Package Compare versions

Comparing version
18.7.8
to
18.7.9
+28
lib/tokenize/expressions/object-pattern/comma.js
import {types} from '@putout/babel';
import {createTypeChecker} from '#type-checker';
const {
isForOfStatement,
isAssignmentPattern,
} = types;
const isCoupleOption = (a, {couple}) => couple;
export function isInsideForOf({parentPath}) {
return isForOfStatement(parentPath.parentPath.parentPath);
}
export function isPrevAssign(path) {
const prev = path.getPrevSibling();
return isAssignmentPattern(prev.node.value);
}
export const isCommaAfterProperty = createTypeChecker([
['+', isCoupleOption],
['-: key -> -'],
['-', isPrevAssign],
['-: parentPath', isInsideForOf],
['+: node.value.right -> ObjectExpression'],
]);
+1
-1

@@ -42,2 +42,3 @@ import {types} from '@putout/babel';

const callWithRoot = (fn) => (a, {root}) => fn(root);
const isExcludedFromChain = createTypeChecker([

@@ -97,2 +98,1 @@ '+: -> UnaryExpression',

};

@@ -8,3 +8,2 @@ import {types} from '@putout/babel';

isAssignmentPattern,
isForOfStatement,
isFunction,

@@ -42,12 +41,2 @@ isVariableDeclarator,

export function isInsideForOf({parentPath}) {
return isForOfStatement(parentPath.parentPath.parentPath);
}
export function isPrevAssign(path) {
const prev = path.getPrevSibling();
return isAssignmentPattern(prev.node.value);
}
export function isPrevAssignObject(path) {

@@ -54,0 +43,0 @@ const prev = path.getPrevSibling();

@@ -1,2 +0,1 @@

import {types} from '@putout/babel';
import {wrongShorthand} from './wrong-shorthand.js';

@@ -15,2 +14,3 @@ import {maybeTypeAnnotation} from '../../maybe/maybe-type-annotation.js';

} from './has.js';
import {isCommaAfterProperty} from './comma.js';
import {

@@ -20,10 +20,6 @@ isCoupleProperties,

isInsideFn,
isInsideForOf,
isNextAssignObject,
isPrevAssign,
isPrevAssignObject,
} from './is.js';
const {isObjectExpression} = types;
export const ObjectPattern = {

@@ -102,8 +98,3 @@ print: maybeTypeAnnotation((path, printer, semantics) => {

maybe.print(couple, ',');
maybe.print.newline(couple);
const {right} = valuePath.node;
if (i && !isPrevAssign(property) && !isInsideForOf(path) && isObjectExpression(right)) {
if (isCommaAfterProperty(property, {couple})) {
print(',');

@@ -143,1 +134,2 @@ print.newline();

};
{
"name": "@putout/printer",
"version": "18.7.8",
"version": "18.7.9",
"type": "module",

@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

Sorry, the diff of this file is not supported yet