steal
Version:
Gets JavaScript.
29 lines (16 loc) • 1.22 kB
Markdown
hooks.normalize normalize
StealJS.hooks
A loader hook that converts a [moduleIdentifier] into a [moduleName] to serve as the canonical key for a module.
`normalize(name, parentName, parentAddress)`
{String} name The [moduleIdentifier] provided in the `import`, `require()` or similar call depending on the module syntax used.
{Promise|String} The [moduleName] or a Promise that will resolve with the moduleName.
For example:
```
import foo from './foo';
```
In this example the string `'./foo'` is the **name** argument provided to normalize.
{String} [parentName] The [moduleName] of the parent module; the module that is doing the importing.
{String} [parentAddress] The address (as determined in [steal.hooks.locate]) of the parent module.
{Promise|String} The string [moduleName] as determined by applying the normalize algorithm, or a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will resolve with the moduleName.
The **normalize** hook is used to convert a [moduleIdentifier] from a given context and, using the normalization algorithm, to a canonical [moduleName].
steal.