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

snap-shot-core

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snap-shot-core - npm Package Compare versions

Comparing version 7.4.0 to 8.0.0

8

package.json
{
"name": "snap-shot-core",
"description": "Save / load named snapshots, useful for tests",
"version": "7.4.0",
"version": "8.0.0",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -100,8 +100,8 @@ "bugs": "https://github.com/bahmutov/snap-shot-core/issues",

"license-checker": "25.0.1",
"mocha": "6.0.2",
"mocha": "6.1.2",
"pre-git": "3.17.1",
"semantic-release": "15.13.3",
"simple-commit-message": "4.0.3",
"sinon": "7.3.0",
"snap-shot-it": "6.3.1",
"sinon": "7.3.1",
"snap-shot-it": "6.3.2",
"standard": "12.0.1",

@@ -108,0 +108,0 @@ "stop-only": "2.2.5"

@@ -250,2 +250,6 @@ [![TODO board](https://imdone.io/api/1.0/projects/5b1adebb4f7fd004e58ef569/badge)](https://imdone.io/app#/board/bahmutov/snap-shot-core)

## Escaping values
Because the snapshots are saved as template literals, back ticks and other "niceties" have to be escaped. This module uses [jsesc](https://github.com/mathiasbynens/jsesc) module to do string escaping. Currently only the [minimal set of characters is escaped](https://github.com/mathiasbynens/jsesc#minimal).
## Resaving snaphots

@@ -252,0 +256,0 @@

@@ -60,2 +60,7 @@ 'use strict'

/**
* Serializes and escapes a string value before saving.
* @param {string} name for the snapshot
* @param {string} value text to be escaped for saving
*/
function exportText (name, value) {

@@ -80,3 +85,4 @@ la(is.unemptyString(name), 'expected snapshot name, got:', name)

return jsesc(line, {
quotes: 'backtick'
quotes: 'backtick',
minimal: true
})

@@ -89,2 +95,5 @@ })

/**
* Escapes properties of an object to be safe for saving
*/
function exportObject (name, value) {

@@ -94,3 +103,4 @@ const serialized = jsesc(value, {

compact: false,
indent: ' '
indent: ' ',
minimal: true
})

@@ -97,0 +107,0 @@ return `exports['${name}'] = ${serialized}\n`

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