Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.type

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.type
import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { type } = fn;

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 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>