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.0.1 to 3.0.2

21

index.js

@@ -75,3 +75,2 @@ import React, { memo, createElement } from 'react'

if (className === props.className) return render(props)
const newProps = {}

@@ -91,10 +90,12 @@ if (consume) {

if (disabled) {
const classSet = new Set(className.split(' '))
for (const disabledClass of disabled) {
classSet.delete(disabledClass)
if (className) {
if (disabled) {
const classSet = new Set(className.split(' '))
for (const disabledClass of disabled) {
classSet.delete(disabledClass)
}
newProps.className = [...classSet].join(' ')
} else {
newProps.className = className
}
newProps.className = [...classSet].join(' ')
} else {
newProps.className = className
}

@@ -136,6 +137,6 @@

{ ...opts, baseClassName: classes.slice(0, i).join(' ') },
props => createElement(nodeType, props),
props => createElement(nodeType, props)
)
},
{ get: (_, key) => stepper([...classes, options[key] || key]) },
{ get: (_, key) => stepper([...classes, options[key] || key]) }
)

@@ -142,0 +143,0 @@ return stepper(baseClassName ? [baseClassName] : [])

{
"name": "dallas",
"version": "3.0.1",
"version": "3.0.2",
"description": "A wrapper for applying classes",

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

@@ -14,4 +14,4 @@ import { deepStrictEqual as test } from 'assert'

warning: 'color-orange',
error: 'color-red',
},
error: 'color-red'
}
}

@@ -25,2 +25,10 @@

console.log('we should remove `false` flags on consume')
test(applyDallas({ x: 'x', d: 'd', consume: true }, { x: false, d: true }), {
className: 'd'
})
console.log('we should remove `false` flags on consume even with no classes')
test(applyDallas({ x: 'x', d: 'd', consume: true }, { x: false }), {})
/* APPLY CLASSNAME */

@@ -35,3 +43,3 @@ console.log('it should apply className')

test(applyDallas('hello', { className: 'world' }), {
className: 'world hello',
className: 'world hello'
})

@@ -48,3 +56,3 @@

test(applyDallas(classNames, { className: 'my' }), {
className: 'my hello world',
className: 'my hello world'
})

@@ -63,15 +71,15 @@

d: true,
className: 'x d',
className: 'x d'
})
console.log(
'it should apply a single flag and concatenate with existing className',
'it should apply a single flag and concatenate with existing className'
)
test(applyDallas({ x: 'x' }, { x: true, className: 'a' }), {
x: true,
className: 'a x',
className: 'a x'
})
console.log(
'it should apply multiple flags and concatenate with existing className',
'it should apply multiple flags and concatenate with existing className'
)

@@ -81,3 +89,3 @@ test(applyDallas({ x: 'x', d: 'd' }, { x: true, d: true, className: 'a' }), {

d: true,
className: 'a x d',
className: 'a x d'
})

@@ -88,7 +96,7 @@

d: true,
className: 'a d',
className: 'a d'
})
console.log('it should not modify the object if no flags are applied')
test(applyDallas({ x: 'x', d: 'd' }, expected) === expected, true)
console.log('it should return the same props if no flags are applied')
test(applyDallas({ x: 'x', d: 'd' }, expected), expected)

@@ -100,5 +108,5 @@ /* TEST CONSUME OPTS*/

{ x: 'x', d: 'd', consume: true },
{ x: true, d: true, className: 'a' },
{ x: true, d: true, className: 'a' }
),
{ className: 'a x d' },
{ className: 'a x d' }
)

@@ -110,3 +118,3 @@

status: 'online',
className: 'on',
className: 'on'
})

@@ -117,7 +125,7 @@

status: 'offline',
className: 'a off',
className: 'a off'
})
console.log('it should not change the props when not matching')
test(applyDallas(matcher, expected) === expected, true)
test(applyDallas(matcher, expected), expected)

@@ -130,9 +138,9 @@ /* COMBINE ALL */

disabled: true,
color: 'primary',
color: 'primary'
}).className,
'my-class hello world is-disabled color-blue',
'my-class hello world is-disabled color-blue'
)
console.log('if should return the same props if no changes were nescessary')
test(applyDallas(allOptions, expected) === expected, true)
test(applyDallas(allOptions, expected), expected)

@@ -146,3 +154,3 @@ /* HANDLE WRAPPER FLAGS */

flagged({ color: 'primary' }).className,
'hello world is-disabled opacity-0 color-blue',
'hello world is-disabled opacity-0 color-blue'
)

@@ -149,0 +157,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