npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

uuid-cbr

v0.1.2

Published

Bank of Russia UID generator for Node.js based on UUID v1 with checksum

Readme

UUID-CBR

Генератор УИд для Node.js по требованиям Банка России.

Пакет формирует УИд на основе UUID v1 с контрольным символом и повторяет поведение официального примера Банка России на C.

Установка

npm install uuid-cbr

Быстрый старт

CommonJS:

const { generate } = require("uuid-cbr");

const uid = generate();

ESM:

import { generate } from "uuid-cbr";

const uid = generate();

Пример для ESM с несколькими методами:

import { generate, isValid, toDate } from "uuid-cbr";

const uid = generate();

if (isValid(uid)) {
  console.log(uid);
  console.log(toDate(uid));
}

Основные методы

generate(datetime?)

Формирует УИд в формате 8-4-4-4-12-1, где последний символ является контрольным.

const { generate } = require("uuid-cbr");

const uid = generate(new Date("2021-09-24T09:55:09.332Z"));
// 80c57a90-1d1d-11ec-adda-26dbb65f1526-0

const uidNow = generate();
// генерация для текущего момента

isValid(uuid)

Проверяет формат UUID v1, variant-биты и контрольный символ.

const { isValid } = require("uuid-cbr");

isValid("80c57a90-1d1d-11ec-adda-26dbb65f1526-0"); // true
isValid("not-a-uuid"); // false

toDate(uuid)

Извлекает дату из UUID-части идентификатора.

const { toDate } = require("uuid-cbr");

toDate("80c57a90-1d1d-11ec-adda-26dbb65f1526-0");
// 2021-09-24T09:55:09.332Z

info(uuid)

Возвращает длину, валидность, контрольный символ, clock sequence и дату.

const { info } = require("uuid-cbr");

info("80c57a90-1d1d-11ec-adda-26dbb65f1526-0");
// { len: 38, valid: true, controlNum: '0', gClockSeq: ..., datetime: 2021-09-24T09:55:09.332Z }

getTime(datetime?)

Возвращает ту же метку времени в 100-нс интервалах, которая кодируется в UUID.

const { getTime } = require("uuid-cbr");

getTime(new Date("2021-09-24T09:55:09.332Z"));

Управление генератором

Если нужен управляемый state генератора, используйте uid_init, uid_create и uid_deinit.

const { uid_init, uid_deinit, uid_create } = require("uuid-cbr");

uid_init({
  node: [0x10, 0x20, 0x30, 0x40, 0x50, 0x60],
  clockSeq: 0x1234,
});

const uid = uid_create(new Date("2021-09-24T09:55:09.332Z"));
uid_deinit();
  • node — 6 байт: Buffer, Array или hex-строка. По умолчанию случайные.
  • clockSeq — 13-битный clock sequence. По умолчанию случайный.

Совместимость API

  • uid_create формирует УИд-строку, аналог generate.
  • uuid_create возвращает поля UUID: time_low, time_mid, time_hi_and_version, clock_seq_hi_and_reserved, clock_seq_low, node.

uuid_init и uuid_deinit это алиасы uid_init и uid_deinit.