Socket
Socket
Sign inDemoInstall

sum-up

Package Overview
Dependencies
9
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

43

index.js

@@ -7,12 +7,11 @@ /*!

var util = require('util');
const Chalk = require('chalk').constructor;
const inspectWithKind = require('inspect-with-kind');
var Chalk = require('chalk').constructor;
module.exports = function sumUp(pkgData, options) {
if (!pkgData || Array.isArray(pkgData) || typeof pkgData !== 'object') {
throw new TypeError(
util.inspect(pkgData) +
' is not a plain object. Expected an object of package information,' +
' for example npm\'s package.json `{name: ... version: ..., description: ..., ...}`.'
`Expected an object of package information \`{name: ... version: ..., description: ..., ...}\`, but got ${
inspectWithKind(pkgData)
}.`
);

@@ -23,6 +22,5 @@ }

if (Array.isArray(options) || typeof options !== 'object') {
throw new TypeError(
util.inspect(options) +
' is not a plain object. The second argument of sum-up must be a plain object or undefined.'
);
throw new TypeError(`The second argument of sum-up must be a plain object or undefined, but got ${
inspectWithKind(options)
}.`);
}

@@ -34,19 +32,20 @@ } else {

if (options.color !== undefined && typeof options.color !== 'boolean') {
throw new TypeError(
util.inspect(options.color) +
' is neither true nor false. `color` option must be a Boolean value.'
);
throw new TypeError(`Expected \`color\` option to be a Boolean value, but got ${
inspectWithKind(options.color)
}.`);
}
var chalk = new Chalk({enabled: options.color});
var lines = [];
const chalkOption = {};
var nameAndVersion = chalk.cyan(pkgData.name || '');
if (pkgData.version) {
if (pkgData.name) {
nameAndVersion += ' ';
}
nameAndVersion += chalk.gray('v' + pkgData.version);
if (options.color !== undefined) {
chalkOption.enabled = options.color;
}
const chalk = new Chalk(chalkOption);
const lines = [];
const nameAndVersion = `${chalk.cyan(pkgData.name || '')}${
pkgData.version ? `${pkgData.name ? ' ' : ''}${chalk.gray('v' + pkgData.version)}` : ''
}`;
if (nameAndVersion) {

@@ -53,0 +52,0 @@ lines.push(nameAndVersion);

{
"name": "sum-up",
"version": "2.0.0",
"version": "3.0.0",
"description": "Summarize package information",

@@ -9,6 +9,5 @@ "repository": "shinnn/sum-up",

"scripts": {
"pretest": "eslint --config @shinnn/node-legacy --rule 'complexity: [error, 15]' index.js test.js",
"test": "node --strong_mode test.js --color && node test.js --no-color",
"coverage": "node --strong_mode node_modules/.bin/istanbul cover test.js -- --color",
"coveralls": "${npm_package_scripts_coverage} && istanbul-coveralls"
"pretest": "eslint --fix --format=codeframe index.js test.js",
"test": "node test.js --color && node test.js --no-color",
"coverage": "node node_modules/.bin/istanbul cover test.js -- --color"
},

@@ -33,10 +32,15 @@ "license": "MIT",

"dependencies": {
"chalk": "^1.0.0"
"chalk": "^2.0.1",
"inspect-with-kind": "^1.0.2"
},
"devDependencies": {
"@shinnn/eslint-config-node-legacy": "^2.0.0",
"eslint": "^2.4.0",
"istanbul": "^0.4.2",
"tape": "^4.5.1"
"@shinnn/eslint-config-node": "^4.0.0",
"ansi-styles": "^3.1.0",
"eslint": "^4.2.0",
"istanbul": "^0.4.5",
"tape": "^4.7.0"
},
"eslintConfig": {
"extends": "@shinnn/node"
}
}

@@ -6,4 +6,2 @@ # sum-up

[![Coverage Status](https://img.shields.io/coveralls/shinnn/sum-up.svg)](https://coveralls.io/r/shinnn/sum-up)
[![Dependency Status](https://david-dm.org/shinnn/sum-up.svg)](https://david-dm.org/shinnn/sum-up)
[![devDependency Status](https://david-dm.org/shinnn/sum-up/dev-status.svg)](https://david-dm.org/shinnn/sum-up#info=devDependencies)

@@ -63,4 +61,4 @@ Summarize package information

Copyright (c) 2014 - 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
Copyright (c) 2014 - 2017 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc