# `NPM.Lockfile.PackageLock`
[🔗](https://github.com/elixir-volt/npm_ex/blob/v0.7.4/lib/npm/lockfile/package_lock.ex#L1)

Reads and analyzes npm's package-lock.json format.

Supports lockfileVersion 1, 2, and 3 for compatibility
with projects migrating from npm.

# `metadata`

```elixir
@spec metadata(map()) :: map()
```

Returns metadata about the lockfile.

# `package_count`

```elixir
@spec package_count(map()) :: non_neg_integer()
```

Counts the total number of packages in the lockfile.

# `packages`

```elixir
@spec packages(map()) :: %{required(String.t()) =&gt; String.t()}
```

Extracts package names and versions.

# `read`

```elixir
@spec read(String.t()) :: {:ok, map()} | {:error, term()}
```

Reads a package-lock.json file.

# `requires_npm7?`

```elixir
@spec requires_npm7?(map()) :: boolean()
```

Checks if the lockfile requires npm 7+ (v2/v3 format).

# `version`

```elixir
@spec version(map()) :: 1 | 2 | 3 | nil
```

Detects the lockfile version.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
