Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

humanize-list

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humanize-list - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

license

30

index.js

@@ -1,37 +0,37 @@

'use strict';
'use strict'
module.exports = function humanizeList(list, options) {
module.exports = function humanizeList (list, options) {
if (!Array.isArray(list)) {
throw new TypeError('humanize-list expected an array');
throw new TypeError('humanize-list expected an array')
}
options = options || {};
options.conjunction = options.conjunction || 'and';
options = options || {}
options.conjunction = options.conjunction || 'and'
var listLength = list.length;
var listLength = list.length
if (listLength === 1) {
return list[0];
return list[0]
}
if (options.skipConjunction) {
return list.join(', ');
return list.join(', ')
}
var humanizedList = '';
var humanizedList = ''
for (var i = 0; i < listLength; i++) {
if (i === listLength - 1) {
if (options.oxfordComma) {
humanizedList += ',';
humanizedList += ','
}
humanizedList += ' ' + options.conjunction + ' ';
humanizedList += ' ' + options.conjunction + ' '
} else if (i !== 0) {
humanizedList += ', ';
humanizedList += ', '
}
humanizedList += list[i];
humanizedList += list[i]
}
return humanizedList;
};
return humanizedList
}

@@ -5,3 +5,4 @@ {

"author": "John Otander",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"main": "index.js",

@@ -12,9 +13,5 @@ "directories": {

"scripts": {
"test": "mocha test",
"hint": "jshint . --exclude-path=node_modules"
"test": "ava"
},
"repository": {
"type": "git",
"url": "https://github.com/johnotander/humanize-list.git"
},
"repository": "johnotander/humanize-list",
"keywords": [

@@ -29,11 +26,6 @@ "humanize",

],
"license": "MIT",
"bugs": {
"url": "https://github.com/johnotander/humanize-list/issues"
},
"homepage": "https://github.com/johnotander/humanize-list",
"dependencies": {},
"devDependencies": {
"mocha": "*"
"ava": "^0.8.0"
}
}

Sorry, the diff of this file is not supported yet

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