# `NPM.Package.Spec`
[🔗](https://github.com/elixir-volt/npm_ex/blob/v0.7.4/lib/npm/package/spec.ex#L1)

Parse npm package specifiers into structured data.

npm supports multiple specifier formats:

    lodash          # name only (latest)
    lodash@^4.0     # name with range
    @scope/pkg@1.0  # scoped with range
    npm:react@^18   # alias
    file:../local   # file reference
    git+https://... # git reference
    https://...tgz  # URL tarball

# `t`

```elixir
@type t() :: %{
  raw: String.t(),
  name: String.t(),
  range: String.t() | nil,
  type: :registry | :alias | :file | :git | :url
}
```

# `parse`

```elixir
@spec parse(String.t()) :: t()
```

Parse a package specifier string.

# `registry?`

```elixir
@spec registry?(t()) :: boolean()
```

Check if a specifier targets the registry.

# `to_string`

```elixir
@spec to_string(t()) :: String.t()
```

Format a spec back to a string like `name@range`.

---

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