New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

normalize-pkg

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-pkg

Normalize values in package.json.

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
increased by1.19%
Maintainers
1
Weekly downloads
 
Created
Source

normalize-pkg NPM version Build Status

Normalize values in package.json.

Install

Install with npm:

$ npm install normalize-pkg --save

Install with bower

$ bower install normalize-pkg --save

Usage

var schema = require('./')();
var pkg = schema.normalize(require('./package'));

Normalizing fields

Fields are normalized using a schema (powered by map-schema).

Defaults

Defaults are based on npm recommendations. When a required or recommended field is missing, normalize-pkg attempts to create the field if valid data can be found in the repository.

Example

The following:

var schema = require('./')();

// no package.json is passed, just an empty object
var pkg = schema.normalize({});
console.log(pkg);

Results in:

{ name: 'normalize-pkg',
  version: '0.1.0',
  homepage: 'https://github.com/jonschlinkert/normalize-pkg',
  repository: 'jonschlinkert/normalize-pkg',
  license: 'MIT',
  files: [ 'index.js' ],
  main: 'index.js',
  engines: { node: '>= 0.10.0' },
  keywords: [ 'normalize', 'pkg' ] }

The fields were created by parsing .git config or using defaults defined on the schema.

Customize

Pass a fields object on the options to customize any fields on the schema (also define extend: true if you want the field to extend a field that is already defined):

var pkg = schema.normalize(require('./package'), {
  extend: true,
  fields: {
    name: {
      normalize: function() {
        return 'bar'
      }
    }
  }
});

console.log(pkg.name);
//=> 'bar'

update: Easily keep anything in your project up-to-date by installing the updaters you want to use… more | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on March 19, 2016.

Keywords

FAQs

Package last updated on 19 Mar 2016

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