uralsjs-id-html-tools
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

uralsjs-id-html-tools

Tools for rendering and parsing ids of html elements

API

/**
 * Abstract type of class, which will render and parse id some type by some rules
 */
export type IdTool<Id> = {
    renderId: (id: Id) => string,
    parseId: (htmlId: string) => Id
}

/**
 * Tool which biective render numeric id by stringifying it and prepends prefix
 */
export class NumPrefixIdTool implements IdTool<number> {...}

/**
 * Tool which biective render stringc id by prepends prefix
 */
export class StringPrefixIdTool implements IdTool<string> {...}

/**
 * Tool which biective render default value instead of null-id
 */
export class NullDefaultIdTool implements IdTool<null> {...}

Readme

Keywords

none

Package Sidebar

Install

npm i uralsjs-id-html-tools

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

9.17 kB

Total Files

10

Last publish

Collaborators

  • pantagruel74