@arcmantle/library
    Preparing search index...

    Function customAlphabet

    • Generate secure unique ID with custom alphabet.

      Alphabet must contain 256 symbols or less. Otherwise, the generator will not be secure.

      Type Parameters

      • Type extends string

      Parameters

      • alphabet: string

        Alphabet used to generate the ID.

      • OptionaldefaultSize: number

        Size of the ID. The default size is 21.

      Returns (size?: number) => Type

      A random string generator.

      const { customAlphabet } = require('nanoid')
      const nanoid = customAlphabet('0123456789абвгдеё', 5)
      nanoid() //=> "8ё56а"

      Type The ID type to replace string with some opaque type.