Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@putout/engine-runner

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/engine-runner - npm Package Compare versions

Comparing version 13.1.0 to 13.2.0

5

lib/merge-visitors.js

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

upStore,
upListStore,
} = require('./store');

@@ -43,2 +44,3 @@

listStore,
uplist,
} = getStore(plugin, {

@@ -59,2 +61,3 @@ fix,

upstore,
uplist,
generate,

@@ -96,2 +99,3 @@ options,

const placesStore = listStore();
const uplist = upListStore();

@@ -128,4 +132,5 @@ const push = (path) => {

upstore,
uplist,
};
}

22

lib/store.js

@@ -9,2 +9,4 @@ 'use strict';

const toArray = (a) => Array.from(a);
module.exports.listStore = (list = []) => {

@@ -31,2 +33,5 @@ const fn = (...args) => {

module.exports.mapStore = createStore({
get(map) {
return values(map);
},
set(map, name, data) {

@@ -38,2 +43,5 @@ map[name] = data;

module.exports.upStore = createStore({
get(map) {
return values(map);
},
set(map, name, data) {

@@ -45,7 +53,17 @@ map[name] = map[name] || {};

function createStore({set}) {
module.exports.upListStore = createStore({
get(map) {
return values(map).map(toArray);
},
set(map, name, data) {
map[name] = map[name] || new Set();
map[name].add(data);
},
});
function createStore({set, get}) {
return (map = {}) => {
const fn = (...args) => {
if (!args.length)
return values(map);
return get(map);

@@ -52,0 +70,0 @@ const [name, data] = args;

2

package.json
{
"name": "@putout/engine-runner",
"version": "13.1.0",
"version": "13.2.0",
"type": "commonjs",

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

@@ -242,2 +242,3 @@ # @putout/engine-runner [![NPM version][NPMIMGURL]][NPMURL]

- ✅`upstore`;
- ✅`uplist`;

@@ -344,2 +345,39 @@ Let's talk about each of them.

### `uplist`
When you need to update named arrays:
```js
module.exports.traverse = ({uplist, push}) => ({
'const __object = __a.__b': (fullPath) => {
const {__a, __b} = getTemplateValues(fullPath, 'const __object = __a.__b');
const path = fullPath.get('declarations.0.init');
const {uid} = path.scope;
if (isIdentifier(__a) || isCallExpression(__a)) {
const {code} = generate(__a);
const id = `${uid}-${code}`;
return uplist(id, path);
}
},
'Program': {
exit: () => {
for (const items of uplist()) {
if (items.length < 2)
continue;
const index = items.length - 1;
const path = items[index];
push({
path,
items,
});
}
},
},
});
```
## Logs

@@ -346,0 +384,0 @@

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