diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-04-21 17:29:10 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-04-21 17:42:17 +0200 |
commit | 5c8dfb0e379cd4ae8de418e7aa554dbc5ab7f236 (patch) | |
tree | c39982ecde44ac2b01111149f81bee8b5a284f40 /runtime/lua/vim/shared.lua | |
parent | d9d890562e43493c999f8a6ff2b848959686f5b6 (diff) | |
download | rneovim-5c8dfb0e379cd4ae8de418e7aa554dbc5ab7f236.tar.gz rneovim-5c8dfb0e379cd4ae8de418e7aa554dbc5ab7f236.tar.bz2 rneovim-5c8dfb0e379cd4ae8de418e7aa554dbc5ab7f236.zip |
refactor(lua): rename tbl_isarray => isarray
tbl_isarray was not released yet, so it will not go through
a deprecation cycle.
ref #24572
Diffstat (limited to 'runtime/lua/vim/shared.lua')
-rw-r--r-- | runtime/lua/vim/shared.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 6d9e4ad809..85720b6ea3 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -356,7 +356,7 @@ end --- We only merge empty tables or tables that are not an array (indexed by integers) local function can_merge(v) - return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.tbl_isarray(v)) + return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.isarray(v)) end local function tbl_extend(behavior, deep_extend, ...) @@ -502,7 +502,7 @@ end --- ---@param o table Table to index ---@param ... any Optional keys (0 or more, variadic) via which to index the table ----@return any : Nested value indexed by key (if it exists), else nil +---@return any # Nested value indexed by key (if it exists), else nil function vim.tbl_get(o, ...) local keys = { ... } if #keys == 0 then @@ -599,6 +599,12 @@ function vim.spairs(t) t end +--- @deprecated +function vim.tbl_isarray() + vim.deprecate('vim.tbl_isarray', 'vim.isarray', '0.10-dev') + error('vim.tbl_isarray was renamed to vim.isarray') +end + --- Tests if `t` is an "array": a table indexed _only_ by integers (potentially non-contiguous). --- --- If the indexes start from 1 and are contiguous then the array is also a list. |vim.islist()| @@ -608,9 +614,9 @@ end --- ---@see https://github.com/openresty/luajit2#tableisarray --- ----@param t table +---@param t? table ---@return boolean `true` if array-like table, else `false`. -function vim.tbl_isarray(t) +function vim.isarray(t) if type(t) ~= 'table' then return false end @@ -652,7 +658,7 @@ end --- Empty table `{}` is a list, unless it was created by |vim.empty_dict()| or returned as --- a dict-like |API| or Vimscript result, for example from |rpcrequest()| or |vim.fn|. --- ----@see |vim.tbl_isarray()| +---@see |vim.isarray()| --- ---@param t? table ---@return boolean `true` if list-like table, else `false`. |