This package has been deprecated

Author message:

This package has been deprecated

@saekitominaga/document-generate-id
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Generate a unique ID in Document

npm version

Generate a unique ID in Document.

Demo

Examples

import DocumentGenerateId from '@saekitominaga/document-generate-id';

const documentGenerateId1 = new DocumentGenerateId();
documentGenerateId1.generate(); // e.g. GUaHJ6ao5m

const documentGenerateId2 = new DocumentGenerateId(8, {
  alphalower: true,
  alphaupper: false,
  number: true,
  symbol: '-_:.',
}, 'js-', 3);
documentGenerateId2.generate(); // e.g. js-7f3h1w:l

Constructor

new DocumentGenerateId(
	length = 10,
	charactorType = {
		alphalower: true,
		alphaupper: true,
		number: true,
		symbol: '',
	},
	prefix = '',
	trialLimit = 10
)

Parameters

length [Optional]
Length of ID (Excluding the prefix part)
charactorType [Optional]
Type of characters used for ID
alphalower [Optional]
[a-z]
alphaupper [Optional]
[A-Z]
number [Optional]
[0-9]
symbol [Optional]
Enumerate symbol characters (e.g. '-_:.')
prefix [Optional]
Prefix of ID
trialLimit [Optional]
Maximum number of attempts if the generated ID exists in the document

Methods

generate(): string
Generate a unique ID in document

Readme

Keywords

none

Package Sidebar

Install

npm i @saekitominaga/document-generate-id

Weekly Downloads

0

Version

1.2.1

License

MIT

Unpacked Size

30 kB

Total Files

9

Last publish

Collaborators

  • saekitominaga