package
1.20220526.1
Repository: https://github.com/hardfinhq/npm-mod.git
Documentation: pkg.go.dev

# Functions

Fetch downloads a package from `npm`, validates the checksum and then writes it to disk.
FilenameFromURL creates a normalized filename from an `npm` registry URL.
GenerateTidyFile generates a `.npm-mod.tidy.json` by reading files from a `package.json` and `package-lock.json`.
Locate determines the location of the `package.json` file.
PackageJSONReplaceDependencies iterates through all entries in the `package.json` dependencies maps and then replaces each package version based on a "replace" function.
PackageLockExtractDependencies iterates through all entries in the `package-lock.json` packages and dependencies maps and extracts the "resolved" URL.
PackageLockReplaceDependencies iterates through all entries in the `package-lock.json` packages and dependencies maps and then replaces each package version based on a "replace" function.
ReadTidyFile reads a `.npm-mod.tidy.json` file.
ValidateIntegrity checks the hash of a downloaded package.

# Structs

CollectPackages produces a vis]]]itor function that collects informationa about all packages in a `package-lock.json` (in particular, about the `resolved` URLs).
PackageJSONReplace provides a `replace` helper that replaces a `package.json` package version with a local `file:` reference.
PackageLockReplace provides a `replace` helper that replaces a `resolved` URL with a local `file:` reference.
RegistryPackage represents a package in an `npm` package registry.
ReplaceDependency produces a visitor function that **replaces** a package version based on a `replace` function.
ReplaceResolved produces a visitor function that **replaces** a package `resolved` (and `version`) key based on a `replace` function.
TidyFile represents a `.npm-mod.tidy.json`.

# Type aliases

ReplaceFunc replaces a value based on the value.
ReplacePairFunc replaces a value based on the existing key/value pair.
VisitorFunc is a function for visiting a value in an ordered map.