Socket
Socket
Sign inDemoInstall

numgen

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    numgen

Creates objects that generate number sequences


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
459 kB
Created
Weekly downloads
 

Changelog

Source

0.1.0 / 2015-01-17

  • migration to Component 1.0

Readme

Source

numgen

NPM version Build Status

Creates objects that generate number sequences.

Disclaimer: this package does not have anything common with ECMAScript 6 generators nor with yield operator.

Installation

Node

npm install numgen

Component

component install gamtiq/numgen

Jam

jam install numgen

Bower

bower install numgen

SPM

spm install numgen

AMD, <script>

Use dist/numgen.js or dist/numgen.min.js (minified version).

Usage

Node, Component, SPM

var NumGen = require("numgen");

Jam

require(["numgen"], function(NumGen) {
    ...
});

AMD

define(["path/to/dist/numgen.js"], function(NumGen) {
    ...
});

Bower, <script>

<!-- Use bower_components/numgen/dist/numgen.js if the library was installed by Bower -->
<script type="text/javascript" src="path/to/dist/numgen.js"></script>
<script type="text/javascript">
    // numgen is available via NumGen field of window object
    ...
</script>

Example

var seq = new NumGen({
                        startValue: 3,
                        factor: 4,
                        valueChange: function(data) {
                            return data.index > 1 ? data.current : data.value;
                        }
                    });
console.log("Geometric progression:");
for (var nI = 1; nI < 11; nI++) {
    console.log("#", nI, " - ", seq.getNext());
}

See test/numgen.js for additional examples.

API

See doc folder.

License

MIT

Keywords

FAQs

Last updated on 16 Jan 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc