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

facepaint

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facepaint - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "facepaint",
"version": "1.0.1",
"version": "1.0.2",
"description": "Responsive style values for css-in-js.",

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

@@ -11,3 +11,3 @@ # facepaint

const mq = facepaint(css, [
const mq = facepaint([
'@media(min-width: 420px)',

@@ -18,3 +18,3 @@ '@media(min-width: 920px)',

const myClassName = mq({
const myClassName = css(mq({
width: ['25%', '50%', '75%', '100%'],

@@ -27,3 +27,3 @@ '& .foo': {

}
})
}))
```

@@ -30,0 +30,0 @@

/* eslint-disable no-param-reassign */
export default function(css, breakpoints) {
const mq = [""].concat(breakpoints);
export default function(breakpoints) {
const mq = [''].concat(breakpoints)
function flatten(obj) {
return css(
Object.keys(obj).reduce((slots, key) => {
if (Array.isArray(obj[key])) {
obj[key].forEach((v, index) => {
if (index === 0) {
slots[key] = v;
} else if (!slots[mq[index]]) {
slots[mq[index]] = { [key]: v };
} else {
slots[mq[index]][key] = v;
}
});
} else if (typeof obj[key] === "object") {
slots[key] = flatten(obj[key]);
} else {
slots[key] = obj[key];
}
return slots;
}, {})
);
return Object.keys(obj).reduce((slots, key) => {
if (Array.isArray(obj[key])) {
obj[key].forEach((v, index) => {
if (index === 0) {
slots[key] = v
} else if (!slots[mq[index]]) {
slots[mq[index]] = { [key]: v }
} else {
slots[mq[index]][key] = v
}
})
} else if (typeof obj[key] === 'object') {
slots[key] = flatten(obj[key])
} else {
slots[key] = obj[key]
}
return slots
}, {})
}
return (...values) => values.map(flatten);
return (...values) => values.map(flatten)
}
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