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

jest-styled-components

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-styled-components - npm Package Compare versions

Comparing version 4.1.0-1 to 4.1.0-2

2

package.json
{
"name": "jest-styled-components",
"version": "4.1.0-1",
"version": "4.1.0-2",
"description": "Jest utilities for Styled Components",

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

@@ -67,15 +67,11 @@ const css = require('css')

const replaceHashes = (classNames, hashes, result) =>
classNames
.filter(
className => className.startsWith('sc-') || hashes.includes(className)
)
.reduce(
(acc, className) =>
acc.replace(
new RegExp(`(className="[^"]*?)${className}\\s?([^"]*")`, 'g'),
'$1$2'
),
result
)
const replaceHashes = (hashes, result) =>
hashes.reduce(
(acc, className) =>
acc.replace(
new RegExp(`(className="[^"]*?)${className}\\s?([^"]*")`, 'g'),
'$1$2'
),
result
)

@@ -99,3 +95,3 @@ const styleSheetSerializer = {

result = replaceClassNames(classNames, style, result)
result = replaceHashes(classNames, hashes, result)
result = replaceHashes(hashes, result)

@@ -102,0 +98,0 @@ return result

@@ -41,7 +41,10 @@ const css = require('css')

const getClassNames = () => extract(/data-styled-components="([^"]*)"/g)
const getClassNames = () =>
extract(/data-styled-components="([^"]*)"/g).split(/\s/)
const getComponentIDs = () => extract(/sc-component-id: ([^\\*\\/]*) \*\//g)
const getComponentIDs = () =>
extract(/sc-component-id: ([^\\*\\/]*) \*\//g).split(/\s/)
const getHashes = () => `${getClassNames()} ${getComponentIDs()}`
const getHashes = () =>
getClassNames().concat(getComponentIDs()).filter(Boolean)

@@ -48,0 +51,0 @@ module.exports = {

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