diff --git a/libs/dfts-helper/src/lib/helper/string/imploder/imploder.ts b/libs/dfts-helper/src/lib/helper/string/imploder/imploder.ts index 85191cd5..0b2482c7 100644 --- a/libs/dfts-helper/src/lib/helper/string/imploder/imploder.ts +++ b/libs/dfts-helper/src/lib/helper/string/imploder/imploder.ts @@ -1,3 +1,5 @@ +import { s_from } from '../from/from'; + export function s_imploder(): ImploderBuilder { return new ImploderBuilder(); } @@ -27,6 +29,18 @@ export class ImploderBuilder { return this; } + /** + * @DEPRECATED Please use .source([], (it: T) => string) + */ + mappedSource(source?: T[] | null, mapFn?: (it: T) => string): this { + if (mapFn && source) { + this._source = source.map(mapFn); + } else if (source && source.every((it: T) => typeof it === 'string' || typeof it === 'boolean' || typeof it === 'number')) { + this._source = source.map((it) => s_from(it as string | boolean | number)); + } + return this; + } + maxLength(maxLength?: number | null): this { this._maxLength = maxLength; return this;