Class: Code

Code

new Code(opts)

Class for generating codes;
Parameters:
Name Type Description
opts object Options
Properties
Name Type Attributes Default Description
locale string <optional>
en Current locale

Methods

customCode(opts)

Generate custom code using ascii uppercase and random integers.
Parameters:
Name Type Description
opts object Options;
Properties
Name Type Attributes Default Description
mask string <optional>
@### Mask of code.
char string <optional>
@ Placeholder for characters.
digit string <optional>
# Placeholder for digits.

ean(opts)

Generate EAN (European Article Number) code. Default is EAN-13, but you also can use EAN-8.
Parameters:
Name Type Description
opts object Options
Properties
Name Type Attributes Default Description
format string <optional>
ean-13 Format of EAN.

imei()

Generate a random IMEI (International Mobile Station Equipment Identity).

isbn(opts)

Generate ISBN for current locale. Default is ISBN 10, but you also can use ISBN-13
Parameters:
Name Type Description
opts object Options
Properties
Name Type Attributes Default Description
format string <optional>
isbn-10 ISBN format.

issn(opts)

Generate a random International Standard Serial Number (ISSN).
Parameters:
Name Type Description
opts object Options
Properties
Name Type Attributes Default Description
mask string <optional>
####-#### Code mask

localeCode()

Get a random locale code (MS-LCID). See Windows Language Code Identifier Reference for more information.

pin(opts)

Generate a random PIN code.
Parameters:
Name Type Description
opts object Options
Properties
Name Type Attributes Default Description
mask string <optional>
#### Mask for PIN code.