Skip to main content
Module

x/fun/record.ts>deleteAtWithValue

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function deleteAtWithValue
import { deleteAtWithValue } from "https://deno.land/x/fun@v2.0.0/record.ts";

Remove the key from the ReadonlyRecord, returning a pair containing the new record and an Option containing the removed key value. If the record did not hold the specified key then this is a non-op and the return will be the original record and none.

Examples

Example 1

import * as R from "./record.ts";
import { pipe } from "./fn.ts";

const result1 = pipe(
  { one: 1, two: 2 },
  R.deleteAtWithValue('one'),
); // [{ two: 2 }, Some(1)]
const result2 = pipe(
  { one: 1, two: 2 },
  R.deleteAtWithValue('three'),
); // [{ one: 1, two: 2}, None]

Parameters

key: string