{"name":"normalize-pkg","description":"Normalize values in package.json using the map-schema library.","version":"0.4.1","homepage":"https://github.com/jonschlinkert/normalize-pkg","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"contributors":[{"name":"Brian Woodward","email":"brian.woodward@gmail.com","url":"https://twitter.com/doowb"},{"name":"Jon Schlinkert","email":"jon.schlinkert@sellside.com","url":"http://twitter.com/jonschlinkert"},{"name":"Peter deHaan","url":"http://about.me/peterdehaan"}],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/normalize-pkg.git"},"bugs":{"url":"https://github.com/jonschlinkert/normalize-pkg/issues"},"license":"MIT","files":["bin","index.js","lib"],"main":"index.js","bin":{"normalize-pkg":"bin/cli.js"},"engines":{"node":">= 0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"arr-union":"^3.1.0","array-unique":"^0.3.2","component-emitter":"^1.2.1","export-files":"^2.1.1","extend-shallow":"^2.0.1","fs-exists-sync":"^0.1.0","get-value":"^2.0.6","kind-of":"^3.1.0","lazy-cache":"^2.0.2","map-schema":"^0.2.4","matched":"^0.4.4","minimist":"^1.2.0","mixin-deep":"^1.2.0","object.pick":"^1.2.0","omit-empty":"^0.4.1","parse-git-config":"^1.1.1","repo-utils":"^0.4.1","semver":"^5.3.0","stringify-author":"^0.1.3","write-json":"^0.2.2"},"devDependencies":{"delete":"^0.3.2","gitty":"^3.6.0","gulp":"^3.9.1","gulp-eslint":"^3.0.1","gulp-format-md":"^0.1.11","gulp-istanbul":"^1.1.1","gulp-mocha":"^3.0.0","gulp-unused":"^0.2.1","mocha":"^3.2.0"},"keywords":["config","fix","json","normalize","package","package-json","pkg","properties","values"],"verb":{"run":true,"toc":"collapsible","layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["update"]},"reflinks":["map-schema","project-name","verb","verb-readme-generator"],"lint":{"reflinks":true}},"gitHead":"7536524317ef8df0bd827ac91947bf0c93f0a69d","_id":"normalize-pkg@0.4.1","_shasum":"c9684e2e4f8cabf129eceac1511f3084544d30ee","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"c9684e2e4f8cabf129eceac1511f3084544d30ee","tarball":"http://registry-npm.ywwl.com/normalize-pkg/download/normalize-pkg-0.4.1.tgz","integrity":"sha512-Oz/lWw1JKFknUYL8PLizlX3rucIuOhSFYFKkeAVNKtVCro0XHUpC4EOdLFXZZtax9rkyBwOfbKO9vtWgybxzHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICksDDL2e7xb5EIux9Fc0PY1xVQv+4AAumUBoJbAKXxtAiBLHVIHcQ6WOHo5JtE/A4CHSZLzrXGhK3R1FBbkYtYrEw=="}],"size":9925,"noattachment":false,"key":"/normalize-pkg/-/normalize-pkg-0.4.1.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/normalize-pkg-0.4.1.tgz_1489665279346_0.20776587212458253"},"directories":{},"readme":"# normalize-pkg [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/normalize-pkg.svg?style=flat)](https://www.npmjs.com/package/normalize-pkg) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-pkg.svg?style=flat)](https://npmjs.org/package/normalize-pkg) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-pkg.svg?style=flat)](https://npmjs.org/package/normalize-pkg) [![Build Status](https://travis-ci.org/jonschlinkert/normalize-pkg.svg?branch=master)](https://travis-ci.org/jonschlinkert/normalize-pkg)\n\n> Normalize values in package.json using the map-schema library.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Table of Contents\n\n<details>\n<summary><strong>Details</strong></summary>\n\n- [Install](#install)\n- [Install](#install-1)\n- [Usage](#usage)\n- [Features](#features)\n- [Schema](#schema)\n- [Defaults](#defaults)\n- [API](#api)\n- [Options](#options)\n  * [options.knownOnly](#optionsknownonly)\n  * [options.pick](#optionspick)\n  * [options.omit](#optionsomit)\n  * [options.fields](#optionsfields)\n  * [options.extend](#optionsextend)\n- [About](#about)\n\n</details>\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/) (requires [Node.js](https://nodejs.org/en/) >= 0.10.0):\n\n```sh\n$ npm install --save normalize-pkg\n```\n\n## Install\n\nInstall with [bower](https://bower.io/)\n\n```sh\n$ bower install normalize-pkg --save\n```\n\n## Usage\n\n```js\nvar config = require('./')();\nvar pkg = config.normalize(require('./package'));\n```\n\n## Features\n\nNormalizes most package.json fields, and:\n\n* converts `repository` objects to a string\n* stringifies `author` object\n* stringifies each \"person\" object in `maintainers`, `contributors` and `collaborators`\n* converts `licenses` arrays and objects to a `license` string\n* removes files that don't exist from `bin`, `main` and the `files` array\n* adds `cli.js` to `bin` if it exists\n* creates `keywords` array from `name` if not defined\n\nSee the [schema](lib/schema.js), [normalizers](lib/normalizers), and [unit tests](test) for more examples.\n\n## Schema\n\nValues are normalized using a [schema](lib/schema.js) that is passed to [map-schema](https://github.com/jonschlinkert/map-schema).\n\n* only properties that have a corresponding field on the schema will be normalized.\n* any properties that do not have a corresponding field are returned unmodified.\n\nSee the [.field docs](#field) to learn how to add or overwrite a field on the schema.\n\n## Defaults\n\nA `default` value may optionally be defined when a `.field` is registered. When `.normalize` is run and a property that is required or recommended by npm is missing, `normalize-pkg` attempts to create the field if valid data can be found in the repository.\n\nbuilt-in fields have a default value:\n\n* `version`: `'0.1.0'`\n* `license`: `'MIT'`\n* `engines`: `{node: '>= 0.10.0'}`\n\nFor example:\n\n* `name`: the [project-name](https://github.com/jonschlinkert/project-name) library is used to fill in the name\n* `bin`: if empty, populated with `cli.js` or `bin` if either exists on the file system\n\n**Example**\n\nThe following:\n\n```js\nvar config = require('./')();\n\n// no package.json is passed, just an empty object\nvar pkg = config.normalize({});\nconsole.log(pkg);\n```\n\n**Results**\n\nSince an empty object was passed, `normalize-pkg` was smart enough to fill in missing fields looking for info in the project. In this case, specifically from parsing `.git` config and using any defaults defined on the schema.\n\n```js\n{ name: 'normalize-pkg',\n  version: '0.1.0',\n  homepage: 'https://github.com/jonschlinkert/normalize-pkg',\n  repository: 'jonschlinkert/normalize-pkg',\n  license: 'MIT',\n  files: [ 'index.js' ],\n  main: 'index.js',\n  engines: { node: '>= 0.10.0' } }\n```\n\n## API\n\n**Params**\n\n* `options` **{Object}**\n\n**Example**\n\n```js\nconst config = new NormalizePkg();\nconst pkg = config.normalize({\n  author: {\n    name: 'Jon Schlinkert',\n    url: 'https://github.com/jonschlinkert'\n  }\n});\nconsole.log(pkg);\n//=> {author: 'Jon Schlinkert (https://github.com/jonschlinkert)'}\n```\n\n* `normalize` **{Function}**: function to be called on the value when the `.normalize` method is called\n* `default` **{any}**: default value to be used when the package.json property is undefined.\n* `required` **{Boolean}**: define `true` if the property is required\n\n**Params**\n\n* `name` **{String}**: Field name (required)\n* `type` **{String|Array}**: One or more native javascript types allowed for the property value (required)\n* `options` **{Object}**\n* `returns` **{Object}**: Returns the instance\n\n**Example**\n\n```js\nconst config = new NormalizePkg();\n\nconfig.field('foo', 'string', {\n  default: 'bar'\n});\n\nconst pkg = config.normalize({});\nconsole.log(pkg);\n//=> {foo:  'bar'}\n```\n\n**Params**\n\n* `pkg` **{Object}**: The `package.json` object to normalize\n* `options` **{Object}**\n* `returns` **{Object}**: Returns a normalized package.json object.\n\n**Example**\n\n```js\nconst config = new NormalizePkg();\nconst pkg = config.normalize(require('./package.json'));\n```\n\n## Options\n\n### options.knownOnly\n\n**Type**: `boolean`\n\n**Default**: `undefined`\n\nOmit properties from package.json that do not have a field registered on the schema.\n\n```js\nvar Config = require('normalize-pkg');\nvar config = new Config({knownOnly: true});\n\nvar pkg = config.normalize({name: 'my-project', foo: 'bar'});\nconsole.log(pkg);\n//=> {name: 'my-project'}\n```\n\n### options.pick\n\n**Type**: `array`\n\n**Default**: `undefined`\n\nFilter the resulting object to contain only the specified keys.\n\n### options.omit\n\n**Type**: `array`\n\n**Default**: `undefined`\n\nRemove the specified keys from the resulting object.\n\n### options.fields\n\nPass a `fields` object on the options to customize any fields on the schema (also see [options.extend](#options-extend)):\n\n```js\nvar pkg = config.normalize(require('./package'), {\n  extend: true,\n  fields: {\n    name: {\n      normalize: function() {\n        return 'bar'\n      }\n    }\n  }\n});\n\nconsole.log(pkg.name);\n//=> 'bar'\n```\n\n### options.extend\n\n**Type**: `boolean`\n\n**Default**: `undefined`\n\nUsed with [options.field](#options-field), pass `true` if you want to extend a field that is already defined on the schema.\n\n```js\nvar pkg = config.normalize(require('./package'), {\n  extend: true,\n  fields: {\n    name: {\n      normalize: function() {\n        return 'bar'\n      }\n    }\n  }\n});\n\nconsole.log(pkg.name);\n//=> 'bar'\n```\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n[update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update \"Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 154 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 16  | [doowb](https://github.com/doowb) |  \n| 2   | [pdehaan](https://github.com/pdehaan) |  \n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2020, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 01, 2020._","publish_time":1489665280123,"_cnpm_publish_time":1489665280123,"dist-tags":{"latest":"0.5.0"}}