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

cypress-map

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-map - npm Package Compare versions

Comparing version 1.29.0 to 1.30.0

22

commands/to-plain-object.js
var registerQuery = require('./utils').registerQuery;
registerQuery('toPlainObject', function () {
var log = Cypress.log({ name: 'toPlainObject' });
return function (subject) {
registerQuery('toPlainObject', function (conversionType) {
if (conversionType === void 0) { conversionType = 'json'; }
var log = Cypress.log({
name: 'toPlainObject',
message: conversionType,
});
var jsonConversion = function (subject) {
return JSON.parse(JSON.stringify(subject));
};
var entriesConversion = function (subject) {
return Object.fromEntries(subject.entries());
};
if (conversionType === 'json') {
return jsonConversion;
}
else if (conversionType === 'entries') {
return entriesConversion;
}
else {
throw new Error("unknown conversion type: ".concat(conversionType));
}
});

2

package.json
{
"name": "cypress-map",
"version": "1.29.0",
"version": "1.30.0",
"description": "Extra Cypress query commands for v12+",

@@ -5,0 +5,0 @@ "main": "commands/index.js",

@@ -468,2 +468,8 @@ # cypress-map [![ci](https://github.com/bahmutov/cypress-map/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-map/actions/workflows/ci.yml) ![cypress version](https://img.shields.io/badge/cypress-13.6.4-brightgreen)

By default uses JSON stringify and parse back. If you want to convert using `entries` and `fromEntries`, add an argument:
```js
cy.wrap(new URLSearchParams(searchParams)).toPlainObject('entries')
```
### invokeOnce

@@ -470,0 +476,0 @@

@@ -240,4 +240,7 @@ /**

/**
* A query that calls `JSON.parse(JSON.parse(subject))`
* A query that calls `JSON.parse(JSON.parse(subject))` or entries.
* When using `entries`, it calls `Object.entries`
* then constructs the object again using `Object.fromEntries`.
* @see https://github.com/bahmutov/cypress-map
* @param conversionType Json by default, could be 'entries'
* @example

@@ -250,3 +253,5 @@ * cy.get('selector')

*/
toPlainObject(): Chainable<Object>
toPlainObject(
conversionType?: 'json' | 'entries',
): Chainable<Object>

@@ -253,0 +258,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