UNPKG

@azure-tools/linq

Version:

LINQ-like functionality for Typescript.

18 lines 647 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.when = exports.ToDictionary = exports.Dictionary = void 0; class Dictionary { } exports.Dictionary = Dictionary; function ToDictionary(keys, each) { const result = new Dictionary(); keys.map((v, i, a) => result[v] = each(v)); return result; } exports.ToDictionary = ToDictionary; /** performs a truthy check on the value, and calls onTrue when the condition is true,and onFalse when it's not */ function when(value, onTrue, onFalse = () => { }) { return value ? onTrue(value) : onFalse(); } exports.when = when; //# sourceMappingURL=common.js.map