@putout/operator-parens
🐊Putout operator adds ability to work with parens
Last updated 10 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @putout/operator-parens 
SYNC missed versions from official npm registry.

@putout/operator-parens NPM version

????Putout operator adds ability to lint parens.

Install

npm i putout @putout/operator-parens

API

addParens(path: Path): Path

Add parens around expression depending on used printer:

  • ✅ set node.extra.parenthesized: true when @putout/printer used;
  • ✅ set add ParenthesizedExpression or TSParenthesizedType when babel used;
import {operator} from 'putout';

const {addParens} = operator;

addParens(path);

removeParens(path: Path): Path

Remove parens around expression depending on used printer:

  • ✅ set node.extra.parenthesized: false when @putout/printer used;
  • ✅ remove ParenthesizedExpression or TSParenthesizedType when babel used;
import {operator} from 'putout';

const {removeParens} = operator;

removeParens(path);

hasParens(path: Path): Boolean

Check if path has parens around expression depending on used printer:

  • ✅ checks node.extra.parenthesized when @putout/printer used;
  • ✅ check if parent node type is ParenthesizedExpression or TSParenthesizedType when babel used;
import {operator} from 'putout';

const {hasParens} = operator;

hasParens(path);

License

MIT

Current Tags

  • 4.0.0                                ...           latest (3 months ago)

6 Versions

  • 4.0.0                                ...           3 months ago
  • 3.0.0                                ...           4 months ago
  • 2.0.0                                ...           10 months ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |