From 63cd4eb4e84c1212cf3b8e3934513d17f058002c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Hern=C3=A1ndez=20Serrano?= Date: Sat, 6 Apr 2019 12:41:11 +0200 Subject: [PATCH] Fixed typo in usage example --- README.hbs | 21 ++++++++++++--------- README.md | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/README.hbs b/README.hbs index b3e48f8..4d01d78 100644 --- a/README.hbs +++ b/README.hbs @@ -28,17 +28,20 @@ For web brosers, you can also [download the bundle from GitHub](https://raw.gith ## Usage examples ```javascript -const modArith = require('bigint-mod-arith'); +const bigintModArith = require('bigint-mod-arith'); -let a = BigInt(5); // more linter friendly -let b = 2n; // stage 3 short syntax for BigInt -let n = 19n; +// Stage 3 BigInts with value 666 can be declared as BigInt('666') +// or the shorte no-linter-friendly new syntax 666n -console.log(modArith.modPow(a, b, n)); // prints 13 - -console.log(modArith.modInv(2n, 5n)); // prints 3 - -console.log(modArith.modInv(3n, 5n)); // prints 2 +let a = BigInt('5'); +let b = BigInt('2'); +let n = BigInt('19'); + +console.log(bigintModArith.modPow(a, b, n)); // prints 6 + +console.log(bigintModArith.modInv(BigInt('2'), BigInt('5'))); // prints 3 + +console.log(bigintModArith.modInv(BigInt('3'), BigInt('5'))); // prints 2 ``` # bigint-mod-arith JS Doc diff --git a/README.md b/README.md index f6d94a8..3ffb943 100644 --- a/README.md +++ b/README.md @@ -28,17 +28,20 @@ For web brosers, you can also [download the bundle from GitHub](https://raw.gith ## Usage examples ```javascript -const modArith = require('bigint-mod-arith'); +const bigintModArith = require('bigint-mod-arith'); -let a = BigInt(5); // more linter friendly -let b = 2n; // stage 3 short syntax for BigInt -let n = 19n; +// Stage 3 BigInts with value 666 can be declared as BigInt('666') +// or the shorte no-linter-friendly new syntax 666n -console.log(modArith.modPow(a, b, n)); // prints 13 - -console.log(modArith.modInv(2n, 5n)); // prints 3 - -console.log(modArith.modInv(3n, 5n)); // prints 2 +let a = BigInt('5'); +let b = BigInt('2'); +let n = BigInt('19'); + +console.log(bigintModArith.modPow(a, b, n)); // prints 6 + +console.log(bigintModArith.modInv(BigInt('2'), BigInt('5'))); // prints 3 + +console.log(bigintModArith.modInv(BigInt('3'), BigInt('5'))); // prints 2 ``` # bigint-mod-arith JS Doc