New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gtin-manager

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtin-manager

GTIN Manager

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

║█║▌║█║▌│║▌║▌█║

🏷️ GTIN Manager

Generates Global Trade Item Numbers (formerly known as EANs) for a given Global Company Prefix.

license last-commit version version

║▌║█║║▌▌│║▌║║▌▌║

Setup

npm install gtin-manager
// or
yarn add gtin-manager
║▌║█║║▌▌║▌║█║▌║

Usage

Create a generator instance using a GCP (Global Company Prefix) provided by GS1.

import Manager from 'gtin-manager'

const manager = new Manager('12345678')

manager.contingent

Returns the amount of possible GTINs that can be created from the current GCP.

manager.contingent === 10000 // true

manager.index(number)

Returns GTIN / EAN for an index (which has to be inside the bounds of manager.contingent)

manager.index(0) === '1234567800004'    // true
manager.index(9999) === '1234567899992' // true
manager.index(10000)                    // Error: Index out of bounds
manager.index(-1)                       // Error: Index out of bounds

manager.all

Returns an array of all possible GTINs / EANs for the GCP.

manager.all === ['1234567800011', '1234567800028', ... 9998 more items] // true
▌║║█║║▌█║▌║║▌║▌

🌻 Thanks to xbpf/gtin for providing functions used in this repository.

Keywords

FAQs

Package last updated on 06 Nov 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc