source: trip-planner-front/node_modules/caniuse-lite/README.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
1# caniuse-lite
2
3A smaller version of caniuse-db, with only the essentials!
4
5## Why?
6
7The full data behind [Can I use][1] is incredibly useful for any front end
8developer, and on the website all of the details from the database are displayed
9to the user. However in automated tools, [many of these fields go unused][2];
10it's not a problem for server side consumption but client side, the less
11JavaScript that we send to the end user the better.
12
13caniuse-lite then, is a smaller dataset that keeps essential parts of the data
14in a compact format. It does this in multiple ways, such as converting `null`
15array entries into empty strings, representing support data as an integer rather
16than a string, and using base62 references instead of longer human-readable
17keys.
18
19This packed data is then reassembled (via functions exposed by this module) into
20a larger format which is mostly compatible with caniuse-db, and so it can be
21used as an almost drop-in replacement for caniuse-db for contexts where size on
22disk is important; for example, usage in web browsers. The API differences are
23very small and are detailed in the section below.
24
25
26## API
27
28```js
29import * as lite from 'caniuse-lite';
30```
31
32
33### `lite.agents`
34
35caniuse-db provides a full `data.json` file which contains all of the features
36data. Instead of this large file, caniuse-lite provides this data subset
37instead, which has the `browser`, `prefix`, `prefix_exceptions`, `usage_global`
38and `versions` keys from the original.
39
40In addition, the subset contains the `release_date` key with release dates (as timestamps) for each version:
41```json
42{
43 "release_date": {
44 "6": 998870400,
45 "7": 1161129600,
46 "8": 1237420800,
47 "9": 1300060800,
48 "10": 1346716800,
49 "11": 1381968000,
50 "5.5": 962323200
51 }
52}
53```
54
55
56### `lite.feature(js)`
57
58The `feature` method takes a file from `data/features` and converts it into
59something that more closely represents the `caniuse-db` format. Note that only
60the `title`, `stats` and `status` keys are kept from the original data.
61
62
63### `lite.features`
64
65The `features` index is provided as a way to query all of the features that
66are listed in the `caniuse-db` dataset. Note that you will need to use the
67`feature` method on values from this index to get a human-readable format.
68
69
70### `lite.region(js)`
71
72The `region` method takes a file from `data/regions` and converts it into
73something that more closely represents the `caniuse-db` format. Note that *only*
74the usage data is exposed here (the `data` key in the original files).
75
76
77## License
78
79The data in this repo is available for use under a CC BY 4.0 license
80(http://creativecommons.org/licenses/by/4.0/). For attribution just mention
81somewhere that the source is caniuse.com. If you have any questions about using
82the data for your project please contact me here: http://a.deveria.com/contact
83
84[1]: http://caniuse.com/
85[2]: https://github.com/Fyrd/caniuse/issues/1827
86
87
88## Security contact information
89
90To report a security vulnerability, please use the
91[Tidelift security contact](https://tidelift.com/security).
92Tidelift will coordinate the fix and disclosure.
Note: See TracBrowser for help on using the repository browser.