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

clickity

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickity - npm Package Compare versions

Comparing version 2.1.3 to 2.2.0

72

lib/services/click.js

@@ -60,3 +60,3 @@ 'use strict';

browserPage.getElements = browserPage.$$;
// browserPage.evalHandle = (...args) => this.evalHandle(browserPage, ...args);
browserPage.evalHandle = (...args) => this.evalHandle(browserPage, ...args);
// browserPage.tableToJson = (...args) => this.tableToJson(browserPage, ...args);

@@ -80,34 +80,42 @@ browserPage.id = Uuid.v4();

// TODO this is busted rn
// Intended to evaluate an ElementHandle
// async evalHandle(page, elHandle, props) {
//
// return await page.evaluate(async (el) => {
//
// return [].concat(props).map((prop) => {
//
// const isFunc = prop.slice(-2) === '()';
//
// return isFunc ? el[prop.slice(0, -2)]() : el[prop];
// });
// });
// }
// Evaluate an element handle, (return value of page.$() or an item from page.$$())
async evalHandle(page, elHandle, passedProps) {
// TODO this is busted til we fix evalHandle
// async tableToJson(page, selector) {
//
// // Serializes the table into a string with rows separated by '\n',
// // cols separated by '\t'
// const tableInnerText = await this.evalHandle(page, page.$(selector), 'innerText');
//
// // Will take the first 2 columns in a table,
// // turning it into an object
// return tableInnerText.split('\n').slice(1).reduce((collector, pair) => {
//
// const [key, val] = pair.split('\t');
// collector[key] = val;
//
// return collector;
// }, {});
// }
if (!elHandle) {
throw new Error('elHandle no good (might be null)');
}
return await page.evaluate((el, props) => {
const res = [].concat(props).map((prop) => {
const isFunc = prop.slice(-2) === '()';
return isFunc ? el[prop.slice(0, -2)]() : el[prop];
});
if (res.length === 1) {
return res[0];
}
return res;
}, elHandle, passedProps);
}
async tableToJson(page, selector) {
// Serializes the table into a string with rows separated by '\n',
// cols separated by '\t'
const tableInnerText = await this.evalHandle(page, page.$(selector), 'innerText');
// Will take the first 2 columns in a table,
// turning it into an object
return tableInnerText.split('\n').slice(1).reduce((collector, pair) => {
const [key, val] = pair.split('\t');
collector[key] = val;
return collector;
}, {});
}
};
{
"name": "clickity",
"version": "2.1.3",
"version": "2.2.0",
"description": "",

@@ -5,0 +5,0 @@ "author": "wsw",

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