Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/dxx/src/lib/axe/$deps.ts>$levels.default

🚀 (Deno) enhanced executor
Latest
function $levels.default
import { $levels } from "https://deno.land/x/dxx@rf/src/lib/axe/$deps.ts";
const { default } = $levels;

Receive either the level name or number and return the combination.

Examples

input

import getLevelInfo, { rfcLogLevels } from 'rfc-log-levels'
getLevelInfo('note')
getLevelInfo('note', rfcLogLevels)
getLevelInfo('note', { note: 5 })

result

{
	"levelNumber": 5,
	"levelName": "notice"
}

Parameters

level: string | number

Either a log name or a log number that is contained within the levels mapping

optional
levels: LevelsMap

A mapping of permitted log names to their log numbers to determine the correct log level name and number combination

Returns

LevelInfo | null

The found combination, which if provided an alias, expands it. If an invalid level was provided, null is returned.