Socket
Book a DemoInstallSign in
Socket

neuron-normalize

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neuron-normalize

neuron-normalize

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
2
Created
Source

NPM version npm module downloads per month Build Status Dependency Status

neuron-normalize

Normalize a module id to a url to a standard pathname.

Install

$ npm install neuron-normalize --save

Usage


var options = {
  root: '/mod'
};

var normalize = require('neuron-normalize')(options);

normalize.parse('zepto');
->
{
    package: 'zepto@*',
    package_name: 'zepto',
    id: 'zepto@*/zepto.js',
    version: '*',
    path: '/zepto.js'
}

normalize.to_url('zepto');
->
'/mod/zepto/*/zepto.js'

normalize.to_package('/mod/zepto/*/zepto.js');
->
{
    package: 'zepto@*',
    package_name: 'zepto',
    id: 'zepto@*/zepto.js',
    version: '*',
    path: '/zepto.js'
}

options

  • root String Absolute path from root to the module. Required

Module File Object

type: Object - package: <module_name>@<version>

- package_name: `<module_name>`

- id: `<module_name>@<version><file_path>`

- version: `<major>.<minor>.<patch>`, default to `'*'`

- path: `/path/to/<filename>.<ext>`, default to `/<package-name>.js`

API

normalize.parse(id)

  • id String formatted module id

Returns Object Module File Object

normalize.to_url(id)

  • id String formatted module id
'zepto@1.0.0/lib/zepto.js'

Returns Path Absolute pathname of a file to the id, or undefined if not id passed in.

'/mod/zepto/1.0.0/lib/zepto.js'

normalize.to_package(pathname)

  • pathname Path Absolute pathname of a file
'/mod/zepto/*/zepto.js'

Returns Object Module File Object

License

MIT

Keywords

neuron-normalize

FAQs

Package last updated on 12 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.