How to use the css-select.selectAll function in css-select

To help you get started, we’ve selected a few css-select examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aloysius-pgast / crypto-exchanges-gateway / app / coinmarketcap / historical-data-scraper.js View on Github external
request(options, function (error, response, body) {
            if (null !== error || 200 != response.statusCode)
            {
                return reject({error:error,response:response,body:body});
            }
            let list = [];
            const dom = htmlparser2.parseDOM(body);
            const trList = CSSselect.selectAll('table tbody tr', dom);
            _.forEach(trList, (tr, trIndex) => {
                let tdList = CSSselect.selectAll('td', tr);
                // not enough column ?
                if (mapping.length != tdList.length)
                {
                    // no date (ie single column No data was found for the selected time period. )
                    if (1 == tdList.length && 1 == trList.length)
                    {
                        return false;
                    }
                    logger.warn("Could not parse Coin Market Cap historical data for '%s' (row #%d) : got %d columns instead of %d", currency, trIndex, tdList.length, mapping.length);
                    return false;
                }
                let entry = {};
                _.forEach(tdList, (td, tdIndex) => {
                    entry[mapping[tdIndex]] = 0 != tdIndex ? self._parseFloat(td) : self._parseDate(td);
github aloysius-pgast / crypto-exchanges-gateway / app / coinmarketcap / historical-data-scraper.js View on Github external
_.forEach(trList, (tr, trIndex) => {
                let tdList = CSSselect.selectAll('td', tr);
                // not enough column ?
                if (mapping.length != tdList.length)
                {
                    // no date (ie single column No data was found for the selected time period. )
                    if (1 == tdList.length && 1 == trList.length)
                    {
                        return false;
                    }
                    logger.warn("Could not parse Coin Market Cap historical data for '%s' (row #%d) : got %d columns instead of %d", currency, trIndex, tdList.length, mapping.length);
                    return false;
                }
                let entry = {};
                _.forEach(tdList, (td, tdIndex) => {
                    entry[mapping[tdIndex]] = 0 != tdIndex ? self._parseFloat(td) : self._parseDate(td);
                });
                // coin market cap will return newest first
github TrySound / postcss-inline-svg / lib / processors.js View on Github external
return dom => {
    if (matchId(opts.removeStroke, id)) {
      selectAll("[stroke]", dom).forEach(removeStrokeAttrib);
    }
  };
}
github TrySound / postcss-inline-svg / lib / processors.js View on Github external
Object.keys(selectors).forEach(selector => {
      selectAll(selector, svg).forEach(applyParams(selectors[selector]));
    });
  };
github spritejs / sprite-core / src / modules / dom / selector.js View on Github external
export function querySelectorAll(query, elems) {
  return CSSselect.selectAll(resolveQuery(query), elems, {adapter});
}
github spritejs / sprite-core / lib / modules / dom / selector.js View on Github external
function querySelectorAll(query, elems) {
  return CSSselect.selectAll(resolveQuery(query), elems, {
    adapter: adapter
  });
}
github superfly / fly / packages / v8env / src / document.ts View on Github external
public querySelectorAll(selector) {
    return css.selectAll(selector, this._dom).map(d => new Element(this._withParent(d)))
  }
github TrySound / postcss-inline-svg / lib / processors.js View on Github external
return dom => {
    if (matchId(opts.removeFill, id)) {
      selectAll("[fill]", dom).forEach(removeFillAttrib);
    }
  };
}
github broadly / css-inliner / lib / extract_rules.js View on Github external
function extractFromDocumentAsync(cache, dom) {
  const cssElements     = CSSselect.selectAll('style, link[rel~="stylesheet"]', dom);
  const resultPromises  = cssElements.map(element => extractFromElementAsync(cache, element) );
  const mergedPromise   = Promise.all(resultPromises).then(mergeResults);
  return mergedPromise;
}

css-select

a CSS selector compiler/engine

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

82 / 100
Full package analysis