🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

make-barcode

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-barcode

使用Luhm 校验算法生成一段条码

latest
npmnpm
Version
1.0.5
Version published
Weekly downloads
12
100%
Maintainers
1
Weekly downloads
 
Created
Source

make-barcode

NPM version Known Vulnerabilities npm download

介绍

使用Luhm 校验算法生成一段条码

1、从最后一位数字开始,逆向将奇数位(1、3、5等等)相加。

2、从最后一位数字开始,逆向将偶数位数字,先乘以2(如果乘积为两位数,则将其减去9),再求和。

3、将奇数位总和加上偶数位总和,结果应该可以被10整除。

安装教程

  • yarn add make-barcode

使用说明

import { getCodeNumber, checkCode } from 'make-barcode';

// 生成条码
const code = getCodeNumber('18');

// 验证条码
const result = checkCode(code)

FAQs

Package last updated on 11 May 2022

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