npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@modern-dev/jslong

v0.1.0

Published

The jslong - is a pure JavaScript implementation of Long class for representing a 64-bit two's-complement integer value.

Downloads

1

Readme

jslong

Build Status codecov npm NPM

The jslong - is a pure JavaScript implementation of Long class for representing a 64-bit two's-complement integer value.

$ npm install -save @modern-dev/jslong

:clipboard: Usage

import { Long } from '@modern-dev/jslong';

const val = Long.getMinValue().subtract(Long.fromInt(1024)).toString(16);
console.log(val); // '7ffffffffffffc00'

:mortar_board: API Reference

Constructor

/**
 * @param {number} low  The low (signed) 32 bits of the long.
 * @param {number} high  The high (signed) 32 bits of the long.
 */
constructor(low: number, high: number)

Methods

| Method signature | Description | | --- | --- | | toInt(): number | The value, assuming it is a 32-bit integer. | | toNumber(): number | The closest floating-point representation to this value. | | isSafeInteger(): boolean | if can be exactly represented using number (i.e. abs(value) < 2^53). | | toString(radix?: number): string | The textual representation of this value. | | getHighBits(): number | The high 32-bits as a signed value. | | getLowBits(): number | The low 32-bits as a signed value. | | getLowBitsUnsigned(): number | The low 32-bits as an unsigned value. | | getNumBitsAbs(): number | Returns the number of bits needed to represent the absolute value of this Long. | | isZero(): boolean | Whether this value is zero. | | isNegative(): boolean | Whether this value is negative. | | isOdd(): boolean | Whether this value is odd. | | equals(other: Long): boolean | Whether this Long equals the other. | | notEquals(other: Long): boolean | Whether this Long does not equal the other. | | lessThan(other: Long): boolean | Whether this Long is less than the other. | | lessThanOrEqual(other: Long): boolean | Whether this Long is less than or equal to the other. | | greaterThan(other: Long): boolean | Whether this Long is greater than the other. | | greaterThanOrEqual(other: Long): boolean | Whether this Long is greater than or equal to the other. | | compare(other: Long): number | 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. | | negate(): Long | The negation of this value. | | add(other: Long): Long | The sum of this and the given Long. | | subtract(other: Long): Long | The difference of this and the given Long. | | multiply(other: Long): Long | The product of this and the other. | | div(other: Long): Long | This Long divided by the given one. | | modulo(other: Long): Long | This Long modulo the given one. | | not(): Long | The bitwise-NOT of this value. | | and(other: Long): Long | The bitwise-AND of this and the other. | | or(other: Long): Long | The bitwise-OR of this and the other. | | xor(other: Long): Long | The bitwise-XOR of this and the other. | | shiftLeft(numBits: number): Long | This shifted to the left by the given amount. | | shiftRight(numBits: number): Long | This shifted to the right by the given amount. | | shiftRightUnsigned(numBits: number): Long | This shifted to the right by the given amount, with zeros placed into the new leading bits. | | static fromInt(value: number): Long | The corresponding Long value. | | static fromNumber(value: number): Long | The corresponding Long value. | | static fromBits(lowBits: number, highBits: number): Long | The corresponding Long value. | | static fromString(str: string, opt_radix?: number): Long | The corresponding Long value. | | static isStringInRange(str: string, opt_radix: number): boolean | Whether the string is within the range of a Long. |

:green_book: License

Licensed under the Apache License 2.0.

Based on the Long implementation for Google's Closure Library.

Copyright 2009 The Closure Library Authors. All Rights Reserved. Copyright (c) 2020 Bohdan Shtepan


modern-dev.com  ·  GitHub @virtyaluk  ·  Twitter @virtyaluk