Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

format_dash_key

  • format_dash_key(text: string): string
  • Returns the text with delimiters (_, ., [A-Z], spaces) replaced with dashes -, also deduplicates consecutive delimiters

    import {format_dash_key} from "svelte-commons/lib/util/shared";
    
    const text = "This is a KeyYep";
    const key = format_dash_key(text);
    
    console.log(key); // logs: `this-is-a-key-yep`

    Parameters

    • text: string

    Returns string

format_tokens

  • format_tokens(pattern: string, ...tokens: any[]): string
  • Returns the pattern with the token delimiter %s replaced, with the spread arguments tokens

    import {format_tokens} from "svelte-commons/lib/util/shared";
    
    const pattern = "My name is %s! How are you, %s?";
    const formatted = format_tokens(pattern, "Jeff", "Karen");
    
    console.log(formatted); // logs: `My name is Jeff! How are you, Karen?`

    Parameters

    • pattern: string
    • Rest ...tokens: any[]

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc