String2MediaQuery
Install
$ npm install --save String2MediaQuery
Usage
var mq = ;//=> (min-width: 320px) var mq = ;//=> (min-width: 320px) and (max-width: 1023px) // The result can then be used with window.matchMedia like this.if windowmatches // ...
API
String2MediaQuery(query, breakpoints)
query
Required
Type: string
The simplified query as text.
breakpoints
Type: object
Default: {}
Named breakpoints can be passed as an object with names and with as string
with pixel units. ex: {mobile: "320px", desktop: "960px"}
This is expecially useful if you are importing css breakpoints.
License
MIT © David Mignot