Module

x/lodash_es/src/cond.js>default

lodash for deno use
Latest
function default
import { default } from "https://dotland.deno.dev/x/lodash_es@v0.0.2/src/cond.js";

Creates a function that iterates over pairs and invokes the corresponding function of the first predicate to return truthy. The predicate-function pairs are invoked with the this binding and arguments of the created function.

Examples

var func = .cond([ [.matches({ 'a': 1 }), .constant('matches A')], [.conforms({ 'b': _.isNumber }), .constant('matches B')], [.stubTrue, _.constant('no match')] ]);

func({ 'a': 1, 'b': 2 }); // => 'matches A'

func({ 'a': 0, 'b': 1 }); // => 'matches B'

func({ 'a': '1', 'b': '2' }); // => 'no match'

Parameters

pairs

The predicate-function pairs.