Socket
Socket
Sign inDemoInstall

@emotion/jest

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/jest - npm Package Compare versions

Comparing version 11.11.0 to 11.13.0

dist/create-enzyme-serializer-443012c8.esm.js

2

dist/declarations/src/enzyme-serializer.d.ts

@@ -1,1 +0,1 @@

export * from '../types/enzyme-serializer'
export * from "../types/enzyme-serializer.js"

@@ -1,1 +0,1 @@

export * from '../types/enzyme'
export * from "../types/enzyme.js"

@@ -1,1 +0,1 @@

export * from '../types'
export * from "../types/index.js"

@@ -1,1 +0,1 @@

export * from '../types/serializer'
export * from "../types/serializer.js"

@@ -1,2 +0,2 @@

// TypeScript Version: 2.9
// TypeScript Version: 4.3

@@ -9,3 +9,3 @@ /// <reference types="jest" />

StyleRuleOptions
} from './index'
} from "./index.js"
export { CreateSerializerOptions, EmotionMatchers, StyleRuleOptions }

@@ -12,0 +12,0 @@

// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.9
// TypeScript Version: 4.3

@@ -4,0 +4,0 @@ /// <reference types="jest" />

export * from "./declarations/src/index";
//# sourceMappingURL=emotion-jest.cjs.d.ts.map
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qZXN0LmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./emotion-jest.cjs.prod.js");
} else {
module.exports = require("./emotion-jest.cjs.dev.js");
}
Object.defineProperty(exports, '__esModule', { value: true });
var createSerializer = require('./create-serializer-95517190.cjs.js');
var matchers = require('./matchers-ae1a2789.cjs.js');
require('@babel/runtime/helpers/extends');
require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
require('@babel/runtime/helpers/createForOfIteratorHelperLoose');
require('@emotion/css-prettifier');
require('chalk');
require('stylis');
require('specificity');
exports.createSerializer = createSerializer.createSerializer;
exports.matchers = matchers.matchers;

@@ -1,3 +0,3 @@

export { c as createSerializer } from './create-serializer-fe4dd36c.esm.js';
export { m as matchers } from './matchers-5303e384.esm.js';
export { c as createSerializer } from './create-serializer-f94a97a2.esm.js';
export { m as matchers } from './matchers-e3e8d77f.esm.js';
import '@babel/runtime/helpers/extends';

@@ -4,0 +4,0 @@ import '@babel/runtime/helpers/objectWithoutPropertiesLoose';

export * from "../../dist/declarations/src/enzyme-serializer";
//# sourceMappingURL=emotion-jest-enzyme-serializer.cjs.d.ts.map
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qZXN0LWVuenltZS1zZXJpYWxpemVyLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL2VuenltZS1zZXJpYWxpemVyLmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./emotion-jest-enzyme-serializer.cjs.prod.js");
} else {
module.exports = require("./emotion-jest-enzyme-serializer.cjs.dev.js");
}
Object.defineProperty(exports, '__esModule', { value: true });
var createEnzymeSerializer = require('../../dist/create-enzyme-serializer-57588a79.cjs.js');
require('@babel/runtime/helpers/extends');
require('../../dist/create-serializer-95517190.cjs.js');
require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
require('@babel/runtime/helpers/createForOfIteratorHelperLoose');
require('@emotion/css-prettifier');
require('enzyme-to-json');
var _createEnzymeSerializ = createEnzymeSerializer.createEnzymeSerializer(),
test = _createEnzymeSerializ.test,
serialize = _createEnzymeSerializ.serialize;
exports.serialize = serialize;
exports.test = test;

@@ -1,4 +0,4 @@

import { c as createEnzymeSerializer } from '../../dist/create-enzyme-serializer-33737dc9.esm.js';
import { c as createEnzymeSerializer } from '../../dist/create-enzyme-serializer-443012c8.esm.js';
import '@babel/runtime/helpers/extends';
import '../../dist/create-serializer-fe4dd36c.esm.js';
import '../../dist/create-serializer-f94a97a2.esm.js';
import '@babel/runtime/helpers/objectWithoutPropertiesLoose';

@@ -5,0 +5,0 @@ import '@babel/runtime/helpers/createForOfIteratorHelperLoose';

export * from "../../dist/declarations/src/enzyme";
//# sourceMappingURL=emotion-jest-enzyme.cjs.d.ts.map
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qZXN0LWVuenltZS5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL2Rpc3QvZGVjbGFyYXRpb25zL3NyYy9lbnp5bWUuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./emotion-jest-enzyme.cjs.prod.js");
} else {
module.exports = require("./emotion-jest-enzyme.cjs.dev.js");
}
Object.defineProperty(exports, '__esModule', { value: true });
var createEnzymeSerializer = require('../../dist/create-enzyme-serializer-57588a79.cjs.js');
var matchers = require('../../dist/matchers-ae1a2789.cjs.js');
require('@babel/runtime/helpers/extends');
require('../../dist/create-serializer-95517190.cjs.js');
require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
require('@babel/runtime/helpers/createForOfIteratorHelperLoose');
require('@emotion/css-prettifier');
require('enzyme-to-json');
require('chalk');
require('stylis');
require('specificity');
exports.createEnzymeSerializer = createEnzymeSerializer.createEnzymeSerializer;
exports.matchers = matchers.matchers;

@@ -1,5 +0,5 @@

export { c as createEnzymeSerializer } from '../../dist/create-enzyme-serializer-33737dc9.esm.js';
export { m as matchers } from '../../dist/matchers-5303e384.esm.js';
export { c as createEnzymeSerializer } from '../../dist/create-enzyme-serializer-443012c8.esm.js';
export { m as matchers } from '../../dist/matchers-e3e8d77f.esm.js';
import '@babel/runtime/helpers/extends';
import '../../dist/create-serializer-fe4dd36c.esm.js';
import '../../dist/create-serializer-f94a97a2.esm.js';
import '@babel/runtime/helpers/objectWithoutPropertiesLoose';

@@ -6,0 +6,0 @@ import '@babel/runtime/helpers/createForOfIteratorHelperLoose';

{
"name": "@emotion/jest",
"version": "11.11.0",
"version": "11.13.0",
"description": "Jest utilities for emotion",

@@ -9,2 +9,6 @@ "main": "dist/emotion-jest.cjs.js",

".": {
"types": {
"import": "./dist/emotion-jest.cjs.mjs",
"default": "./dist/emotion-jest.cjs.js"
},
"module": "./dist/emotion-jest.esm.js",

@@ -15,2 +19,6 @@ "import": "./dist/emotion-jest.cjs.mjs",

"./enzyme": {
"types": {
"import": "./enzyme/dist/emotion-jest-enzyme.cjs.mjs",
"default": "./enzyme/dist/emotion-jest-enzyme.cjs.js"
},
"module": "./enzyme/dist/emotion-jest-enzyme.esm.js",

@@ -21,2 +29,6 @@ "import": "./enzyme/dist/emotion-jest-enzyme.cjs.mjs",

"./serializer": {
"types": {
"import": "./serializer/dist/emotion-jest-serializer.cjs.mjs",
"default": "./serializer/dist/emotion-jest-serializer.cjs.js"
},
"module": "./serializer/dist/emotion-jest-serializer.esm.js",

@@ -27,2 +39,6 @@ "import": "./serializer/dist/emotion-jest-serializer.cjs.mjs",

"./enzyme-serializer": {
"types": {
"import": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.cjs.mjs",
"default": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.cjs.js"
},
"module": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.esm.js",

@@ -48,3 +64,3 @@ "import": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.cjs.mjs",

"@babel/runtime": "^7.18.3",
"@emotion/css-prettifier": "^1.1.3",
"@emotion/css-prettifier": "^1.1.4",
"chalk": "^4.1.0",

@@ -68,5 +84,5 @@ "specificity": "^0.4.1",

"@definitelytyped/dtslint": "0.0.112",
"@emotion/css": "11.11.0",
"@emotion/react": "11.11.0",
"@types/jest": "^27.0.3",
"@emotion/css": "11.13.0",
"@emotion/react": "11.13.0",
"@types/jest": "^29.5.12",
"enzyme-to-json": "^3.6.1",

@@ -76,3 +92,3 @@ "pretty-format": "^22.4.3",

"react-dom": "16.14.0",
"typescript": "^4.5.5"
"typescript": "^5.4.5"
},

@@ -79,0 +95,0 @@ "author": "Kye Hohenberger",

export * from "../../dist/declarations/src/serializer";
//# sourceMappingURL=emotion-jest-serializer.cjs.d.ts.map
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qZXN0LXNlcmlhbGl6ZXIuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kaXN0L2RlY2xhcmF0aW9ucy9zcmMvc2VyaWFsaXplci5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./emotion-jest-serializer.cjs.prod.js");
} else {
module.exports = require("./emotion-jest-serializer.cjs.dev.js");
}
Object.defineProperty(exports, '__esModule', { value: true });
var createSerializer = require('../../dist/create-serializer-95517190.cjs.js');
require('@babel/runtime/helpers/extends');
require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
require('@babel/runtime/helpers/createForOfIteratorHelperLoose');
require('@emotion/css-prettifier');
var _createSerializer = createSerializer.createSerializer(),
test = _createSerializer.test,
serialize = _createSerializer.serialize;
exports.serialize = serialize;
exports.test = test;

@@ -1,2 +0,2 @@

import { c as createSerializer } from '../../dist/create-serializer-fe4dd36c.esm.js';
import { c as createSerializer } from '../../dist/create-serializer-f94a97a2.esm.js';
import '@babel/runtime/helpers/extends';

@@ -3,0 +3,0 @@ import '@babel/runtime/helpers/objectWithoutPropertiesLoose';

@@ -1,3 +0,2 @@

// @flow
import type { Options } from './create-serializer'
/* import type { Options } from './create-serializer' */
import { createSerializer as createEmotionSerializer } from './create-serializer'

@@ -71,3 +70,3 @@ import * as enzymeTickler from './enzyme-tickler'

includeStyles = true
}: Options = {}) {
} /* : Options */ = {}) {
const emotionSerializer = createEmotionSerializer({

@@ -79,12 +78,12 @@ classNameReplacer,

return {
test(node: *) {
test(node) {
return wrappedEnzymeSerializer.test(node) || emotionSerializer.test(node)
},
serialize(
node: *,
config: *,
indentation: string,
depth: number,
refs: *,
printer: Function
node,
config,
indentation /*: string */,
depth /*: number */,
refs,
printer /*: Function */
) {

@@ -91,0 +90,0 @@ if (wrappedEnzymeSerializer.test(node)) {

@@ -1,2 +0,1 @@

// @flow
import prettify from '@emotion/css-prettifier'

@@ -52,3 +51,3 @@ import { replaceClassNames } from './replace-class-names'

const transformed: any = transform(node)
const transformed = transform(node)

@@ -59,3 +58,3 @@ if (transformed !== node && transformed.children) {

children: flatMap(
(deepTransform(transformed.children, transform): any),
deepTransform(transformed.children, transform),
id => id

@@ -70,5 +69,5 @@ )

function getPrettyStylesFromClassNames(
classNames: Array<string>,
elements: Array<HTMLStyleElement>,
indentation: string
classNames /*: Array<string> */,
elements /*: Array<HTMLStyleElement> */,
indentation /*: string */
) {

@@ -78,2 +77,3 @@ return prettify(getStylesFromClassNames(classNames, elements), indentation)

/*
export type Options = {

@@ -84,2 +84,3 @@ classNameReplacer?: (className: string, index: number) => string,

}
*/

@@ -110,5 +111,5 @@ function filterEmotionProps(props = {}) {

function isShallowEnzymeElement(
element: any,
keys: string[],
labels: string[]
element /*: any */,
keys /*: string[] */,
labels /*: string[] */
) {

@@ -125,43 +126,44 @@ const childClassNames = (element.children || [])

const createConvertEmotionElements = (keys: string[]) => (node: any) => {
if (isPrimitive(node)) {
return node
}
if (isEmotionCssPropEnzymeElement(node)) {
const className = enzymeTickler.getTickledClassName(node.props.css)
const labels = getLabelsFromClassName(keys, className || '')
const createConvertEmotionElements =
(keys /*: string[]*/) => (node /*: any*/) => {
if (isPrimitive(node)) {
return node
}
if (isEmotionCssPropEnzymeElement(node)) {
const className = enzymeTickler.getTickledClassName(node.props.css)
const labels = getLabelsFromClassName(keys, className || '')
if (isShallowEnzymeElement(node, keys, labels)) {
const emotionType = node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__
// emotionType will be a string for DOM elements
const type =
typeof emotionType === 'string'
? emotionType
: emotionType.displayName || emotionType.name || 'Component'
if (isShallowEnzymeElement(node, keys, labels)) {
const emotionType = node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__
// emotionType will be a string for DOM elements
const type =
typeof emotionType === 'string'
? emotionType
: emotionType.displayName || emotionType.name || 'Component'
return {
...node,
props: filterEmotionProps({
...node.props,
className
}),
type
}
} else {
return node.children[node.children.length - 1]
}
}
if (isEmotionCssPropElementType(node)) {
return {
...node,
props: filterEmotionProps({
...node.props,
className
}),
type
props: filterEmotionProps(node.props),
type: node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__
}
} else {
return node.children[node.children.length - 1]
}
}
if (isEmotionCssPropElementType(node)) {
return {
...node,
props: filterEmotionProps(node.props),
type: node.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__
if (isReactElement(node)) {
return copyProps({}, node)
}
return node
}
if (isReactElement(node)) {
return copyProps({}, node)
}
return node
}
function clean(node: any, classNames: string[]) {
function clean(node, classNames /*: string[] */) {
if (Array.isArray(node)) {

@@ -196,3 +198,3 @@ for (const child of node) {

includeStyles = true
}: Options = {}) {
} /* : Options */ = {}) {
const cache = new WeakSet()

@@ -202,8 +204,8 @@ const isTransformed = val => cache.has(val)

function serialize(
val: *,
config: *,
indentation: string,
depth: number,
refs: *,
printer: Function
val,
config,
indentation /*: string */,
depth /*: number */,
refs,
printer /*: Function */
) {

@@ -235,3 +237,3 @@ const elements = getStyleElements()

return {
test(val: *) {
test(val) {
return (

@@ -238,0 +240,0 @@ val &&

@@ -1,3 +0,2 @@

// @flow
import { createEnzymeSerializer } from './create-enzyme-serializer'
export const { test, serialize } = createEnzymeSerializer()

@@ -1,3 +0,2 @@

// @flow
export { createEnzymeSerializer } from './create-enzyme-serializer'
export { matchers } from './matchers'

@@ -1,3 +0,2 @@

// @flow
export { createSerializer } from './create-serializer'
export { matchers } from './matchers'

@@ -1,2 +0,1 @@

// @flow
import chalk from 'chalk'

@@ -43,6 +42,6 @@ import * as stylis from 'stylis'

function toHaveStyleRule(
received: *,
property: *,
value: *,
options?: { target?: string | RegExp, media?: string } = {}
received,
property,
value,
options /* ?: { target?: string | RegExp, media?: string } */ = {}
) {

@@ -49,0 +48,0 @@ if (Array.isArray(received)) {

@@ -1,2 +0,1 @@

// @flow
function defaultClassNameReplacer(className, index) {

@@ -9,10 +8,10 @@ return `emotion-${index}`

export const replaceClassNames = (
classNames: Array<string>,
styles: string,
code: string,
keys: Array<string>,
classNameReplacer: (
classNames /*: Array<string> */,
styles /*: string */,
code /*: string */,
keys /*: Array<string> */,
classNameReplacer /*: (
className: string,
index: number
) => string = defaultClassNameReplacer
) => string */ = defaultClassNameReplacer
) => {

@@ -22,15 +21,18 @@ let index = 0

return classNames.reduce((acc, className) => {
if (
keyPattern.test(className) ||
componentSelectorClassNamePattern.test(className)
) {
const escapedRegex = new RegExp(
className.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'),
'g'
)
return acc.replace(escapedRegex, classNameReplacer(className, index++))
}
return acc
}, `${styles}${styles ? '\n\n' : ''}${code}`)
return classNames.reduce(
(acc, className) => {
if (
keyPattern.test(className) ||
componentSelectorClassNamePattern.test(className)
) {
const escapedRegex = new RegExp(
className.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'),
'g'
)
return acc.replace(escapedRegex, classNameReplacer(className, index++))
}
return acc
},
`${styles}${styles ? '\n\n' : ''}${code}`
)
}

@@ -1,3 +0,2 @@

// @flow
import { createSerializer } from './create-serializer'
export const { test, serialize } = createSerializer()

@@ -1,3 +0,20 @@

// @flow
const insertedRules = new WeakMap()
if (typeof CSSStyleSheet !== 'undefined') {
const insertRule = CSSStyleSheet.prototype.insertRule
CSSStyleSheet.prototype.insertRule = function (...args) {
let sheetRules = insertedRules.get(this)
if (!sheetRules) {
sheetRules = []
insertedRules.set(this, sheetRules)
}
const rule = args[0]
sheetRules.push(rule)
return insertRule.apply(this, args)
}
}
const isBrowser = typeof document !== 'undefined'

@@ -9,7 +26,13 @@

export function flatMap<T, S>(arr: T[], iteratee: (arg: T) => S[] | S): S[] {
export function flatMap /* <T, S> */(
arr /*: T[] */,
iteratee /*: (arg: T) => S[] | S */
) /*: S[] */ {
return [].concat(...arr.map(iteratee))
}
export function findLast<T>(arr: T[], predicate: T => boolean) {
export function findLast /* <T> */(
arr /*: T[] */,
predicate /*: T => boolean */
) {
for (let i = arr.length - 1; i >= 0; i--) {

@@ -22,6 +45,6 @@ if (predicate(arr[i])) {

export function findIndexFrom<T>(
arr: T[],
fromIndex: number,
predicate: T => boolean
export function findIndexFrom /* <T> */(
arr /*: T[] */,
fromIndex /*: number */,
predicate /*: T => boolean */
) {

@@ -37,3 +60,3 @@ for (let i = fromIndex; i < arr.length; i++) {

function getClassNames(selectors: any, classes?: string) {
function getClassNames(selectors, classes /* ?: string */) {
return classes ? selectors.concat(classes.split(' ')) : selectors

@@ -64,3 +87,3 @@ }

export function unwrapFromPotentialFragment(node: *) {
export function unwrapFromPotentialFragment(node) {
if (node.type() === Symbol.for('react.fragment')) {

@@ -93,7 +116,7 @@ const isShallow = !!node.dive

function getClassNamesFromDOMElement(selectors, node: any) {
function getClassNamesFromDOMElement(selectors, node) {
return getClassNames(selectors, node.getAttribute('class'))
}
export function isReactElement(val: any): boolean {
export function isReactElement(val) /*: boolean */ {
return (

@@ -105,3 +128,3 @@ val.$$typeof === Symbol.for('react.test.json') ||

export function isEmotionCssPropElementType(val: any): boolean {
export function isEmotionCssPropElementType(val) /*: boolean */ {
return (

@@ -113,3 +136,3 @@ val.$$typeof === Symbol.for('react.element') &&

export function isStyledElementType(val: any): boolean {
export function isStyledElementType(val /* : any */) /* : boolean */ {
if (val.$$typeof !== Symbol.for('react.element')) {

@@ -122,3 +145,3 @@ return false

export function isEmotionCssPropEnzymeElement(val: any): boolean {
export function isEmotionCssPropEnzymeElement(val /* : any */) /*: boolean */ {
return (

@@ -131,3 +154,3 @@ val.$$typeof === Symbol.for('react.test.json') &&

export function isDOMElement(val: any): boolean {
export function isDOMElement(val) /*: boolean */ {
return (

@@ -141,11 +164,11 @@ val.nodeType === 1 &&

function isEnzymeElement(val: any): boolean {
function isEnzymeElement(val) /*: boolean */ {
return typeof val.findWhere === 'function'
}
function isCheerioElement(val: any): boolean {
function isCheerioElement(val) /*: boolean */ {
return val.cheerio === '[cheerio object]'
}
export function getClassNamesFromNodes(nodes: Array<any>) {
export function getClassNamesFromNodes(nodes /*: Array<any> */) {
return nodes.reduce((selectors, node) => {

@@ -167,3 +190,3 @@ if (isEnzymeElement(node)) {

const getElementRules = (element: HTMLStyleElement): string[] => {
const getElementRules = (element /*: HTMLStyleElement */) /*: string[] */ => {
const nonSpeedyRule = element.textContent

@@ -176,3 +199,6 @@ if (nonSpeedyRule) {

}
// $FlowFixMe - flow doesn't know about `cssRules` property
const rules = insertedRules.get(element.sheet)
if (rules) {
return rules
}
return [].slice.call(element.sheet.cssRules).map(cssRule => cssRule.cssText)

@@ -195,5 +221,5 @@ }

export function getStylesFromClassNames(
classNames: Array<string>,
elements: Array<HTMLStyleElement>
): string {
classNames /*: Array<string> */,
elements /*: Array<HTMLStyleElement> */
) /*: string */ {
if (!classNames.length) {

@@ -228,3 +254,3 @@ return ''

let styles = rules
.map((rule: string) => {
.map((rule /*: string */) => {
const match = rule.match(selectorPattern)

@@ -276,3 +302,3 @@ if (!match) {

export function getStyleElements(): Array<HTMLStyleElement> {
export function getStyleElements() /*: Array<HTMLStyleElement> */ {
if (!isBrowser) {

@@ -284,3 +310,2 @@ throw new Error(

const elements = Array.from(document.querySelectorAll('style[data-emotion]'))
// $FlowFixMe
return elements

@@ -291,9 +316,5 @@ }

export function getKeys(elements: Array<HTMLStyleElement>) {
export function getKeys(elements /*: Array<HTMLStyleElement> */) {
const keys = unique(
elements.map(
element =>
// $FlowFixMe we know it exists since we query for elements with this attribute
(element.getAttribute('data-emotion'): string)
)
elements.map(element => element.getAttribute('data-emotion'))
).filter(Boolean)

@@ -304,6 +325,6 @@ return keys

export function hasClassNames(
classNames: Array<string>,
selectors: Array<string>,
target?: string | RegExp
): boolean {
classNames /*: Array<string> */,
selectors /*: Array<string> */,
target /* ?: string | RegExp */
) /*: boolean */ {
// selectors is the classNames of specific css rule

@@ -328,3 +349,6 @@ return selectors.some(selector => {

export function getMediaRules(rules: Array<Object>, media: string): Array<any> {
export function getMediaRules(
rules /*: Array<Object> */,
media /*: string */
) /*: Array<any> */ {
return flatMap(

@@ -341,8 +365,8 @@ rules.filter(rule => {

export function isPrimitive(test: any) {
export function isPrimitive(test) {
return test !== Object(test)
}
export function hasIntersection(left: any[], right: any[]) {
export function hasIntersection(left /* any[] */, right /* any[] */) {
return left.some(value => right.includes(value))
}

@@ -1,2 +0,2 @@

// TypeScript Version: 2.9
// TypeScript Version: 4.3

@@ -3,0 +3,0 @@ /// <reference types="jest" />

// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.9
// TypeScript Version: 4.3

@@ -4,0 +4,0 @@ /// <reference types="jest" />

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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