Go to Latest
function includesValue
import { includesValue } from "https://dotland.deno.dev/std@0.130.0/collections/mod.ts";

If the given value is part of the given object it returns true, otherwise it returns false. Doesn't work with non-primitive values: includesValue({x: {}}, {}) returns false.

Example:

import { includesValue } from "https://deno.land/std@0.130.0/collections/mod.ts";
import { assertEquals } from "https://deno.land/std@0.130.0/testing/asserts.ts";

const input = {
  first: 33,
  second: 34,
};

assertEquals(includesValue(input, 34), true);

Parameters

record: Readonly<Record<string, T>>
value: T

Returns

boolean