Skip to main content

package_directory

Function package_directory 

Source
pub fn package_directory(manifest_path: &[u8]) -> &[u8] ⓘ
Expand description

What: The package directory of a workspace manifest path. .strip_suffix(...) returns the bytes before the suffix, or nothing when the path does not end with it. Why: Source files are looked up under <directory>/src/.

In TS you’d write (pseudocode):

const directory = manifestPath.slice(0, -'/package.json'.length);