Skip to content

Commit 38e72d9

Browse files
🤖 chore: Lint source files.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/aureooms/rejuvenate/blob/67ba7d5e9b38c8944d42909a3a30b0710559b446/src/transforms/sources:initial-lint.js Please contact the author of the transform if you believe there was an error.
1 parent 967ece3 commit 38e72d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+39178
-32462
lines changed

_benchmark/index.js

Lines changed: 425 additions & 386 deletions
Large diffs are not rendered by default.

_profile/add.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ console.time('prepare');
22
require('@babel/polyfill');
33
const crypto = require('crypto');
44
const ArgumentParser = require('argparse').ArgumentParser;
5-
//const itertools = require('@aureooms/js-itertools');
5+
// Const itertools = require('@aureooms/js-itertools');
66
const XorShift128Plus = require('xorshift.js').XorShift128Plus;
7-
const { ZZ , DEFAULT_DISPLAY_BASE , DEFAULT_REPRESENTATION_BASE } = require('..');
8-
//const BN = require('bn.js');
7+
const {ZZ, DEFAULT_DISPLAY_BASE, DEFAULT_REPRESENTATION_BASE} = require('..');
8+
// Const BN = require('bn.js');
99

1010
const parser = new ArgumentParser();
1111
parser.addArgument(['M'], {defaultValue: 1000, nargs: '?'});
1212
parser.addArgument(['-N'], {defaultValue: 1000});
13-
parser.addArgument(['-s'], {defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex')});
13+
parser.addArgument(['-s'], {
14+
defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex'),
15+
});
1416
const args = parser.parseArgs();
1517
const M = args.M;
1618
const N = args.N;
@@ -21,22 +23,25 @@ console.log('number of operations:', N);
2123
console.log('seed:', seed);
2224

2325
const MAX_PRINT_DIGITS = 79;
24-
const _show = _x => _x.length <= MAX_PRINT_DIGITS ?
25-
_x :
26-
_x.slice(0,(MAX_PRINT_DIGITS-3)/2) + '...' + _x.slice(_x.length-(MAX_PRINT_DIGITS-3)/2) ;
26+
const _show = (_x) =>
27+
_x.length <= MAX_PRINT_DIGITS
28+
? _x
29+
: _x.slice(0, (MAX_PRINT_DIGITS - 3) / 2) +
30+
'...' +
31+
_x.slice(_x.length - (MAX_PRINT_DIGITS - 3) / 2);
2732

2833
const prng = new XorShift128Plus(seed);
2934
const _x = prng.randomBytes(M).toString('hex');
3035
console.log('_x:', _show(_x));
3136
const _y = prng.randomBytes(M).toString('hex');
3237
console.log('_y:', _show(_y));
3338

34-
let x = ZZ.from(_x, 16);
39+
const x = ZZ.from(_x, 16);
3540
const y = ZZ.from(_y, 16);
36-
//let x = BigInt('0x'+_x) ;
37-
//const y = BigInt('0x'+_y) ;
38-
//let x = new BN(_x,16) ;
39-
//const y = new BN(_y,16) ;
41+
// Let x = BigInt('0x'+_x) ;
42+
// const y = BigInt('0x'+_y) ;
43+
// let x = new BN(_x,16) ;
44+
// const y = new BN(_y,16) ;
4045
let z = x;
4146

4247
console.log('limbs x:', x.limbs.length);
@@ -48,12 +53,13 @@ console.timeEnd('prepare');
4853

4954
console.time('loop');
5055
for (let k = 0; k < N; ++k) {
51-
//x *= y;
52-
z = z.add(y);
53-
z = z.sub(y);
54-
//x = x + y;
55-
//x = x - y;
56+
// X *= y;
57+
z = z.add(y);
58+
z = z.sub(y);
59+
// X = x + y;
60+
// x = x - y;
5661
}
62+
5763
console.timeEnd('loop');
5864

5965
// eslint-disable-next-line no-self-compare

_profile/iadd.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ console.time('prepare');
22
require('@babel/polyfill');
33
const crypto = require('crypto');
44
const ArgumentParser = require('argparse').ArgumentParser;
5-
//const itertools = require('@aureooms/js-itertools');
5+
// Const itertools = require('@aureooms/js-itertools');
66
const XorShift128Plus = require('xorshift.js').XorShift128Plus;
7-
const { ZZ } = require('..');
8-
//const BN = require('bn.js');
7+
const {ZZ} = require('..');
8+
// Const BN = require('bn.js');
99

1010
const parser = new ArgumentParser();
1111
parser.addArgument(['M'], {defaultValue: 1000, nargs: '?'});
1212
parser.addArgument(['-N'], {defaultValue: 1000});
13-
parser.addArgument(['-s'], {defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex')});
13+
parser.addArgument(['-s'], {
14+
defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex'),
15+
});
1416
const args = parser.parseArgs();
1517
const M = args.M;
1618
const N = args.N;
@@ -26,23 +28,24 @@ console.log('_x:', _x);
2628
const _y = prng.randomBytes(M).toString('hex');
2729
console.log('_y:', _y);
2830

29-
let x = ZZ.from(_x, 16);
31+
const x = ZZ.from(_x, 16);
3032
const y = ZZ.from(_y, 16);
31-
//let x = BigInt('0x'+_x) ;
32-
//const y = BigInt('0x'+_y) ;
33-
//let x = new BN(_x,16) ;
34-
//const y = new BN(_y,16) ;
33+
// Let x = BigInt('0x'+_x) ;
34+
// const y = BigInt('0x'+_y) ;
35+
// let x = new BN(_x,16) ;
36+
// const y = new BN(_y,16) ;
3537

3638
console.timeEnd('prepare');
3739

3840
console.time('loop');
3941
for (let k = 0; k < N; ++k) {
40-
//x *= y;
41-
x.iadd(y);
42-
x.isub(y);
43-
//x = x + y;
44-
//x = x - y;
42+
// X *= y;
43+
x.iadd(y);
44+
x.isub(y);
45+
// X = x + y;
46+
// x = x - y;
4547
}
48+
4649
console.timeEnd('loop');
4750

4851
if (Math.random() < 0.0001) console.log(x);

_profile/mod.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ console.time('prepare');
22
require('@babel/polyfill');
33
const crypto = require('crypto');
44
const ArgumentParser = require('argparse').ArgumentParser;
5-
//const itertools = require('@aureooms/js-itertools');
5+
// Const itertools = require('@aureooms/js-itertools');
66
const XorShift128Plus = require('xorshift.js').XorShift128Plus;
7-
const { THRESHOLD_MUL_TOOM22 , THRESHOLD_DIV_DC } = require('@aureooms/js-integer-big-endian');
8-
const { ZZ , DEFAULT_DISPLAY_BASE , DEFAULT_REPRESENTATION_BASE } = require('..');
7+
const {
8+
THRESHOLD_MUL_TOOM22,
9+
THRESHOLD_DIV_DC,
10+
} = require('@aureooms/js-integer-big-endian');
11+
const {ZZ, DEFAULT_DISPLAY_BASE, DEFAULT_REPRESENTATION_BASE} = require('..');
912

1013
const parser = new ArgumentParser();
1114
parser.addArgument(['M'], {defaultValue: 1000, nargs: '?'});
1215
parser.addArgument(['-N'], {defaultValue: 1000});
13-
parser.addArgument(['-s'], {defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex')});
16+
parser.addArgument(['-s'], {
17+
defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex'),
18+
});
1419
const args = parser.parseArgs();
1520
const M = args.M;
1621
const N = args.N;
@@ -26,7 +31,7 @@ console.log('_x:', _x);
2631
const _y = prng.randomBytes(M).toString('hex');
2732
console.log('_y:', _y);
2833

29-
let x = ZZ.from(_x, 16);
34+
const x = ZZ.from(_x, 16);
3035
const y = ZZ.from(_y, 16);
3136
x.iadd(y.square());
3237

@@ -42,8 +47,9 @@ console.timeEnd('prepare');
4247
console.time('loop');
4348
let z;
4449
for (let k = 0; k < N; ++k) {
45-
z = x.mod(y);
50+
z = x.mod(y);
4651
}
52+
4753
console.timeEnd('loop');
4854

4955
// eslint-disable-next-line no-self-compare

_profile/mul.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ console.time('prepare');
22
require('@babel/polyfill');
33
const crypto = require('crypto');
44
const ArgumentParser = require('argparse').ArgumentParser;
5-
//const itertools = require('@aureooms/js-itertools');
5+
// Const itertools = require('@aureooms/js-itertools');
66
const XorShift128Plus = require('xorshift.js').XorShift128Plus;
7-
const { THRESHOLD_MUL_TOOM22 } = require('@aureooms/js-integer-big-endian');
8-
const { ZZ } = require('..');
7+
const {THRESHOLD_MUL_TOOM22} = require('@aureooms/js-integer-big-endian');
8+
const {ZZ} = require('..');
99

1010
const parser = new ArgumentParser();
1111
parser.addArgument(['M'], {defaultValue: 1000, nargs: '?'});
1212
parser.addArgument(['-N'], {defaultValue: 1000});
13-
parser.addArgument(['-s'], {defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex')});
13+
parser.addArgument(['-s'], {
14+
defaultValue: process.env.SEED || crypto.randomBytes(16).toString('hex'),
15+
});
1416
const args = parser.parseArgs();
1517
const M = args.M;
1618
const N = args.N;
@@ -26,7 +28,7 @@ console.log('_x:', _x);
2628
const _y = prng.randomBytes(M).toString('hex');
2729
console.log('_y:', _y);
2830

29-
let x = ZZ.from(_x, 16);
31+
const x = ZZ.from(_x, 16);
3032
const y = ZZ.from(_y, 16);
3133

3234
console.log('limbs x:', x.limbs.length);
@@ -38,8 +40,9 @@ console.timeEnd('prepare');
3840
console.time('loop');
3941
let z;
4042
for (let k = 0; k < N; ++k) {
41-
z = x.mul(y);
43+
z = x.mul(y);
4244
}
45+
4346
console.timeEnd('loop');
4447

4548
if (Math.random() < 0.0001) console.log(z);

doc/scripts/header.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
var domReady = function(callback) {
2-
var state = document.readyState ;
3-
if ( state === 'interactive' || state === 'complete' ) {
4-
callback() ;
5-
}
6-
else {
1+
const domReady = function (callback) {
2+
const state = document.readyState;
3+
if (state === 'interactive' || state === 'complete') {
4+
callback();
5+
} else {
76
document.addEventListener('DOMContentLoaded', callback);
87
}
9-
} ;
10-
8+
};
119

12-
domReady(function(){
13-
14-
var projectname = document.createElement('a');
10+
domReady(() => {
11+
const projectname = document.createElement('a');
1512
projectname.classList.add('project-name');
1613
projectname.text = 'aureooms/js-integer';
17-
projectname.href = './index.html' ;
14+
projectname.href = './index.html';
1815

19-
var header = document.getElementsByTagName('header')[0] ;
20-
header.insertBefore(projectname,header.firstChild);
16+
const header = document.querySelectorAll('header')[0];
17+
header.insertBefore(projectname, header.firstChild);
2118

22-
var testlink = document.querySelector('header > a[data-ice="testLink"]') ;
23-
testlink.href = 'https://coveralls.io/github/aureooms/js-integer' ;
24-
testlink.target = '_BLANK' ;
19+
const testlink = document.querySelector('header > a[data-ice="testLink"]');
20+
testlink.href = 'https://coveralls.io/github/aureooms/js-integer';
21+
testlink.target = '_BLANK';
2522

26-
var searchBox = document.querySelector('.search-box');
27-
var input = document.querySelector('.search-input');
23+
const searchBox = document.querySelector('.search-box');
24+
const input = document.querySelector('.search-input');
2825

29-
// active search box when focus on searchBox.
30-
input.addEventListener('focus', function(){
26+
// Active search box when focus on searchBox.
27+
input.addEventListener('focus', () => {
3128
searchBox.classList.add('active');
3229
});
33-
3430
});

src/DEFAULT_DISPLAY_BASE.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const DEFAULT_DISPLAY_BASE = 10 ;
1+
export const DEFAULT_DISPLAY_BASE = 10;

src/DEFAULT_REPRESENTATION_BASE.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//import { DEFAULT_DISPLAY_BASE } from './' ;
2-
import { MAX_BASE } from "./_limits.js" ;
1+
// Import { DEFAULT_DISPLAY_BASE } from './' ;
2+
import {MAX_BASE} from './_limits.js';
33

44
/*
55
* Biggest power of DEFAULT_DISPLAY_BASE whose square holds in a single double
66
* with full precision. For working correctly with multiplication algorithms
77
* and for fast base DEFAULT_DISPLAY_BASE printing. On older machines with no
88
* native doubles, it might be worth to only use ints.
99
*/
10-
//export const DEFAULT_REPRESENTATION_BASE = Math.pow(DEFAULT_DISPLAY_BASE,Math.floor(Math.log(Math.sqrt(Math.pow(2,53)))/Math.log(DEFAULT_DISPLAY_BASE))) ;
11-
//export const DEFAULT_REPRESENTATION_BASE = Math.pow(16,Math.floor(Math.log(Math.sqrt(Math.pow(2,53)))/Math.log(16))) ;
12-
//export const DEFAULT_REPRESENTATION_BASE = Math.pow(2,26) | 0;
10+
// export const DEFAULT_REPRESENTATION_BASE = Math.pow(DEFAULT_DISPLAY_BASE,Math.floor(Math.log(Math.sqrt(Math.pow(2,53)))/Math.log(DEFAULT_DISPLAY_BASE))) ;
11+
// export const DEFAULT_REPRESENTATION_BASE = Math.pow(16,Math.floor(Math.log(Math.sqrt(Math.pow(2,53)))/Math.log(16))) ;
12+
// export const DEFAULT_REPRESENTATION_BASE = Math.pow(2,26) | 0;
1313
export const DEFAULT_REPRESENTATION_BASE = MAX_BASE;

0 commit comments

Comments
 (0)