@ckirby/mr-lister
Advanced tools
Comparing version 2.7.1 to 2.8.0
@@ -8,2 +8,5 @@ "use strict"; | ||
function listString(list, options = {}) { | ||
if (list.length <= 1) { | ||
return list.join(''); | ||
} | ||
let andor; | ||
@@ -17,7 +20,10 @@ if (isString(options)) { | ||
else { | ||
andor = options.andor || options.conjunction || 'and'; | ||
andor = options.conjunction ?? 'and'; | ||
} | ||
const andOrProvided = Boolean(andor); | ||
// ensure whitespace around andor | ||
if (andor) | ||
andor = andor.replace(/^(?=\S)|(?<=\S)$/g, ' '); | ||
const { article } = options; | ||
const comma = options.comma || options.separator || ', '; | ||
const comma = options.comma ?? ', '; | ||
const minRangeDelta = options.minRangeDelta || 1; | ||
@@ -27,7 +33,7 @@ // is the list an array of numbers or string-versions of numbers? | ||
let isAlpha = false; | ||
let arr = null; | ||
let ranges; | ||
if (isNumeric) { | ||
let numberList = Array.from(list).map((a) => parseInt(a, 10)); | ||
// is numeric range | ||
arr = utils_1.consolidateRanges(numberList, '–', list, minRangeDelta); | ||
ranges = utils_1.consolidateRanges(numberList, '–', list, minRangeDelta); | ||
} | ||
@@ -37,34 +43,31 @@ else { // test if alphabetic range | ||
if (isAlpha) { | ||
arr = utils_1.consolidateAlphaRanges(list); | ||
ranges = utils_1.consolidateAlphaRanges(list); | ||
} | ||
} | ||
let delimiter; | ||
if (list.length > 2) { | ||
if (arr !== null) { | ||
if (arr.length > 2) { | ||
delimiter = comma; | ||
let delimiter = comma; | ||
if (ranges) { | ||
list = ranges; | ||
} | ||
else { | ||
if (list.length > 1) { | ||
const complex = list.find((x) => /,/.test(`${x}`)); | ||
if (complex) { | ||
delimiter = comma.replace(/,/, ';'); | ||
} | ||
} | ||
else { | ||
const complex = list.find((x) => /,/.test(x)); | ||
delimiter = complex ? comma.replace(/,/, ';') : comma; | ||
delimiter = andOrProvided ? andor : ''; | ||
delimiter = delimiter.replace(/^(?![,.;:\s])/, ' ').replace(/[^,.;:\s]$/, '$& '); | ||
} | ||
// add articles | ||
if (article) { | ||
list = list.map((item) => `${article} ${item}`); | ||
} | ||
} | ||
if (!delimiter) { | ||
delimiter = andOrProvided ? andor : ''; | ||
delimiter = delimiter.replace(/^(?![,.;:\s])/, ' ').replace(/[^,.;:\s]$/, '$& '); | ||
if (andOrProvided && (list.length > 2)) { | ||
list.push(`${andor.replace(/^\s+/, '')}${list.pop()}`); | ||
} | ||
if (!arr) { | ||
arr = list.slice(); | ||
} | ||
// add articles | ||
if (article) { | ||
arr = arr.map((item) => `${article} ${item}`); | ||
} | ||
if (andOrProvided && (arr.length > 2)) { | ||
arr.push(`${andor} ${arr.pop()}`); | ||
} | ||
return arr.join(delimiter); | ||
return list.join(list.length === 2 ? andor || delimiter : delimiter); | ||
} | ||
exports.default = listString; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1zdHJpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGlzdC1zdHJpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxtQ0FJaUI7QUFjakIsU0FBUyxRQUFRLENBQUMsS0FBYztJQUM5QixPQUFPLFFBQVEsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEtBQUssaUJBQWlCLENBQUE7QUFDbkQsQ0FBQztBQUVELFNBQXdCLFVBQVUsQ0FBQyxJQUFVLEVBQUUsVUFBc0MsRUFBRTtJQUNyRixJQUFJLEtBQWEsQ0FBQztJQUVsQixJQUFJLFFBQVEsQ0FBQyxPQUFPLENBQUMsRUFBRTtRQUNyQix1Q0FBdUM7UUFDdkMsS0FBSyxHQUFHLE9BQU8sQ0FBQztRQUNoQixJQUFJLENBQUUsQUFBRCxFQUFFLEVBQUUsT0FBTyxFQUFFLEtBQUssQ0FBRSxHQUFHLFNBQVMsQ0FBQztRQUN0QyxPQUFPLEdBQUcsRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLENBQUM7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gaWYgKGFydGljbGUpIHtcbiAgICAgIGxpc3QgPSBsaXN0Lm1hcCgoaXRlbSkgPT4gYCR7YXJ0aWNsZX0gJHtpdGVtfWApO1xuICAgIH1cbiAgfVxuICBpZiAoYW5kT3JQcm92aWRlZCAmJiAobGlzdC5sZW5ndGggPiAyKSkge1xuICAgIGxpc3QucHVzaChgJHthbmRvci5yZXBsYWNlKC9eXFxzKy8sICcnKX0ke2xpc3QucG9wKCl9YCk7XG4gIH1cbiAgcmV0dXJuIGxpc3Quam9pbihsaXN0Lmxlbmd0aCA9PT0gMiA/IGFuZG9yIHx8IGRlbGltaXRlciA6IGRlbGltaXRlcik7XG59XG4iXX0= |
@@ -35,6 +35,6 @@ "use strict"; | ||
if (start.val === end.val) { | ||
out.push(start.val); | ||
out.push(`${start.val}`); | ||
} | ||
else if (getVal(end.val) - getVal(start.val) < minRangeDelta) { | ||
out.push(...arr.slice(start.index, end.index + 1)); | ||
out.push(...arr.slice(start.index, end.index + 1).map(x => `${x}`)); | ||
} | ||
@@ -73,2 +73,2 @@ else { | ||
exports.expandAlphaRange = expandAlphaRange; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsU0FBZ0IsUUFBUSxDQUFDLENBQVU7SUFDakMsT0FBTyxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBVyxDQUFDLENBQUMsSUFBSSxRQUFRLENBQUMsQ0FBVyxDQUFDLENBQUM7QUFDbEUsQ0FBQztBQUZELDRCQUVDO0FBRUQsU0FBZ0IsS0FBSyxDQUFDLENBQVU7SUFDOUIsSUFBSSxDQUFDLEdBQUcsQ0FBVyxDQUFDO0lBQ3BCLE9BQU8sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQ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29kZUF0KDApIDogTmFOXG4gICk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBleHBhbmRBbHBoYVJhbmdlKGZyb21DaGFyOiBzdHJpbmcsIHRvQ2hhcjogc3RyaW5nKTogc3RyaW5nW10ge1xuICBsZXQgZnJvbUNvZGUgPSBmcm9tQ2hhci5jaGFyQ29kZUF0KDApO1xuICBsZXQgdG9Db2RlID0gdG9DaGFyLmNoYXJDb2RlQXQoMCk7XG4gIGlmIChmcm9tQ29kZSA+IHRvQ29kZSkge1xuICAgIFt0b0NvZGUsIGZyb21Db2RlXSA9IFtmcm9tQ29kZSwgdG9Db2RlXTtcbiAgfVxuICByZXR1cm4gWy4uLkFycmF5KHRvQ29kZSAtIGZyb21Db2RlICsgMSkua2V5cygpXVxuICAgIC5tYXAoKGlpKSA9PiBTdHJpbmcuZnJvbUNoYXJDb2RlKGZyb21Db2RlICsgaWkpKVxuICAgIC5maWx0ZXIoKGNoYXIpID0+IC9bYS16XS9pLnRlc3QoY2hhcikpO1xufVxuIl19 |
@@ -6,2 +6,5 @@ import { isInt, consolidateRanges, consolidateAlphaRanges } from './utils'; | ||
export default function listString(list, options = {}) { | ||
if (list.length <= 1) { | ||
return list.join(''); | ||
} | ||
let andor; | ||
@@ -15,7 +18,10 @@ if (isString(options)) { | ||
else { | ||
andor = options.andor || options.conjunction || 'and'; | ||
andor = options.conjunction ?? 'and'; | ||
} | ||
const andOrProvided = Boolean(andor); | ||
// ensure whitespace around andor | ||
if (andor) | ||
andor = andor.replace(/^(?=\S)|(?<=\S)$/g, ' '); | ||
const { article } = options; | ||
const comma = options.comma || options.separator || ', '; | ||
const comma = options.comma ?? ', '; | ||
const minRangeDelta = options.minRangeDelta || 1; | ||
@@ -25,7 +31,7 @@ // is the list an array of numbers or string-versions of numbers? | ||
let isAlpha = false; | ||
let arr = null; | ||
let ranges; | ||
if (isNumeric) { | ||
let numberList = Array.from(list).map((a) => parseInt(a, 10)); | ||
// is numeric range | ||
arr = consolidateRanges(numberList, '–', list, minRangeDelta); | ||
ranges = consolidateRanges(numberList, '–', list, minRangeDelta); | ||
} | ||
@@ -35,33 +41,30 @@ else { // test if alphabetic range | ||
if (isAlpha) { | ||
arr = consolidateAlphaRanges(list); | ||
ranges = consolidateAlphaRanges(list); | ||
} | ||
} | ||
let delimiter; | ||
if (list.length > 2) { | ||
if (arr !== null) { | ||
if (arr.length > 2) { | ||
delimiter = comma; | ||
let delimiter = comma; | ||
if (ranges) { | ||
list = ranges; | ||
} | ||
else { | ||
if (list.length > 1) { | ||
const complex = list.find((x) => /,/.test(`${x}`)); | ||
if (complex) { | ||
delimiter = comma.replace(/,/, ';'); | ||
} | ||
} | ||
else { | ||
const complex = list.find((x) => /,/.test(x)); | ||
delimiter = complex ? comma.replace(/,/, ';') : comma; | ||
delimiter = andOrProvided ? andor : ''; | ||
delimiter = delimiter.replace(/^(?![,.;:\s])/, ' ').replace(/[^,.;:\s]$/, '$& '); | ||
} | ||
// add articles | ||
if (article) { | ||
list = list.map((item) => `${article} ${item}`); | ||
} | ||
} | ||
if (!delimiter) { | ||
delimiter = andOrProvided ? andor : ''; | ||
delimiter = delimiter.replace(/^(?![,.;:\s])/, ' ').replace(/[^,.;:\s]$/, '$& '); | ||
if (andOrProvided && (list.length > 2)) { | ||
list.push(`${andor.replace(/^\s+/, '')}${list.pop()}`); | ||
} | ||
if (!arr) { | ||
arr = list.slice(); | ||
} | ||
// add articles | ||
if (article) { | ||
arr = arr.map((item) => `${article} ${item}`); | ||
} | ||
if (andOrProvided && (arr.length > 2)) { | ||
arr.push(`${andor} ${arr.pop()}`); | ||
} | ||
return arr.join(delimiter); | ||
return list.join(list.length === 2 ? andor || delimiter : delimiter); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1zdHJpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGlzdC1zdHJpbmcudHMiXSwibmFtZXMi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gICBpZiAoYXJyICE9PSBudWxsKSB7XG4gICAgICBpZiAoYXJyLmxlbmd0aCA+IDIpIHtcbiAgICAgICAgZGVsaW1pdGVyID0gY29tbWE7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIGNvbnN0IGNvbXBsZXggPSBsaXN0LmZpbmQoKHgpID0+IC8sLy50ZXN0KHggYXMgc3RyaW5nKSk7XG4gICAgICBkZWxpbWl0ZXIgPSBjb21wbGV4ID8gY29tbWEucmVwbGFjZSgvLC8sICc7JykgOiBjb21tYTtcbiAgICB9XG4gIH1cblxuICBpZiAoIWRlbGltaXRlcikge1xuICAgIGRlbGltaXRlciA9IGFuZE9yUHJvdmlkZWQgPyBhbmRvciA6ICcnO1xuICAgIGRlbGltaXRlciA9IGRlbGltaXRlci5yZXBsYWNlKC9eKD8hWywuOzpcXHNdKS8sICcgJykucmVwbGFjZSgvW14sLjs6XFxzXSQvLCAnJCYgJyk7XG4gIH1cblxuICBpZiAoIWFycikge1xuICAgIGFyciA9IGxpc3Quc2xpY2UoKTtcbiAgfVxuXG4gIC8vIGFkZCBhcnRpY2xlc1xuICBpZiAoYXJ0aWNsZSkge1xuICAgIGFyciA9IGFyci5tYXAoKGl0ZW0pID0+IGAke2FydGljbGV9ICR7aXRlbX1gKTtcbiAgfVxuXG4gIGlmIChhbmRPclByb3ZpZGVkICYmIChhcnIubGVuZ3RoID4gMikpIHtcbiAgICBhcnIucHVzaChgJHthbmRvcn0gJHthcnIucG9wKCl9YCk7XG4gIH1cbiAgcmV0dXJuIGFyci5qb2luKGRlbGltaXRlcik7XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC1zdHJpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGlzdC1zdHJpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUNMLEtBQUssRU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function isNumber(n) { | ||
if (start.val === end.val) { | ||
out.push(start.val); | ||
out.push(`${start.val}`); | ||
} | ||
else if (getVal(end.val) - getVal(start.val) < minRangeDelta) { | ||
out.push(...arr.slice(start.index, end.index + 1)); | ||
out.push(...arr.slice(start.index, end.index + 1).map(x => `${x}`)); | ||
} | ||
@@ -64,2 +64,2 @@ else { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFFBQVEsQ0FBQyxDQUFVO0lBQ2pDLE9BQU8sQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLENBQVcsQ0FBQyxDQUFDLElBQUksUUFBUSxDQUFDLENBQVcsQ0FBQyxDQUFDO0FBQ2xFLENBQUM7QUFFRCxNQUFNLFVBQVUsS0FBSyxDQUFDLENBQVU7SUFDOUIsSUFBSSxDQUFDLEdBQUcsQ0FBVyxDQUFDO0lBQ3BCLE9BQU8sQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQyxJQUFJLFVBQVUsQ0FBQyxDQUFDLENBQUMsS0FBSyxRQUFRLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO0FBQ3RFLENBQUM7QUFFRCxNQUFNLFVBQVUsTUFBTSxDQUFDLEdBQWM7SUFDbkMsT0FBTyxDQUFDLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztBQUMzQixDQUFDO0FBRUQsU0FBUyxXQUFXLENBQ2xCLEdBQWMsRUFDZCxTQUFpQixFQUNqQixNQUE4QixFQUM5QixhQUFhLEdBQUcsQ0FBQztJQUdqQixNQUFNLFNBQVMsR0FBaUIsRUFBRSxDQUFDO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maWx0ZXIoKGNoYXIpID0+IC9bYS16XS9pLnRlc3QoY2hhcikpO1xufVxuIl19 |
{ | ||
"name": "@ckirby/mr-lister", | ||
"version": "2.7.1", | ||
"version": "2.8.0", | ||
"description": "format lists of numbers, letters, or arbitrary items", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
declare type ListStringOptions = { | ||
article?: string; | ||
comma?: string; | ||
delimiter?: string; | ||
andor?: string; | ||
conjunction?: string; | ||
separator?: string; | ||
minRangeDelta?: number; | ||
@@ -9,0 +6,0 @@ }; |
@@ -7,4 +7,4 @@ export declare function isNumber(n: unknown): n is number; | ||
needsUnique?: boolean | undefined; | ||
} | undefined, minRangeDelta: number): unknown[]; | ||
export declare function consolidateAlphaRanges(inputArray: unknown[], delimiter?: string): unknown[]; | ||
} | undefined, minRangeDelta: number): string[]; | ||
export declare function consolidateAlphaRanges(inputArray: unknown[], delimiter?: string): string[]; | ||
export declare function expandAlphaRange(fromChar: string, toChar: string): string[]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70206
529