JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 221
  • Score
    100M100P100Q82983F
  • License MIT

A randomly generated EAN-13 code For Amazon

Package Exports

  • ean-generator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ean-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ean-generator

A randomly generated EAN-13 code For Amazon

中文| English

Install

npm install --save ean-generator

Usage

import Ean from 'ean-generator';
let ean = new Ean(['030', '031', '039'])
const code = ean.create()
// 039544164511
const arr = ean.createMultiple({size: 3})
// ['0397442001659','0304437586565','0317191566247']

For commonJS

const Ean = require('ean-generator');

API

constructor(countryCodeArr)

countryCodeArr Type: string[]

random First three country codes for gen ean

Retrieve the first three country codes of EAN bar code

create(prop)

gen ean-13 code

const code = ean.create({countryCode: '123', vendorEan: '456789'})

// 1234567892870

prop?

Type: object

countryCode? Type: string | number Default: null, len is 3

set First three country codes of EAN bar code

vendorEan? Type: string | number Default: null, len is 6

Set gen ean number 4th to 10th, It represents the manufacturer code

createMultiple(prop)

gen multiple ean-13 code, return array

code

const arr = ean.createMultiple({size: 3, countryCode: '123', vendorEan: '456789'})

prop?

size? Type: number Default: 1

isValid(code)

Check ean code whether it is legal

Type:: string

code

const valid = ean.isValid('1234567890123')
// false

const valid = ean.isValid('1234567892870')
// true

License

MIT License

Copyright (c) 2020 王珏