simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

README.md (3122B)


      1 # caniuse-lite
      2 
      3 A smaller version of caniuse-db, with only the essentials!
      4 
      5 ## Why?
      6 
      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.
     12 
     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
     17 keys.
     18 
     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.
     24 
     25 
     26 ## API
     27 
     28 ```js
     29 import * as lite from 'caniuse-lite';
     30 ```
     31 
     32 
     33 ### `lite.agents`
     34 
     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.
     39 
     40 In 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 
     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.
     61 
     62 
     63 ### `lite.features`
     64 
     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.
     68 
     69 
     70 ### `lite.region(js)`
     71 
     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).
     75 
     76 
     77 ## License
     78 
     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
     83 
     84 [1]: http://caniuse.com/
     85 [2]: https://github.com/Fyrd/caniuse/issues/1827
     86 
     87 
     88 ## Security contact information
     89 
     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.