3 Object.defineProperty(exports, "__esModule", {
6 exports.default = parseMedia;
8 var _Container = require('./nodes/Container');
10 var _Container2 = _interopRequireDefault(_Container);
12 var _parsers = require('./parsers');
14 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 * Parses a media query list into an array of nodes. A typical node signature:
\r
18 * {string} node.type -- one of: 'media-query', 'media-type', 'keyword',
\r
19 * 'media-feature-expression', 'media-feature', 'colon', 'value'
\r
20 * {string} node.value -- the contents of a particular element, trimmed
\r
21 * e.g.: `screen`, `max-width`, `1024px`
\r
22 * {string} node.after -- whitespaces that follow the element
\r
23 * {string} node.before -- whitespaces that precede the element
\r
24 * {string} node.sourceIndex -- the index of the element in a source media
\r
25 * query list, 0-based
\r
26 * {object} node.parent -- a link to the parent node (a container)
\r
28 * Some nodes (media queries, media feature expressions) contain other nodes.
\r
29 * They additionally have:
\r
30 * {array} node.nodes -- an array of nodes of the type described here
\r
31 * {funciton} node.each -- traverses direct children of the node, calling
\r
32 * a callback for each one
\r
33 * {funciton} node.walk -- traverses ALL descendants of the node, calling
\r
34 * a callback for each one
\r
37 function parseMedia(value) {
38 return new _Container2.default({
39 nodes: (0, _parsers.parseMediaList)(value),
40 type: 'media-query-list',