Socket
Socket
Sign inDemoInstall

@flatfile/id

Package Overview
Dependencies
1
Maintainers
16
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @flatfile/id

`{region}_{model}_{id}`


Version published
Weekly downloads
720
decreased by-6.74%
Maintainers
16
Created
Weekly downloads
 

Readme

Source

Flatfile's Public ID Generator

This package provides a re-useable @flatfile/id generator that should be used in all places where a public id is provided. This ensures that we can evolve our ID standard over time with consistency.

process.env.REGION will be prepended to the ID if it's available.

Structure

[{region}_]{model}_{id}

Usage

// default usage
makeId('acc') // => acc_G23hs0hd90Ij6D4f

// with a region
process.env.REGION = 'us0'
makeId('acc') // => us0_acc_ijsS89072Es0hd90

// modifying the environment variable describing default length
process.env.DEFAULT_ID_LENGTH = '32'
makeId('acc') // => acc_yBcGHc61lGdWjgnEtZqSvWDpQdqaN9tu

// passing a custom id length
makeId('acc', 8) // => acc_4hkFm3CJ

// passing a length under 8
makeId('acc', 5) // => throw Error("The length passed to makeId() must be >= 8")

FAQs

Last updated on 12 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc