amis-rpc-design/node_modules/json2mq
2023-10-07 19:42:30 +08:00
..
test v1.0.0 2023-10-07 19:42:30 +08:00
.npmignore v1.0.0 2023-10-07 19:42:30 +08:00
index.js v1.0.0 2023-10-07 19:42:30 +08:00
LICENSE v1.0.0 2023-10-07 19:42:30 +08:00
package.json v1.0.0 2023-10-07 19:42:30 +08:00
README.md v1.0.0 2023-10-07 19:42:30 +08:00

json2mq

json2mq is used to generate media query string from JSON or javascript object.

Install

npm install json2mq

Usage

var json2mq = require('json2mq');
json2mq({minWidth: 100, maxWidth: 200});
// -> '(min-width: 100px) and (max-width: 200px)'
  • Media type
json2mq({screen: true});  // -> 'screen'
  • Media type with negation
json2mq({handheld: false});  // -> 'not handheld'
  • Media features can be specified in camel case
json2mq({minWidth: 100, maxWidth: 200});
// -> '(min-width: 100px) and (max-width: 200px)'
  • px is added to numeric dimension values
json2mq({minWidth: 100, maxWidth: '20em'});
// -> '(min-width: 100px) and (max-width: 20em)'
  • Multiple media queries can be passed as an array
json2mq([{screen: true, minWidth: 100}, {handheld: true, orientation: 'landscape'}]); 
// -> 'screen and (min-width: 100px), handheld and (orientation: landscape)'

Contributors

  • Eric Schoffstall