Skip to main content
Module

x/core/util.ts

Some auxiliary functions and classes of deno.
Latest
import * as core from "https://deno.land/x/core@0.1.9/util.ts";

Functions

Initials upper case

Format the number of bytes to be easily recognizable by humans

Format date with pattern string

Format template string with placeholder

Determine whether it is a plain object (the object created by {} or new Object)

Merge two arrays by the specify function.

Deep merge multiple objects

Generate a random number between [a,b]

Generate a random string with specified length

Strip html tags

  1. Identify complete tag matches, e.g. "b" tag will not match "br", "body".
  2. Identify empty tags, e.g. "<>" will not be striped.
  3. Identify the start and end tag cannot be spaces, e.g. "a < b and c > d" will not be striped.

Truncate a Chinese-English mixed string of specified length A Chinese character is calculated by two characters