Changeset View
Changeset View
Standalone View
Standalone View
node_modules/css-select-base-adapter/readme.md
- This file was added.
1 | # css-select-base-adapter | ||||
---|---|---|---|---|---|
2 | | ||||
3 | Provides some base functions needed by a | ||||
4 | [`css-select`](https://github.com/fb55/css-select) adapter so that you don't | ||||
5 | have to implement the whole thing. | ||||
6 | | ||||
7 | ## usage | ||||
8 | | ||||
9 | `npm install css-select-base-adapter --save` | ||||
10 | | ||||
11 | ```javascript | ||||
12 | var baseAdapter = require('css-select-base-adapter'); | ||||
13 | | ||||
14 | var myAdapter = { | ||||
15 | // your partial implementation here | ||||
16 | }; | ||||
17 | | ||||
18 | // get an adapter with everything needed by css-select | ||||
19 | var adapter = baseAdapter(myAdapter); | ||||
20 | | ||||
21 | // use adapter with css-select... | ||||
22 | ``` | ||||
23 | | ||||
24 | ## how it works | ||||
25 | | ||||
26 | An adapter for `css-select` requires the following functions to be implemented: | ||||
27 | | ||||
28 | ``` | ||||
29 | isTag, existsOne, getAttributeValue, getChildren, getName, getParent, | ||||
30 | getSiblings, getText, hasAttrib, removeSubsets, findAll, findOne | ||||
31 | ``` | ||||
32 | | ||||
33 | You can pass this module a more minimal implementation and it will return a full | ||||
34 | adapter that fills in any missing functions, provided that you implement at | ||||
35 | least: | ||||
36 | | ||||
37 | ``` | ||||
38 | isTag, getAttributeValue, getChildren, getName, getParent, getText | ||||
39 | ``` | ||||
40 | | ||||
41 | If you provide any of the other methods required of an adapter, the base adapter | ||||
42 | will use your implementation instead of its own. | ||||
43 | | ||||
44 | See the | ||||
45 | [`css-select` readme](https://github.com/fb55/css-select/blob/master/README.md) | ||||
46 | for more information on the required function signatures. | ||||
47 | | ||||
48 | ## license | ||||
49 | | ||||
50 | MIT License | ||||
51 | | ||||
52 | Copyright (c) 2018 Nik Coughlin | ||||
53 | | ||||
54 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
55 | of this software and associated documentation files (the "Software"), to deal | ||||
56 | in the Software without restriction, including without limitation the rights | ||||
57 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
58 | copies of the Software, and to permit persons to whom the Software is | ||||
59 | furnished to do so, subject to the following conditions: | ||||
60 | | ||||
61 | The above copyright notice and this permission notice shall be included in all | ||||
62 | copies or substantial portions of the Software. | ||||
63 | | ||||
64 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
65 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
67 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
68 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
69 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
70 | SOFTWARE. | ||||
71 | No newline at end of file |