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

enumerate-words

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enumerate-words - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

10

enumerate.d.ts

@@ -1,2 +0,2 @@

export interface Args {
export interface EnumerateOptions {
words: string[];

@@ -8,8 +8,2 @@ cutoff?: number;

}
export declare const enumerate: ({
words,
cutoff = 4,
placeholder = 'Things',
andStr = 'and',
noOxford = false
}: Args) => string;
export declare function enumerate({words, cutoff, placeholder, andStr, noOxford}: EnumerateOptions): string;

4

enumerate.es6.js

@@ -1,2 +0,2 @@

export const enumerate = ({ words, cutoff = 4, placeholder = 'Things', andStr = 'and', noOxford = false }) => {
export function enumerate({ words, cutoff = 4, placeholder = 'Things', andStr = 'and', noOxford = false }) {
if (words.length === 0)

@@ -10,2 +10,2 @@ return '';

return `${words.slice(0, words.length - 1).join(', ')}${words.length === 2 || noOxford ? '' : ','} ${andStr} ${[...words].pop()}`;
};
}
"use strict";
exports.enumerate = function (_a) {
function enumerate(_a) {
var words = _a.words, _b = _a.cutoff, cutoff = _b === void 0 ? 4 : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Things' : _c, _d = _a.andStr, andStr = _d === void 0 ? 'and' : _d, _e = _a.noOxford, noOxford = _e === void 0 ? false : _e;

@@ -12,2 +12,3 @@ if (words.length === 0)

return "" + words.slice(0, words.length - 1).join(', ') + (words.length === 2 || noOxford ? '' : ',') + " " + andStr + " " + words.slice().pop();
};
}
exports.enumerate = enumerate;

@@ -1,4 +0,2 @@

// [Q] why does tsc complain with the following error if I don't export this interface?
// error: enumerate.ts(10,14): error TS4025: Exported variable 'enumerate' has or is using private name 'Args'.
export interface Args {
export interface EnumerateOptions {
words: string[]

@@ -11,3 +9,3 @@ cutoff?: number

export const enumerate = ({
export function enumerate({
words,

@@ -18,3 +16,3 @@ cutoff = 4,

noOxford = false
}: Args): string => {
}: EnumerateOptions): string {
if (words.length === 0) return ''

@@ -21,0 +19,0 @@ else if (words.length === 1) return words[0]

{
"name": "enumerate-words",
"version": "2.0.2",
"version": "2.0.3",
"description": "human-friendly enumeration of words",

@@ -9,5 +9,5 @@ "main": "./enumerate.js",

"scripts": {
"build": "./node_modules/typescript/bin/tsc -d -t es6 -m es2015 enumerate.ts && mv enumerate.js enumerate.es6.js && tsc -t es5 -m commonjs ./enumerate.ts;",
"test": "./node_modules/mocha/bin/mocha",
"watch": "./node_modules/typescript/bin/tsc -w -t es5 -m commonjs ./enumerate.ts;"
"build": "tsc -d -t es6 -m es2015 enumerate.ts && mv enumerate.js enumerate.es6.js && tsc -t es5 -m commonjs enumerate.ts;",
"test": "mocha",
"watch": "tsc -w -t es5 -m commonjs enumerate.ts;"
},

@@ -14,0 +14,0 @@ "repository": {

@@ -11,6 +11,6 @@ ## enumerate-words

words: string[],
cutoff?: number,
placeholder?: string,
andStr?: string,
noOxford?: boolean
cutoff?: number, // defaults to 4
placeholder?: string, // defaults to 'Things'
andStr?: string, // defaults to 'and'
noOxford?: boolean // defaults to false
}) => string

@@ -17,0 +17,0 @@ ```

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