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

dallas

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

dallas - npm Package Compare versions

Comparing version 3.1.1 to 4.0.0

21

index.js
import React, { memo, createElement } from 'react'
const E = Symbol('exclude')
const toDiv = props => createElement('div', props)
const Div = props => createElement('div', props)
const applyClassName = (a, b) => (a && b ? `${a} ${b}` : b || a)

@@ -141,9 +141,15 @@ const prepareOptions = options => {

export const classeNoMemo = (options, render) => {
const withName = (displayName, comp) => {
comp.displayName = displayName
return comp
}
export const classe = (options, render, displayName) => {
if (!render) {
render = toDiv
render = Div
} else if (typeof render !== 'function') {
throw Error(`render argument must be a function`)
}
return dallas(prepareOptions(options), render)
displayName || (displayName = render.displayName || render.name)
return withName(displayName, dallas(prepareOptions(options), render))
}

@@ -154,3 +160,2 @@

export const classe = (options, render) => memo(classeNoMemo(options, render))
export const wrapper = options => {

@@ -162,3 +167,4 @@ const { baseClassName, ...opts } = prepareOptions(options)

if (render) {
return dallas({ ...opts, baseClassName: classes.join(' ') }, render)
const comp = dallas({ ...opts, baseClassName: classes.join(' ') }, render)
return withName(render.displayName || render.name, comp)
}

@@ -169,3 +175,3 @@ const i = classes.length - 1

{ ...opts, baseClassName: classes.slice(0, i).join(' ') },
props => createElement(nodeType, props),
withName(nodeType, props => createElement(nodeType, props)),
)

@@ -177,2 +183,1 @@ },

}
classe.noMemo = classeNoMemo
{
"name": "dallas",
"version": "3.1.1",
"version": "4.0.0",
"description": "A wrapper for applying classes",
"main": "index.build.js",
"type": "module",
"main": "index.js",
"module": "index.js",
"scripts": {
"test": "node -r esm test.js",
"build": "schwarzy ."
"test": "node test.js"
},

@@ -24,6 +24,3 @@ "peerDependencies": {

"devDependencies": {
"esm": "^3.0.84",
"prettier": "^1.16.4",
"react": "^16.7.0-alpha.0",
"schwarzy": "0.0.3"
"react": "^16.14.0"
},

@@ -30,0 +27,0 @@ "repository": {

@@ -160,1 +160,10 @@ import { deepStrictEqual as test } from 'assert'

test(applyDallas(grouped, { mb: 3 }), { className: grouped.mb3 })
console.log('it should use keep component name')
test(classeNoMemo({}, pass).displayName, 'pass')
console.log('default name should be Div')
test(classeNoMemo({}).displayName, 'Div')
console.log('we can specify another name')
test(classeNoMemo({}, pass, 'Hey').displayName, 'Hey')
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