New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autoincr

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoincr

Use auto-incrementing values safely and effectively. Overflows are checked when you use a bounded number type (such as `number`) and there is optional support for the new unbounded `bigint` type.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

autoincr

Use auto-incrementing values safely and effectively. Overflows are checked when you use a bounded number type (such as number) and there is optional support for the new unbounded bigint type.

Usage

import * as assert from "assert";
import autoincr from "autoincr";

const id = autoincr();

assert.eq(id.next(), 1);
assert.eq(id.next(), 2);
assert.eq(id.next(), 3);

id.reset();
assert.eq(id.next(), 1);

BigInt Support

The same API expressed in the example above can optionally return a bigint rather than a number by calling the .bigint method.

const id = autoincr.bigint();

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs

Package last updated on 17 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc