Skip to main content
Module

x/durationjs/mod.ts>matchUnit

Get the formated time duration
Go to Latest
function matchUnit
import { matchUnit } from "https://deno.land/x/durationjs@v4.1.0/mod.ts";

Match a unit in a string. Like "1kg", "3L", etc.

Parameters

str: string

String to match from

t: string

Unit to look for. Doesn't support aliases.

Returns

number

value Value of the unit matched