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

nocssjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nocssjs - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

4

package.json
{
"name": "nocssjs",
"version": "0.2.2",
"version": "0.2.3",
"description": "NoCSS -- stop writing CSS, just use Javascript",

@@ -26,4 +26,4 @@ "main": "src/index.js",

"mocha": "^2.5.3",
"mocha-brackets": "0.0.1"
"mocha-brackets": "0.0.2"
}
}

@@ -14,4 +14,5 @@ const _ = require('lodash');

(val, key) => _.each(
key.split(','), ks =>
toCSSRecursive(val, _.flatten([ns, ks]), result)));
key.split(','), ks => {
toCSSRecursive(val, _.flatten([ns, ks]), result)
}));
_.each(

@@ -33,3 +34,3 @@ _.omitBy(obj, _.isPlainObject),

function render(obj) {
function renderShallow(obj) {
const result = {};

@@ -50,3 +51,21 @@ toCSSRecursive(obj, [], result);

function render(obj) {
const mediaQueries = _.map(
_.pickBy(obj, (val, key) => {
return key[0] === '@';
}),
(val, key) => {
return key + ' {\n' + renderShallow(val) + '\n}';
}).join('\n');
console.log('media queries are', mediaQueries);
return [
renderShallow(
_.omitBy(obj, (val, key) => {
return key[0] === '@';
})),
mediaQueries
].join('\n');
}
return { render, use };
};

@@ -76,2 +76,13 @@ const assert = require('chai').assert;

],
['Media queries',
['Basic media query', () => {
assert.equal(nocss.render({
'@media (min-width:400px)': {
'h1': {
'color': 'green',
},
},
}), '@media (min-width:400px) {\nh1 {\n color: green;\n}\n}');
}]],
];

@@ -78,0 +89,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