Skip to content

Commit ff3b64d

Browse files
authored
Fix old code samples (#37)
* Update gitignore * Update doc * Whitespace changes * Whitespace changes * Linting
1 parent 2798cf0 commit ff3b64d

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ docs
1010
# coverage
1111
.nyc_output
1212
coverage
13+
14+
# Ruby Jekyll
15+
Gemfile.lock
16+
.jekyll-cache/

src/bigdecimal.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,16 @@ export enum RoundingMode {
141141
*
142142
* Sample Usage:
143143
* ```javascript
144-
* const { Big, MathContext, RoundingMode } = require('bigdecimal.js');
144+
* const { Big, MC, RoundingMode } = require('bigdecimal.js');
145145
*
146146
* const x = Big('1');
147147
* const y = Big('3');
148148
*
149-
* const res1 = x.divide(y, new MathContext(3));
149+
* const res1 = x.divideWithMathContext(y, new MC(3));
150150
* console.log(res1.toString()); // 0.333
151151
*
152-
* const res2 = x.divide(y, MathContext(3, RoundingMode.UP)); // You can also use without `new` operator
152+
* // You can also use without `new` operator
153+
* const res2 = x.divideWithMathContext(y, MC(3, RoundingMode.UP));
153154
* console.log(res2.toString()); // 0.334
154155
*
155156
* try {
@@ -4253,19 +4254,17 @@ interface BigDecimalConstructor {
42534254
* const { Big } = require('bigdecimal.js');
42544255
*
42554256
* // Constructor accepts any value such as string and BigDecimal itself:
4256-
*
42574257
* const x = Big('1.1111111111111111111111');
42584258
* const y = Big(x);
42594259
*
4260+
* // You can do arithmetic operations
42604261
* const z = x.add(y);
42614262
* console.log(z.toString()); // 2.2222222222222222222222
42624263
*
4263-
*
4264+
* // You can also construct a BigDecimal from a number or a BigInt:
42644265
* const u = Big(1.1);
42654266
* const v = Big(2n);
42664267
*
4267-
* // You can also construct a BigDecimal from a number or a BigInt:
4268-
*
42694268
* console.log(u.toString()); // 1.1
42704269
* console.log(v.toString()); // 2
42714270
* ```
@@ -4299,15 +4298,16 @@ interface MathContextConstructor {
42994298
*
43004299
* Sample Usage:
43014300
* ```javascript
4302-
* const { Big, MathContext, RoundingMode } = require('bigdecimal.js');
4301+
* const { Big, MC, RoundingMode } = require('bigdecimal.js');
43034302
*
43044303
* const x = Big('1');
43054304
* const y = Big('3');
43064305
*
4307-
* const res1 = x.divide(y, new MathContext(3));
4306+
* const res1 = x.divideWithMathContext(y, new MC(3));
43084307
* console.log(res1.toString()); // 0.333
43094308
*
4310-
* const res2 = x.divide(y, MathContext(3, RoundingMode.UP)); // You can also use without `new` operator
4309+
* // You can also use without `new` operator
4310+
* const res2 = x.divideWithMathContext(y, MC(3, RoundingMode.UP));
43114311
* console.log(res2.toString()); // 0.334
43124312
*
43134313
* try {

0 commit comments

Comments
 (0)