Skip to content

Commit

Permalink
Migrate JSBI source to TypeScript (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
12wrigja authored Aug 23, 2021
1 parent 5f2e984 commit 877f076
Show file tree
Hide file tree
Showing 24 changed files with 276 additions and 168 deletions.
17 changes: 16 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@ module.exports = {
'es6': true,
'node': true
},
'plugins': [
'@typescript-eslint'
],
'extends': [
'eslint:recommended',
'google'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 2018,
'sourceType': 'module'
},
'globals': {
'BigInt': true
},
'ignorePatterns': [
'node_modules/',
'/dist/',
'/tsc-out/',
],
'rules': {
'linebreak-style': [
'error',
Expand Down Expand Up @@ -73,6 +82,12 @@ module.exports = {
// This matches the spec.
'capIsNew': false
}
]
],
'no-dupe-class-members': [
// The eslint base linter reports errors for TS overrides. Turn this off
// in favour of the TS-specific one.
'off'
],
'@typescript-eslint/no-dupe-class-members': ['error']
}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
tsc-out

# Installed npm modules
node_modules
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/add.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0x1ef48fc4e1ec0dcb'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/and.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '0x688'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/div.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '0x2bcf23'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/mod.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '0x123'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/mul.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0x3c85a27d9c1c42bc'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/neg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ const dataSmall = [{
r: '0x1165'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/not.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ const dataSmall = [{
r: '-0xdff0f83c65ca6'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/or.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0x49040086'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/parse.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

const kDataHex = [
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/sar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0x1'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/shl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0x77922f8cde'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/sub.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '0x7bffcbe01'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/xor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const dataSmall = [{
r: '-0xc680b9f1a3ceede'
}];

import JSBI from '../jsbi.mjs';
import JSBI from '../jsbi';
const JSBigInt = JSBI.BigInt;

let errorCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion jsbi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class JSBI {
static bitwiseAnd(x: JSBI, y: JSBI): JSBI;
static bitwiseXor(x: JSBI, y: JSBI): JSBI;
static bitwiseOr(x: JSBI, y: JSBI): JSBI;

static asIntN(n: number, x: JSBI): JSBI;
static asUintN(n: number, x: JSBI): JSBI;

Expand Down
Loading

0 comments on commit 877f076

Please sign in to comment.