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

x/ddc_vim/deps.ts>fn.deepcopy

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.deepcopy
import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { deepcopy } = fn;

Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a List a full copy is created. This means that the original List can be changed without changing the copy, and vice versa. When an item is a List or Dictionary, a copy for it is made, recursively. Thus changing an item in the copy does not change the contents of the original List. A Dictionary is copied in a similar way as a List.

When {noref} is omitted or zero a contained List or Dictionary is only copied once. All references point to this single copy. With {noref} set to 1 every occurrence of a List or Dictionary results in a new copy. This also means that a cyclic reference causes deepcopy() to fail.

Nesting is possible up to 100 levels. When there is an item that refers back to a higher level making a deep copy with {noref} set to 1 will fail. Also see copy().

Can also be used as a method:

GetObject()->deepcopy()

Parameters

denops: Denops
expr: unknown
optional
noref: unknown

Returns

Promise<unknown>