New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@putout/operate

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/operate - npm Package Compare versions

Comparing version 6.6.0 to 6.7.0

lib/compute.js

2

lib/operate.js

@@ -12,2 +12,3 @@ 'use strict';

const {extract} = require('./extract');
const {compute} = require('./compute');

@@ -19,2 +20,3 @@ const {assign} = Object;

module.exports.extract = extract;
module.exports.compute = compute;
module.exports.replaceWith = replaceWith;

@@ -21,0 +23,0 @@

2

package.json
{
"name": "@putout/operate",
"version": "6.6.0",
"version": "6.7.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -5,0 +5,0 @@ "description": "operate on ast",

@@ -105,4 +105,35 @@ # Operate [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

## `compute(path)`
Computes value of expression:
For `code` like this:
```js
const bodies = {
function: `typeof __a === 'function'`,
};
module.exports.replace = () => ({
[bodies.function]: 'isFn(__a)',
});
```
You can compute value of `bodies.function`:
```js
const {parse, operator} = require('putout');
const {traverse, compute} = operator;
traverse({
'__a.__b': (path) => {
const [computed, value] = compute(path);
// returns
[true, "typeof __a === 'function'"];
},
});
```
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc