Description
Compare declared peer names with optional-peer metadata.
Package and container references combine names, selectors, conditions and platform metadata. A restricted lexical split can preserve these parts without validating registry identity, available targets, dependency graphs or runtime resolution.
Compare declared peer names with optional-peer metadata.
When to use this tool
Use npm Optional Peer Metadata Flag when checking the stated package, Cargo or container-reference component.
How to use the tool and how it works
- Enter packageName, peerNames, optionalMetadataNames. Keep parallel arrays aligned. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read declaredPeer, markedOptional, optionalPeer. Inspect declaredPeer, markedOptional, optionalPeer before interpreting the associated values.
Compare declared peer names with optional-peer metadata. Require nonempty packageName; return declaredPeer, markedOptional and optionalPeer as their conjunction.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| packageName | Package Name | Required. Text; maximum UTF-16 length 8192. |
| peerNames | Peer Names | Required. Array of text; maximum UTF-16 length 8192; maximum items 256. |
| optionalMetadataNames | Optional Metadata Names | Required. Array of text; maximum UTF-16 length 8192; maximum items 256. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| declaredPeer | Declared Peer | Required. Boolean. |
| markedOptional | Marked Optional | Required. Boolean. |
| optionalPeer | Optional Peer | Required. Boolean. |
{
"input": {
"packageName": "react",
"peerNames": [
"react"
],
"optionalMetadataNames": [
"react"
]
},
"output": {
"declaredPeer": true,
"markedOptional": true,
"optionalPeer": true
}
} Limitations and assumptions
- Metadata alone does not declare a peer dependency or validate package installation behavior.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use the relevant package manager, runtime or registry against the actual project for complete resolution and validation.
References
Similar or alternative tools
- npm Package Name Scope Boundary
Split scope and package under a restricted npm-style name grammar.
- Development: npm Alias Specifier Components
Parse one restricted npm alias specifier.