Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc