@putout/operator-parens
🐊Putout operator adds ability to work with parens
Last updated 2 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm 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.1.0                                ...           latest (5 months ago)

7 Versions

  • 4.1.0                                ...           5 months ago
  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Total 7
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (12)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE