Appearance
join
Variables
joinAmp
ts
const joinAmp: (items) => string;Defined in: src/join/joinAmp.ts:12
Joins array items with ampersand.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | any[] | The items to join. |
Returns
string
The joined string.
Example
ts
joinAmp(['a', 'b', 'c']) // => 'a&b&c'
joinAmp(['hello']) // => 'hello'joinComma
ts
const joinComma: (items) => string;Defined in: src/join/joinComma.ts:13
Joins array items with comma.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | any[] | The items to join. |
Returns
string
The joined string.
Example
ts
joinComma(['a', 'b', 'c']) // => 'a,b,c'
joinComma(['hello']) // => 'hello'
joinComma([]) // => ''joinDot
ts
const joinDot: (items) => string;Defined in: src/join/joinDot.ts:12
Joins array items with dot.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | any[] | The items to join. |
Returns
string
The joined string.
Example
ts
joinDot(['a', 'b', 'c']); // => 'a.b.c'
joinDot(['hello']); // => 'hello'joinOnly
ts
const joinOnly: (items) => string;Defined in: src/join/joinOnly.ts:13
Joins array items without any delimiter.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | any[] | The items to join. |
Returns
string
The joined string.
Example
ts
joinOnly(['a', 'b', 'c']) // => 'abc'
joinOnly(['hello']) // => 'hello'
joinOnly([]) // => ''joinSpace
ts
const joinSpace: (items) => string;Defined in: src/join/joinSpace.ts:13
Joins array items with space.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | any[] | The items to join. |
Returns
string
The joined string.
Example
ts
joinSpace(['a', 'b', 'c']) // => 'a b c'
joinSpace(['hello']) // => 'hello'
joinSpace([]) // => ''Functions
joinArrays()
ts
function joinArrays(
prefixes,
suffixes,
separator?,
output?): string[];Defined in: src/join/joinArrays.ts:17
Joins two arrays into a new array using the given separator string.
If suffixes is empty, returns a shallow copy of prefixes.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
prefixes | string[] | undefined | The prefixes to join. |
suffixes | string[] | undefined | The suffixes to join. |
separator | string | '' | The separator to join the prefixes and suffixes with. |
output? | string[] | undefined | The output array to join the prefixes and suffixes into. |
Returns
string[]
The joined array.
Example
ts
joinArrays(['a', 'b'], ['d', 'e']) // => ['a.d', 'a.e', 'b.d', 'b.e']
joinArrays(['a', 'b'], ['d', 'e'], '.') // => ['a.d', 'a.e', 'b.d', 'b.e']
joinArrays(['a', 'b'], ['d', 'e', 'f'], ':') // => ['a:d', 'a:e', 'a:f', 'b:d', 'b:e', 'b:f']
joinArrays(['a', 'b'], ['d', 'e'], '.', ['g', 'h', 'i']) // => ['g', 'h', 'i', 'a.d', 'a.e', 'b.d', 'b.e']joinMaps()
ts
function joinMaps(
prefixes,
suffixes,
separator?,
output?): Record<string, any>;Defined in: src/join/joinMaps.ts:14
Joins keys from prefixes and suffixes into a flags map.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
prefixes | Record<string, any> | undefined | The prefixes to join. |
suffixes | Record<string, any> | undefined | The suffixes to join. |
separator | string | '' | The separator to join the prefixes and suffixes with. |
output? | Record<string, any> | undefined | The output map to join the prefixes and suffixes into. |
Returns
Record<string, any>
The joined map.
Example
ts
joinMaps({ a: true, b: false }, { c: true, d: false }) // => { 'a.c': 1, 'a.d': 1, 'b.c': 1, 'b.d': 1 }
joinMaps({ a: true, b: false }, { c: true, d: false }, '.') // => { 'a.c': 1, 'a.d': 1, 'b.c': 1, 'b.d': 1 }
joinMaps({ a: true, b: false }, { c: true, d: false }, '.', { e: true, f: false }) // => { 'a.c.e': 1, 'a.c.f': 1, 'a.d.e': 1, 'a.d.f': 1, 'b.c.e': 1, 'b.c.f': 1, 'b.d.e': 1, 'b.d.f': 1 }joinPrefixToMap()
ts
function joinPrefixToMap(
prefix,
suffixes,
output?): Record<string, any>;Defined in: src/join/joinPrefixToMap.ts:12
Adds prefix to all keys in suffixes and writes into output map.
Parameters
| Parameter | Type | Description |
|---|---|---|
prefix | string | The prefix to add to the keys. |
suffixes | Record<string, any> | The suffixes to join. |
output? | Record<string, any> | The output map to join the prefixes and suffixes into. |
Returns
Record<string, any>
The joined map.
Example
ts
joinPrefixToMap('a.', { b: 1, c: 1 }); // => { 'a.b': 1, 'a.c': 1 }
joinPrefixToMap('x-', { y: 1 }, { z: 1 }); // => { z: 1, 'x-y': 1 }joinProvider()
ts
function joinProvider(delimiter): (src) => string;Defined in: src/join/joinProvider.ts:11
Creates join helper for fixed delimiter.
Parameters
| Parameter | Type | Description |
|---|---|---|
delimiter | string | The delimiter to join the items with. |
Returns
The join provider.
(src) => string
Example
ts
joinProvider('.')(['a', 'b', 'c']) // => 'a.b.c'joinSuffixToMap()
ts
function joinSuffixToMap(
prefixes,
suffix,
output?): Record<string, number>;Defined in: src/join/joinSuffixToMap.ts:15
Builds a map of keys composed from each prefix plus the given suffix.
For every key in prefixes, the result will contain prefix + suffix with value 1.
Parameters
| Parameter | Type | Description |
|---|---|---|
prefixes | Record<string, unknown> | The prefixes to join. |
suffix | string | The suffix to join. |
output? | Record<string, number> | The output map to join the prefixes and suffixes into. |
Returns
Record<string, number>
The joined map.
Example
ts
joinSuffixToMap({ a: true, b: true }, '-x') // => { 'a-x': 1, 'b-x': 1 }
joinSuffixToMap({ a: true, b: true }, '-x', { c: 1, d: 0 }) // => { 'c': 1, 'd': 0, 'a-x': 1, 'b-x': 1 }