3 A smaller version of caniuse-db, with only the essentials!
7 The full data behind [Can I use][1] is incredibly useful for any front end
8 developer, and on the website all of the details from the database are displayed
9 to the user. However in automated tools, [many of these fields go unused][2];
10 it's not a problem for server side consumption but client side, the less
11 JavaScript that we send to the end user the better.
13 caniuse-lite then, is a smaller dataset that keeps essential parts of the data
14 in a compact format. It does this in multiple ways, such as converting `null`
15 array entries into empty strings, representing support data as an integer rather
16 than a string, and using base62 references instead of longer human-readable
19 This packed data is then reassembled (via functions exposed by this module) into
20 a larger format which is mostly compatible with caniuse-db, and so it can be
21 used as an almost drop-in replacement for caniuse-db for contexts where size on
22 disk is important; for example, usage in web browsers. The API differences are
23 very small and are detailed in the section below.
29 import * as lite from 'caniuse-lite';
35 caniuse-db provides a full `data.json` file which contains all of the features
36 data. Instead of this large file, caniuse-lite provides this data subset
37 instead, which has the `browser`, `prefix`, `prefix_exceptions`, `usage_global`
38 and `versions` keys from the original.
40 In addition, the subset contains the `release_date` key with release dates (as timestamps) for each version:
56 ### `lite.feature(js)`
58 The `feature` method takes a file from `data/features` and converts it into
59 something that more closely represents the `caniuse-db` format. Note that only
60 the `title`, `stats` and `status` keys are kept from the original data.
65 The `features` index is provided as a way to query all of the features that
66 are 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.
72 The `region` method takes a file from `data/regions` and converts it into
73 something that more closely represents the `caniuse-db` format. Note that *only*
74 the usage data is exposed here (the `data` key in the original files).
79 The 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
81 somewhere that the source is caniuse.com. If you have any questions about using
82 the data for your project please contact me here: http://a.deveria.com/contact
84 [1]: http://caniuse.com/
85 [2]: https://github.com/Fyrd/caniuse/issues/1827
88 ## Security contact information
90 To report a security vulnerability, please use the
91 [Tidelift security contact](https://tidelift.com/security).
92 Tidelift will coordinate the fix and disclosure.