Skip to main content
Module

x/denops_std/function/mod.ts>type

📚 Standard module for denops.vim
Go to Latest
function type
import { type } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

The result is a Number representing the type of {expr}. Instead of using the number directly, it is better to use the v:t_ variable that has the value: Number: 0 v:t_number String: 1 v:t_string Funcref: 2 v:t_func List: 3 v:t_list Dictionary: 4 v:t_dict Float: 5 v:t_float Boolean: 6 v:t_bool (v:false and v:true) None: 7 v:t_none (v:null and v:none) Job: 8 v:t_job Channel: 9 v:t_channel Blob: 10 v:t_blob Class: 12 v:t_class Object: 13 v:t_object Typealias: 14 v:t_typealias For backward compatibility, this method can be used:

:if type(myvar) == type(0)
:if type(myvar) == type("")
:if type(myvar) == type(function("tr"))
:if type(myvar) == type([])
:if type(myvar) == type({})
:if type(myvar) == type(0.0)
:if type(myvar) == type(v:false)
:if type(myvar) == type(v:none)

To check if the v:t_ variables exist use this:

:if exists('v:t_number')

Can also be used as a method:

mylist->type()

Parameters

denops: Denops
expr: unknown

Returns

Promise<number>