expand-value
Version:
Get deeply nested values from an object, like dot-prop and get-value, but with support for advanced features like bracket-notation and more.
55 lines (54 loc) • 1.14 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// src/nodes/Location.ts
var Position = class {
static {
__name(this, "Position");
}
index;
line;
col;
constructor(loc) {
this.index = loc.index;
this.line = loc.line;
this.col = loc.col;
}
};
var Location = class {
static {
__name(this, "Location");
}
start;
end;
constructor(start, end) {
this.start = start;
this.end = end;
}
slice(input) {
return input.slice(...this.range);
}
get range() {
return [this.start.index, this.end.index];
}
get lines() {
return [this.start.line, this.end.line];
}
};
var location = /* @__PURE__ */ __name((loc) => {
const start = new Position(loc);
return (node) => {
node.loc = new Location(start, new Position(loc));
return node;
};
}, "location");
location.Position = Position;
location.Location = Location;
location.location = location;
var Location_default = Location;
export {
Location,
Position,
Location_default as default,
location
};
//# sourceMappingURL=Location.mjs.map