join-string
Advanced tools
Comparing version 0.0.4 to 1.0.0
@@ -10,6 +10,15 @@ "use strict"; | ||
} | ||
return items | ||
.filter(function (item) { return typesafe_is_1.isFilledString(item) || typesafe_is_1.isNumber(item) || typesafe_is_1.isArray(item); }) | ||
.map(function (item) { return (typesafe_is_1.isArray(item) ? joinFn.apply(void 0, item) : item); }) | ||
.join(delimiter); | ||
var results = []; | ||
for (var index = 0; index < items.length; index++) { | ||
var item = items[index]; | ||
if (typesafe_is_1.isNumber(item) || typesafe_is_1.isFilledString(item)) { | ||
results.push(item); | ||
continue; | ||
} | ||
if (typesafe_is_1.isArray(item)) { | ||
results.push(joinFn.apply(void 0, item)); | ||
continue; | ||
} | ||
} | ||
return results.join(delimiter); | ||
}; | ||
@@ -16,0 +25,0 @@ }; |
{ | ||
"name": "join-string", | ||
"version": "0.0.4", | ||
"version": "1.0.0", | ||
"description": "A utility for joining strings", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,6 +5,19 @@ import { isFilledString, isArray, isNumber } from 'typesafe-is'; | ||
function joinFn(...items: Array<any>): string { | ||
return items | ||
.filter(item => isFilledString(item) || isNumber(item) || isArray(item)) | ||
.map(item => (isArray(item) ? joinFn(...item) : item)) | ||
.join(delimiter); | ||
const results: Array<string | number> = []; | ||
for (let index = 0; index < items.length; index++) { | ||
const item = items[index]; | ||
if (isNumber(item) || isFilledString(item)) { | ||
results.push(item); | ||
continue; | ||
} | ||
if (isArray(item)) { | ||
results.push(joinFn(...item)); | ||
continue; | ||
} | ||
} | ||
return results.join(delimiter); | ||
}; | ||
@@ -11,0 +24,0 @@ |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
159654
138
1