Skip to main content
Module

x/dpp_vim/deps.ts>fn.index

Dark powered plugin manager for Vim/neovim
Latest
function fn.index
import { fn } from "https://deno.land/x/dpp_vim@v0.2.0/deps.ts";
const { index } = fn;

Find {expr} in {object} and return its index. See indexof() for using a lambda to select the item.

If {object} is a List return the lowest index where the item has a value equal to {expr}. There is no automatic conversion, so the String "4" is different from the Number 4. And the number 4 is different from the Float 4.0. The value of 'ignorecase' is not used here, case matters as indicated by the {ic} argument.

If {object} is Blob return the lowest index where the byte value is equal to {expr}.

If {start} is given then start looking at the item with index {start} (may be negative for an item relative to the end).

When {ic} is given and it is TRUE, ignore case. Otherwise case must match.

-1 is returned when {expr} is not found in {object}. Example:

:let idx = index(words, "the")
:if index(numbers, 123) >= 0

Can also be used as a method:

GetObject()->index(what)

Parameters

denops: Denops
object: unknown
expr: unknown
optional
start: unknown
optional
ic: unknown

Returns

Promise<number>