tiny-license
Create a tiny JavaScript license comment from package data
Last updated 6 years ago by shinnn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tiny-license 
SYNC missed versions from official npm registry.

tiny-license.js

Build Status Build status Coverage Status Dependency Status devDependency Status

Create a tiny JavaScript license comment from package data

var json = {
  name: 'isogram',
  author: 'Shinnosuke Watanabe',
  homepage: 'https://github.com/shinnn/isogram'
};

tinyLicense(json);
//=>
/*!
 * isogram | (c) Shinnosuke Watanabe
 * https://github.com/shinnn/isogram
*/

Installation

npm NPM version

npm install tiny-license

Bower Bower version

bower install tiny-license

Duo

var tinyLicense = require('shinnn/tiny-license.js');

API

tinyLicense(packageData [, option])

packageData: Object
option: Object
Return: String

It takes data of a package definition file, like package.json and bower.json, and returns a string of JavaScript block comment which represents the license of the package.

It uses the follwing properties of data:

  • name
  • author or authors
  • license or licenses
  • homepage

All of them are optional.

var json = {
  name: 'foo',
  authors: [
    'John Smith <bar@email> (baz.com)',
    {
      name: 'Mary Sue',
      email: 'qux@email'
    }
  ],
  license: 'CC0-1.0',
  homepage: 'http://nodejs.org/'
};

tinyLicense(json);
//=>
/*!
 * foo | CC0-1.0 (c) John Smith, Mary Sue
 * http://nodejs.org/
*/

option.lastNewline

Type: Boolean
Default: true

Setting this option false removes the last newline from the result.

var json = {name: 'foo'};

tinyLicense(json);                       //=> '/*!\n * foo\n*/\n'
tinyLicense(json, {lastNewline: false}); //=> '/*!\n * foo\n*/'

License

Copyright (c) 2014 Shinnosuke Watanabe

Licensed under the MIT License.

Current Tags

  • 1.1.0                                ...           latest (6 years ago)

3 Versions

  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |