Skip to content

hornta/long-ts

Repository files navigation

long-ts

npm

An alternative to long.js with support for ESM, CJS, UMD and Modern Mode. It's written in TypeScript and thus houses it's own type declarations.

long-ts and long.js differences:

  • Removed Long.isLong() in favor of using instanceof.
  • Removed all aliased shorthand methods like eq and shr and more.
  • Using named export import { Long } from 'long-ts' instead of const Long = require('long.js')

Installation

npm install long-ts

Usage

import { Long } from "long-ts";

const longVal = new Long(0xffffffff, 0x7fffffff);

console.log(longVal.toString());

Documentation

https://hornta.github.io/long-ts/modules.html

Building

npm run build will also build the documentation in /docs

npm install
npm run build

Running tests:

npm run test

Running linter:

npm run lint