nyc-bookstores/node_modules/cheerio/package.json

46 lines
18 KiB
JSON
Raw Normal View History

2013-05-27 20:45:59 +00:00
{
"author": {
"name": "Matt Mueller",
"email": "mattmuelle@gmail.com",
"url": "mattmueller.me"
},
"name": "cheerio",
"description": "Tiny, fast, and elegant implementation of core jQuery designed specifically for the server",
"keywords": [
"htmlparser",
"jquery",
"selector",
"scraper"
],
"version": "0.10.8",
"repository": {
"type": "git",
"url": "git://github.com/MatthewMueller/cheerio.git"
},
"main": "./index.js",
"engines": {
"node": ">= 0.6"
},
"dependencies": {
"cheerio-select": "*",
"htmlparser2": "2.x",
"underscore": "~1.4",
"entities": "0.x"
},
"devDependencies": {
"mocha": "*",
"expect.js": "*"
},
"scripts": {
"test": "make test"
},
"readme": "# cheerio [![Build Status](https://secure.travis-ci.org/MatthewMueller/cheerio.png?branch=master)](http://travis-ci.org/MatthewMueller/cheerio)\n\nFast, flexible, and lean implementation of core jQuery designed specifically for the server.\n\n## Introduction\nTeach your server HTML.\n\n```js\nvar cheerio = require('cheerio'),\n $ = cheerio.load('<h2 class = \"title\">Hello world</h2>');\n\n$('h2.title').text('Hello there!');\n$('h2').addClass('welcome');\n\n$.html();\n//=> <h2 class = \"title welcome\">Hello there!</h2>\n```\n\n## Installation\n`npm install cheerio`\n\n## Features\n__&#10084; Familiar syntax:__\nCheerio implements a subset of core jQuery. Cheerio removes all the DOM inconsistencies and browser cruft from the jQuery library, revealing its truly gorgeous API.\n\n__&#991; Blazingly fast:__\nCheerio works with a very simple, consistent DOM model. As a result parsing, manipulating, and rendering are incredibly efficient. Preliminary end-to-end benchmarks suggest that cheerio is about __8x__ faster than JSDOM.\n\n__&#10049; Insanely flexible:__\nCheerio wraps around @FB55's forgiving htmlparser. Cheerio can parse nearly any HTML or XML document.\n\n## What about JSDOM?\nI wrote cheerio because I found myself increasingly frustrated with JSDOM. For me, there were three main sticking points that I kept running into again and again:\n\n__&#8226; JSDOM's built-in parser is too strict:__\n JSDOM's bundled HTML parser cannot handle many popular sites out there today.\n\n__&#8226; JSDOM is too slow:__\nParsing big websites with JSDOM has a noticeable delay.\n\n__&#8226; JSDOM feels too heavy:__\nThe goal of JSDOM is to provide an identical DOM environment as what we see in the browser. I never really needed all this, I just wanted a simple, familiar way to do HTML manipulation.\n\n## When I would use JSDOM\n\nCheerio will not solve all your problems. I would still use JSDOM if I needed to work in a browser-like environment on the server, particularly if I wanted to automate functional tests.\n\n## API\n\n### Markup example we'll be using:\n\n```html\n<ul id=\"fruits\">\n <li class=\"apple\">Apple</li>\n <li class=\"orange\">Orange</li>\n <li class=\"pear\">Pear</li>\n</ul>\n```\n\nThis is the HTML markup we will be using in all of the API examples.\n\n### Loading\nFirst you need to load in the HTML. This step in jQuery is implicit, since jQuery operates on the one, baked-in DOM. With Cheerio, we need to pass in the HTML document.\n\nThis is the _preferred_ method:\n\n```js\nvar cheerio = require('cheerio'),\n $ = cheerio.load('<ul id = \"fruits\">...</ul>');\n```\n\nOptionally, you can also load in the HTML by passing the string as the context:\n\n```js\n$ = require('cheerio');\n$('ul', '<ul id = \"fruits\">...</ul>');\n```\n\nOr as the root:\n\n```js\n$ = require('cheerio');\n$('li', 'ul', '<ul id = \"fruits\">...</ul>');\n```\n\nYou can also pass an extra object to `.load()` if you need to modify any\nof the default parsing options:\n\n```js\n$ = cheerio.load('<ul id = \"fruits\">...</ul>', {\n ignoreWhitespace: true,\n xmlMode: true\n});\n```\n\nThese parsing options are taken directly from htmlparser, therefore any options that can be used in htmlparser\nare valid in cheerio as well. The default options are:\n\n```js\n{\n ignoreWhitespace: false,\n xmlMode: false,\n lowerCaseTags: false\n}\n```\n\nFor a list of options and their effects, see [this](https://github.com/FB55/node-htmlparser/wiki/DOMHandler) and\n[this](https://github.com/FB55/node-htmlparser/wiki/Parser-options).\n\n### Selectors\n\nCheerio's selector implementation is nearly identical to jQuery's, so the API is very similar.\n\n#### $( selector, [context], [root] )\n`selector` searches within the `context` scope which searches within the `root` scope. `selector` and `context` can be an string expression, DOM Element, array of DOM elements, or cheerio object. `root` is typically the HTML document string.\n\nThis selector method is the starting point for traversing and manipulating the document. Like jQuery, it'
"readmeFilename": "Readme.md",
"_id": "cheerio@0.10.8",
"dist": {
"shasum": "26a09542c471f91af93fc568079a95f9601d3545"
},
"_from": "cheerio@",
"_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.10.8.tgz"
}