source: trip-planner-front/node_modules/num2fraction/README.md@ 6fe77af

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

initial commit

  • Property mode set to 100644
File size: 2.5 KB
Line 
1# num2fraction
2
3[![Build Status](https://travis-ci.org/yisibl/num2fraction.svg)](https://travis-ci.org/yisibl/num2fraction)
4[![NPM Downloads](https://img.shields.io/npm/dm/num2fraction.svg?style=flat)](https://www.npmjs.com/package/num2fraction)
5[![NPM Version](http://img.shields.io/npm/v/num2fraction.svg?style=flat)](https://www.npmjs.com/package/num2fraction)
6[![License](https://img.shields.io/npm/l/num2fraction.svg?style=flat)](http://opensource.org/licenses/MIT)
7
8> Converting Number to Fraction with Node.js.
9
10## Installation
11
12```console
13npm install num2fraction
14```
15
16## Usage
17
18```js
19var π = Math.PI
20var n2f = require('num2fraction')
21 console.log(n2f(0)) // => 0
22 console.log(n2f(.2)) // => 1/5
23 console.log(n2f(1.1)) // => 11/10
24 console.log(n2f(1.2)) // => 6/5
25 console.log(n2f(1.3)) // => 13/10
26 console.log(n2f(1.4)) // => 7/5
27 console.log(n2f(1.5)) // => 3/2
28 console.log(n2f(2)) // => 2/1
29 console.log(n2f(2.1)) // => 21/10
30 console.log(n2f(3)) // => 3/1
31 console.log(n2f(2.555)) // => 511/200
32 console.log(n2f(8.36)) // => 209/25
33 console.log(n2f('3em')) // => 3/1
34 console.log(n2f('1.5px')) // => 3/2
35 console.log(n2f(7 / 9) // => 7/9
36 console.log(n2f(8 / 9) // => 8/9
37 console.log(n2f(512 / 999) // => 512/999
38 console.log(n2f((2 * π / 3) / π) // => 2/3
39 console.log(n2f((8 * 5) / (4 / 2)) // => 20/1
40```
41
42## Example
43
44Opera [old versions](http://www.opera.com/docs/specs/presto28/css/o-vendor/) support the non-standard `-o-min-device-pixel-ratio` or `-o-max-device-pixel-ratio` in CSS media queries.
45
46```css
47@media
48 only screen and (-webkit-min-device-pixel-ratio: 2),
49 only screen and ( min--moz-device-pixel-ratio: 2),
50 only screen and ( -o-min-device-pixel-ratio: 2/1), /* Opera */
51 only screen and ( min-device-pixel-ratio: 2),
52 only screen and ( min-resolution: 192dpi), /* fallback */
53 only screen and ( min-resolution: 2dppx) {
54
55}
56```
57
58## Changelog
59
60### v1.2.2
61
62* \+ Remove: Debug log message.
63
64### v1.2.1
65
66* \+ Fix: 0 must be converted to a string.
67
68### v1.2.0
69
70* \+ Fix: Accomodate rounding errors. (by @jamestalmage)
71* \+ Fix: The negative sign should be on numerator. (by @jamestalmage)
72
73### v1.1.0
74
75* \+ Use more precise (not fixed) precision factor for the calculation
76
77### v1.0.1
78
79* \- Remove "ci.testling.com"
80
81### V1.0.0
82
83> First release.
84
85## License
86
87[MIT](LICENSE)
Note: See TracBrowser for help on using the repository browser.