var.byKey

KeyRange byKey() @safe

Get a forward range over the keys of this object.

This method returns a KeyRange that can be used with std.algorithm functions and other range-based operations without allocating arrays.

Returns

A KeyRange over the object keys, or an empty range if this is not an object.

Examples

import std.algorithm : filter, map;
import std.array : array;
var obj;
obj["name"] = "Alice";
obj["age"] = 30;
auto upperKeys = obj.byKey.map!(k => k.toUpper).array;