Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dcodeIO/long.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.2.4
Choose a base ref
...
head repository: dcodeIO/long.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.3.0
Choose a head ref
  • 9 commits
  • 17 files changed
  • 1 contributor

Commits on Feb 8, 2025

  1. Update badges

    dcodeIO committed Feb 8, 2025
    Copy the full SHA
    0922471 View commit details

Commits on Feb 9, 2025

  1. fix: Use explicit file extension in relative ECMAScript import

    dcodeIO committed Feb 9, 2025
    Copy the full SHA
    8483533 View commit details

Commits on Feb 10, 2025

  1. Update Wasm source

    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    d0f7475 View commit details
  2. Copy the full SHA
    1760d02 View commit details
  3. Publish on dispatch only

    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    5112b9d View commit details
  4. Move types to dedicated declaration file

    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    ae48501 View commit details
  5. Clean

    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    e1d7970 View commit details
  6. Comment Wasm blob

    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    167d391 View commit details
  7. Add isSafeInteger to test if a Long can be safely represented as a JS…

    … number
    dcodeIO committed Feb 10, 2025
    Copy the full SHA
    2eb79a4 View commit details
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Publish
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
publish:
56 changes: 34 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ long.js
A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library)
for stand-alone use and extended with unsigned support.

[![Build Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Test/main?label=test&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3ATest) [![Publish Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Publish/main?label=publish&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3APublish) [![npm](https://img.shields.io/npm/v/long.svg?label=npm&color=007acc&logo=npm)](https://www.npmjs.com/package/long)
[![Build Status](https://img.shields.io/github/actions/workflow/status/dcodeIO/long.js/test.yml?branch=main&label=test&logo=github)](https://github.com/dcodeIO/long.js/actions/workflows/test.yml) [![Publish Status](https://img.shields.io/github/actions/workflow/status/dcodeIO/long.js/publish.yml?branch=main&label=publish&logo=github)](https://github.com/dcodeIO/long.js/actions/workflows/publish.yml) [![npm](https://img.shields.io/npm/v/long.svg?label=npm&color=007acc&logo=npm)](https://www.npmjs.com/package/long)

Background
----------
@@ -103,7 +103,10 @@ API

### Utility

* Long.**isLong**(obj: `*`): `boolean`<br />
* type **LongLike**: `Long | number | bigint | string`<br />
Any value or object that either is or can be converted to a Long.

* Long.**isLong**(obj: `any`): `boolean`<br />
Tests if the specified object is a Long.

* Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`<br />
@@ -124,28 +127,31 @@ API
* Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`<br />
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.

* Long.**fromBigInt**(value: `bigint`, unsigned?: `boolean`): `Long`<br />
Returns a Long representing the given big integer.

* Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)<br />
Long.**fromString**(str: `string`, radix: `number`)<br />
Returns a Long representation of the given string, written using the specified radix.

* Long.**fromValue**(val: `*`, unsigned?: `boolean`): `Long`<br />
* Long.**fromValue**(val: `LongLike`, unsigned?: `boolean`): `Long`<br />
Converts the specified value to a Long using the appropriate from* function for its type.

### Methods

* Long#**add**(addend: `Long | number | string`): `Long`<br />
* Long#**add**(addend: `LongLike`): `Long`<br />
Returns the sum of this and the specified Long.

* Long#**and**(other: `Long | number | string`): `Long`<br />
* Long#**and**(other: `LongLike`): `Long`<br />
Returns the bitwise AND of this Long and the specified.

* Long#**compare**/**comp**(other: `Long | number | string`): `number`<br />
* Long#**compare**/**comp**(other: `LongLike`): `number`<br />
Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater.

* Long#**divide**/**div**(divisor: `Long | number | string`): `Long`<br />
* Long#**divide**/**div**(divisor: `LongLike`): `Long`<br />
Returns this Long divided by the specified.

* Long#**equals**/**eq**(other: `Long | number | string`): `boolean`<br />
* Long#**equals**/**eq**(other: `LongLike`): `boolean`<br />
Tests if this Long's value equals the specified's.

* Long#**getHighBits**(): `number`<br />
@@ -163,10 +169,10 @@ API
* Long#**getNumBitsAbs**(): `number`<br />
Gets the number of bits needed to represent the absolute value of this Long.

* Long#**greaterThan**/**gt**(other: `Long | number | string`): `boolean`<br />
* Long#**greaterThan**/**gt**(other: `LongLike`): `boolean`<br />
Tests if this Long's value is greater than the specified's.

* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `Long | number | string`): `boolean`<br />
* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `LongLike`): `boolean`<br />
Tests if this Long's value is greater than or equal the specified's.

* Long#**isEven**(): `boolean`<br />
@@ -181,19 +187,22 @@ API
* Long#**isPositive**(): `boolean`<br />
Tests if this Long's value is positive or zero.

* Long#**isSafeInteger**(): `boolean`<br />
Tests if this Long can be safely represented as a JavaScript number.

* Long#**isZero**/**eqz**(): `boolean`<br />
Tests if this Long's value equals zero.

* Long#**lessThan**/**lt**(other: `Long | number | string`): `boolean`<br />
* Long#**lessThan**/**lt**(other: `LongLike`): `boolean`<br />
Tests if this Long's value is less than the specified's.

* Long#**lessThanOrEqual**/**lte**/**le**(other: `Long | number | string`): `boolean`<br />
* Long#**lessThanOrEqual**/**lte**/**le**(other: `LongLike`): `boolean`<br />
Tests if this Long's value is less than or equal the specified's.

* Long#**modulo**/**mod**/**rem**(divisor: `Long | number | string`): `Long`<br />
* Long#**modulo**/**mod**/**rem**(divisor: `LongLike`): `Long`<br />
Returns this Long modulo the specified.

* Long#**multiply**/**mul**(multiplier: `Long | number | string`): `Long`<br />
* Long#**multiply**/**mul**(multiplier: `LongLike`): `Long`<br />
Returns the product of this and the specified Long.

* Long#**negate**/**neg**(): `Long`<br />
@@ -208,28 +217,28 @@ API
* Long#**countTrailingZeros**/**ctz**(): `number`<br />
Returns count trailing zeros of this Long.

* Long#**notEquals**/**neq**/**ne**(other: `Long | number | string`): `boolean`<br />
* Long#**notEquals**/**neq**/**ne**(other: `LongLike`): `boolean`<br />
Tests if this Long's value differs from the specified's.

* Long#**or**(other: `Long | number | string`): `Long`<br />
* Long#**or**(other: `LongLike`): `Long`<br />
Returns the bitwise OR of this Long and the specified.

* Long#**shiftLeft**/**shl**(numBits: `Long | number | string`): `Long`<br />
* Long#**shiftLeft**/**shl**(numBits: `Long | number`): `Long`<br />
Returns this Long with bits shifted to the left by the given amount.

* Long#**shiftRight**/**shr**(numBits: `Long | number | string`): `Long`<br />
* Long#**shiftRight**/**shr**(numBits: `Long | number`): `Long`<br />
Returns this Long with bits arithmetically shifted to the right by the given amount.

* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number | string`): `Long`<br />
* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number`): `Long`<br />
Returns this Long with bits logically shifted to the right by the given amount.

* Long#**rotateLeft**/**rotl**(numBits: `Long | number | string`): `Long`<br />
* Long#**rotateLeft**/**rotl**(numBits: `Long | number`): `Long`<br />
Returns this Long with bits rotated to the left by the given amount.

* Long#**rotateRight**/**rotr**(numBits: `Long | number | string`): `Long`<br />
* Long#**rotateRight**/**rotr**(numBits: `Long | number`): `Long`<br />
Returns this Long with bits rotated to the right by the given amount.

* Long#**subtract**/**sub**(subtrahend: `Long | number | string`): `Long`<br />
* Long#**subtract**/**sub**(subtrahend: `LongLike`): `Long`<br />
Returns the difference of this and the specified Long.

* Long#**toBytes**(le?: `boolean`): `number[]`<br />
@@ -247,6 +256,9 @@ API
* Long#**toNumber**(): `number`<br />
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).

* Long#**toBigInt**(): `bigint`<br />
Converts the Long to its big integer representation.

* Long#**toSigned**(): `Long`<br />
Converts this Long to signed.

4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import Long from './umd/index';
export default Long; // compatible with `import Long from "long"`
import { Long } from './types.js';
export default Long;
Loading