# name-generator

> Generator names in sequence using defaults or a custom name generator function.

Latest version **0.1.1** (published 2014-05-26) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install name-generator
pnpm add name-generator
yarn add name-generator
bun add name-generator
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-05-26 |
| First published | 2014-05-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | Brian Woodward |
| Maintainers | doowb, jonschlinkert |
| Keywords | docs, documentation, generate, generator, markdown, templates, verb |

## Links

- npm: https://www.npmjs.com/package/name-generator
- Repository: https://github.com/doowb/name-generator
- Issues: https://github.com/doowb/name-generator/issues
- npm.io page: https://npm.io/package/name-generator

## Dependencies (2)

- [digits](https://npm.io/package/digits.md) ^0.1.4
- [lodash](https://npm.io/package/lodash.md) ^2.4.1

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-05-26
- 0.1.0 — 2014-05-26

## README

# name-generator [![NPM version](https://badge.fury.io/js/name-generator.png)](http://badge.fury.io/js/name-generator)

> Generator names in sequence using defaults or a custom name generator function.

## Install
Install with [npm](npmjs.org):

```bash
npm i name-generator --save
``` 

## Usage
> Create a new generator and use the defaults:

```js
// require in the NameGenerator
var NameGenerator = require('name-generator');

// create a new instance of a generator
var namer = new NameGenerator();

// start using the generator to create
// default names in sequence, e.g. 001, 002, 003, 004
var name = namer.next();
```

> Create a generator with named groups

```js
// require in the NameGenerator
var NameGenerator = require('name-generator');

// create some named groups in the options
var options = {
  'default': {
    digits: 2, // use 2 digits instead of 3
  },
  'pages': {
    digits: 5, // use 5 digits instead of 3
    prefix: 'page-' // make the generator add a prefix e.g. 'page-00001'
  }
}
// create a new instance of a generator
var namer = new NameGenerator(options);

// start using the generator to create
// default names in sequence, e.g. 01, 02, 03, 04
var name = namer.next();

// specify the named group to use the group options
// page names in sequence, e.g. page-00001, page-00002, page-00003
var pageName = namer.next('pages');
```

> Create a name generator using a custom generator function.

```js
// require in the NameGenerator
var NameGenerator = require('name-generator');

// create custom generator that takes a context
function generator (context) {
  // just use a name value on the context if specified
  context = context || {};
  return context.name;
}

// create a new instance of a generator
var namer = new NameGenerator(generator);

// start using the generator to create
// default names in sequence, e.g. 01, 02, 03, 04
var name = namer.next();

// specify the context with a name to return the actual name
// e.g. {name: 'foo'} => 'foo'
var name = namer.next({name: 'foo'});
```



## Author

**Brian Woodward**

+ [github/doowb](https://github.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)


## License
Copyright (c) 2014 Brian Woodward, contributors.  
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 26, 2014._

---
_Source: https://npm.io/package/name-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
