Skip to content

gpoitch/strincrement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strincrement

String incrementing id generator. Given an alphabet, generates unique sequential ids.

Use cases:

  • Non-numeric auto-incrementing ids
  • Spreadsheet column naming
  • CSS classname minification

Usage

import Strincrement from 'strincrement'

const generateId = Strincrement()
console.log(generateId()) // 'a'
console.log(generateId()) // 'b'
console.log(generateId()) // 'c'
// ...
console.log(generateId()) // 'aa'
console.log(generateId()) // 'ab'

Supply your own alphabet

const generateId = Strincrement('XYZ')
console.log(generateId()) // 'X'
console.log(generateId()) // 'Y'
console.log(generateId()) // 'Z'
console.log(generateId()) // 'XX'
console.log(generateId()) // 'XY'

About

String increment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published