Skip to content

Latest commit

 

History

History
41 lines (24 loc) · 998 Bytes

Function.resolve.md

File metadata and controls

41 lines (24 loc) · 998 Bytes

@109cafe/label / resolve

Function: resolve()

resolve<F, T>(from, to): F & T

Resolve a label from another label

Type Parameters

F extends Label

T extends Partial<Label>

Parameters

from: F

the label to resolve from

to: T

the label to resolve to

Returns

F & T

Example

import { resolve } from "@109cafe/label";
resolve({ package: "foo" }, { package: "bar" }); // { package: "foo/bar" }
resolve({ package: "foo" }, { scope: "", package: "bar" }); // { package: "//bar" }
resolve({ package: "foo" }, { package: "bar", target: "baz" }); // { package: "foo/bar", target: "baz" }
resolve({ package: "foo", target: "bar" }, { includeSubPackages: true }); // { package: "foo", includeSubPackages: true, target: "bar" }

Throws

CannotResolveFromSubPackages if the from label includes subpackages