Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@putout/compare
Advanced tools
Compare AST-nodes.
npm i @putout/compare
node
- AST-node
or code
that will be generated;baseNode
AST-node
with support of template variables
.Any node.
compare('const x = data', 'const __ = __');
compare('const {x} = data', 'const __ = __');
compare('const x = {data}', 'const __ = __');
// returns
true
ObjectPattern
or ObjectExpression
with any count of properties
.
compare('const {} = data', 'const __object = __')
compare('const {hello} = data', 'const __object = __')
// returns
true
ArrayPattern
or ArrayExpression
with any count of elements
.
compare('const [] = data', 'const __array = __');
compare('const [hello] = data', 'const __array = __');
compare('const hello = [data]', 'const __ = __array');
// returns
true
Any count of arguments
:
compare('(a, b, c) => {}', '(__args) => {}');
compare('(a, b) => {}', '(__args) => {}');
compare('() => {}', '(__args) => {}');
// returns
true
Any string literal.
compare('const a = "hello"', 'const __ = "__"');
MIT
FAQs
compare AST-nodes according to 🦎 PutoutScript
The npm package @putout/compare receives a total of 14,600 weekly downloads. As such, @putout/compare popularity was classified as popular.
We found that @putout/compare demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.