@supercharge/arrays
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -1,3 +0,3 @@ | ||
declare type Values<T> = Array<T | Iterable<T> | undefined | null>; | ||
declare type Predicate<T> = ((item: T, index: number, array: Arr<T>) => unknown); | ||
type Values<T> = Array<T | Iterable<T> | undefined | null>; | ||
type Predicate<T> = ((item: T, index: number, array: Arr<T>) => unknown); | ||
export declare class Arr<T> { | ||
@@ -215,2 +215,4 @@ /** | ||
join(separator: string): string; | ||
join(separator: string, finalGlue: string): string; | ||
join(separator: (item: T, index: number, arr: Arr<T>) => string): string; | ||
/** | ||
@@ -217,0 +219,0 @@ * Returns the last element of the array or returns the last item in the array matching |
@@ -269,11 +269,14 @@ 'use strict'; | ||
} | ||
/** | ||
* Returns a new string by concatenating all of the elements in an array. | ||
* | ||
* @param {String} separator | ||
* | ||
* @returns {String} | ||
*/ | ||
join(separator) { | ||
return this.values.join(separator); | ||
join(separator, finalGlue) { | ||
if (typeof separator === 'function') { | ||
return this.map(separator).join(''); | ||
} | ||
if (this.size() < 2) { | ||
return this.values.join(separator); | ||
} | ||
if (!finalGlue) { | ||
return this.values.join(separator); | ||
} | ||
const last = this.pop(); | ||
return this.values.join(separator) + finalGlue + String(last); | ||
} | ||
@@ -280,0 +283,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
export * from './arr'; | ||
declare const _default: "./arr"; | ||
export default _default; | ||
export { Arr } from './arr'; |
'use strict'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./arr"), exports); | ||
exports.Arr = void 0; | ||
exports.default = './arr'; | ||
var arr_1 = require("./arr"); | ||
Object.defineProperty(exports, "Arr", { enumerable: true, get: function () { return arr_1.Arr; } }); |
{ | ||
"name": "@supercharge/arrays", | ||
"description": "Array utilities for Node.js and JavaScript", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"author": "Marcus Pöhls <marcus@superchargejs.com>", | ||
@@ -10,8 +10,8 @@ "bugs": { | ||
"devDependencies": { | ||
"@supercharge/eslint-config-typescript": "~2.3.1", | ||
"@supercharge/eslint-config-typescript": "~2.3.3", | ||
"@supercharge/tsconfig": "~4.0.0", | ||
"c8": "~7.12.0", | ||
"eslint": "~8.26.0", | ||
"expect": "~29.2.2", | ||
"typescript": "~4.8.4", | ||
"eslint": "~8.30.0", | ||
"expect": "~29.3.1", | ||
"typescript": "~4.9.4", | ||
"uvu": "~0.5.6" | ||
@@ -18,0 +18,0 @@ }, |
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
32817
1008