Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/mod.ts>extend

๐Ÿ“š Standard module for denops.vim
Go to Latest
function extend
import { extend } from "https://deno.land/x/denops_std@v3.11.1/function/mod.ts";

{expr1} and {expr2} must be both |Lists| or both |Dictionaries|. If they are |Lists|: Append {expr2} to {expr1}. If {expr3} is given insert the items of {expr2} before the item with index {expr3} in {expr1}. When {expr3} is zero insert before the first item. When {expr3} is equal to len({expr1}) then {expr2} is appended. Examples: :echo sort(extend(mylist, [7, 5])) :call extend(mylist, [2, 3], 1) When {expr1} is the same List as {expr2} then the number of items copied is equal to the original length of the List. E.g., when {expr3} is 1 you get N new copies of the first item (where N is the original length of the List). Use |add()| to concatenate one item to a list. To concatenate two lists into a new list use the + operator: :let newlist = [1, 2, 3] + [4, 5] If they are |Dictionaries|: Add all entries from {expr2} to {expr1}. If a key exists in both {expr1} and {expr2} then {expr3} is used to decide what to do: {expr3} = "keep": keep the value of {expr1} {expr3} = "force": use the value of {expr2} {expr3} = "error": give an error message When {expr3} is omitted then "force" is assumed. {expr1} is changed when {expr2} is not empty. If necessary make a copy of {expr1} first. {expr2} remains unchanged. When {expr1} is locked and {expr2} is not empty the operation fails. Returns {expr1}. Can also be used as a |method|: mylist->extend(otherlist)

Parameters

denops: Denops
expr1: unknown
expr2: unknown
optional
expr3: unknown

Returns

Promise<unknown>