Hyperlinkv0.8.0-beta.28

HashMap

HashMap.toValuesconsteffect/HashMap.ts:594
<K, V>(self: HashMap<K, V>): Array<V>

Returns an Array of the values within the HashMap.

Example (Converting values to an array)

import { HashMap } from "effect"

const employees = HashMap.make(
  ["alice", { department: "engineering", salary: 90000 }],
  ["bob", { department: "marketing", salary: 75000 }],
  ["charlie", { department: "engineering", salary: 95000 }]
)

// Extract all employee records
const allEmployees = HashMap.toValues(employees)
console.log(allEmployees.length) // 3

// Calculate total salary
const totalSalary = allEmployees.reduce((sum, emp) => sum + emp.salary, 0)
console.log(totalSalary) // 260000

// Filter by department
const engineers = allEmployees.filter((emp) => emp.department === "engineering")
console.log(engineers.length) // 2
getters
Source effect/HashMap.ts:5941 lines
export const toValues = <K, V>(self: HashMap<K, V>): Array<V> => Array.from(values(self))
Referenced by 1 symbols