source: trip-planner-front/node_modules/caniuse-api/README.md@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[6a3a178]1# caniuse-api [![Build Status](https://travis-ci.org/Nyalab/caniuse-api.svg?branch=master)](https://travis-ci.org/Nyalab/caniuse-api) [![Build status](https://ci.appveyor.com/api/projects/status/6j3na522bv3bxfa5/branch/master?svg=true)](https://ci.appveyor.com/project/MoOx/caniuse-api/branch/master)
2
3request the caniuse data to check browsers compatibilities
4
5## Installation
6
7```console
8$ yarn add caniuse-api
9```
10
11## Usage
12
13```js
14const caniuse = require('caniuse-api')
15
16caniuse.getSupport('border-radius')
17caniuse.isSupported('border-radius', 'ie 8, ie 9')
18caniuse.setBrowserScope('> 5%, last 1 version')
19caniuse.getSupport('border-radius')
20// ...
21```
22
23## API
24
25#### `caniuse.getSupport(feature)`
26
27_ask since which browsers versions a feature is available_
28
29* `y`: Since which browser version the feature is available
30* `n`: Up to which browser version the feature is unavailable
31* `a`: Up to which browser version the feature is partially supported
32* `x`: Up to which browser version the feature is prefixed
33
34```js
35caniuse.getSupport('border-radius', true)
36/*
37{ and_chr: { y: 67 },
38 and_ff: { y: 60 },
39 and_qq: { y: 1.2 },
40 and_uc: { y: 11.8 },
41 android: { y: 2.1, x: 2.1 },
42 baidu: { y: 7.12 },
43 chrome: { y: 4, x: 4 },
44 edge: { y: 12 },
45 firefox: { a: 2, x: 3.6, y: 3 },
46 ie: { n: 8, y: 9 },
47 ie_mob: { y: 10 },
48 ios_saf: { y: 3.2, x: 3.2 },
49 op_mini: {},
50 op_mob: { n: 10, y: 11 },
51 opera: { n: 10, y: 10.5 },
52 safari: { y: 3.1, x: 4 },
53 samsung: { y: 4 } }
54*/
55```
56
57#### `caniuse.isSupported(feature, browsers)`
58
59_ask if a feature is supported by some browsers_
60
61```js
62caniuse.isSupported('border-radius', 'ie 8, ie 9') // false
63caniuse.isSupported('border-radius', 'ie 9') // true
64```
65
66#### `caniuse.find(query)`
67
68_search for a caniuse feature name_
69
70Ex:
71
72```js
73caniuse.find('radius') // ['border-radius']
74caniuse.find('nothingness') // []
75caniuse.find('css3')
76/*
77[ 'css3-attr',
78 'css3-boxsizing',
79 'css3-colors',
80 'css3-cursors-grab',
81 'css3-cursors-newer',
82 'css3-cursors',
83 'css3-tabsize' ]
84*/
85```
86
87#### `caniuse.getLatestStableBrowsers()`
88
89_get the current version for each browser_
90
91```js
92caniuse.getLatestStableBrowsers()
93/*
94[ 'and_chr 67',
95 'and_ff 60',
96 'and_qq 1.2',
97 'and_uc 11.8',
98 'android 67',
99 'baidu 7.12',
100 'bb 10',
101 'chrome 67',
102 'edge 17',
103 'firefox 61',
104 'ie 11',
105 'ie_mob 11',
106 'ios_saf 11.3-11.4',
107 'op_mini all',
108 'op_mob 46',
109 'opera 53',
110 'safari 11.1',
111 'samsung 7.2' ]
112*/
113```
114
115#### `caniuse.getBrowserScope()`
116
117_returns a list of browsers currently used for the scope of operations_
118
119```js
120caniuse.getBrowserScope()
121/*
122[ 'and_chr',
123 'and_ff',
124 'and_qq',
125 'and_uc',
126 'android',
127 'baidu',
128 'chrome',
129 'edge',
130 'firefox',
131 'ie',
132 'ie_mob',
133 'ios_saf',
134 'op_mini',
135 'op_mob',
136 'opera',
137 'safari',
138 'samsung' ]
139*/
140```
141
142#### `caniuse.setBrowserScope(browserscope)`
143
144_if you do not like the default browser scope, you can set it globally by using this method_
145
146* browserscope should be a 'autoprefixer' formatted string
147
148```js
149caniuse.setBrowserScope('> 5%, last 2 versions, Firefox ESR, Opera 12.1')
150```
151
152
153---
154
155## [Changelog](CHANGELOG.md)
156
157## [License](LICENSE)
Note: See TracBrowser for help on using the repository browser.