Skip to content

Commit

Permalink
Merge pull request #7 from urbit/m/native-bigint
Browse files Browse the repository at this point in the history
bigint: use native bigint instead of big-integer
  • Loading branch information
Fang- committed Apr 16, 2024
2 parents 15b1446 + 38d4455 commit ec62e73
Show file tree
Hide file tree
Showing 15 changed files with 276 additions and 337 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI
on: [push]
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
name: Build and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -22,9 +22,6 @@ jobs:
- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint

- name: Test
run: yarn test --ci --coverage --maxWorkers=2

Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ This NPM package is intended to ease the flow of developing FE applications for

```typescript
// @da manipulation
function parseDa(da: string): BigInteger;
function formatDa(da: BigInteger): string;
function parseDa(da: string): bigint;
function formatDa(da: bigint): string;
// Given a bigint representing an urbit date, returns a unix timestamp.
function daToUnix(da: BigInteger): number;
function daToUnix(da: bigint): number;
// Given a unix timestamp, returns a bigint representing an urbit date
function unixToDa(unix: number): BigInteger;
function unixToDa(unix: number): bigint;

// @p manipulation
// Convert a number to a @p-encoded string.
function patp(arg: string | number | BigInteger): string;
function patp(arg: string | number | bigint): string;
function hex2patp(hex: string): string;
function patp2hex(name: string): string;
function patp2bn(name: string): BigInteger;
function patp2bn(name: string): bigint;
function patp2dec(name: string): string;
// Determine the ship class of a @p value.
function clan(who: string): string;
Expand All @@ -35,27 +35,27 @@ function cite(ship: string): string | null;

// @q manipulation
// Convert a number to a @q-encoded string.
function patq(arg: string | number | BigInteger): string;
function patq(arg: string | number | bigint): string;
function hex2patq(arg: string): string;
function patq2hex(name: string): string;
function patq2bn(name: string): BigInteger;
function patq2bn(name: string): bigint;
function patq2dec(name: string): string;
// Validate a @q string.
function isValidPatq(str: string): boolean;
// Equality comparison on @q values.
function eqPatq(p: string, q: string): boolean;

// @ud manipulation
function parseUd(ud: string): BigInteger;
function formatUd(ud: BigInteger): string;
function parseUd(ud: string): bigint;
function formatUd(ud: bigint): string;

// @uv manipulation
function parseUv(x: string): BigInteger;
function formatUv(x: BigInteger | string): string;
function parseUv(x: string): bigint;
function formatUv(x: bigint | string): string;

// @uw manipulation
function parseUw(x: string): BigInteger;
function formatUw(x: BigInteger | string): string;
function parseUw(x: string): bigint;
function formatUw(x: bigint | string): string;

// @ux manipulation
function parseUx(ux: string): string;
Expand Down
18 changes: 0 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"version": "1.0.0",
"version": "2.0.0",
"license": "MIT",
"name": "@urbit/aura",
"author": "Liam Fitzgerald",
"module": "dist/aura.esm.js",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand All @@ -21,14 +20,10 @@
"start": "dts watch",
"build": "dts build",
"test": "dts test",
"lint": "dts lint",
"prepare": "dts build",
"size": "size-limit",
"analyze": "size-limit --why"
},
"peerDependencies": {
"big-integer": "^1.6.51"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^8.2.4",
"@tsconfig/recommended": "^1.0.2",
Expand All @@ -46,13 +41,6 @@
"pre-commit": "dts lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"endOfLine": "auto"
},
"size-limit": [
{
"path": "dist/aura.cjs.production.min.js",
Expand Down
Loading

0 comments on commit ec62e73

Please sign in to comment.