diff --git a/autoload/maktaba/value.vim b/autoload/maktaba/value.vim index 0f0035f..e72a7ec 100644 --- a/autoload/maktaba/value.vim +++ b/autoload/maktaba/value.vim @@ -73,7 +73,7 @@ endfunction "" " Whether {value} is in {list}. " @throws BadValue if {list} is not a list. -function! maktaba#value#IsIn(Value, list) +function! maktaba#value#IsIn(Value, list) abort return index(maktaba#ensure#IsList(a:list), a:Value) >= 0 endfunction @@ -101,23 +101,38 @@ endfunction "" " Returns the type of {value} as a string. -" One of "number", "string", "funcref", "list", "dictionary", or "float". +" One of "number", "string", "funcref", "list", "dictionary", "float", +" "boolean", "null", "none", "job", or "channel". " See also |type()|. function! maktaba#value#TypeName(Value) abort let l:type = type(a:Value) if l:type == 0 - return "number" + return 'number' elseif l:type == 1 - return "string" + return 'string' elseif l:type == 2 - return "funcref" + return 'funcref' elseif l:type == 3 - return "list" + return 'list' elseif l:type == 4 - return "dictionary" + return 'dictionary' elseif l:type == 5 - return "float" + return 'float' + elseif l:type == 6 + return 'boolean' + elseif l:type == 7 + " None (v:null or v:none) in Vim. + " Null (v:null) in Neovim. + if exists('v:none') && a:Value is v:none + return 'none' + endif + return 'null' + elseif l:type == 8 + return 'job' + elseif l:type == 9 + return 'channel' endif + return printf('unknown type (%d)', l:type) endfunction