|
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>implode() | collect.js</title>
|
|
<meta name="description" content="Convenient and dependency free wrapper for working with arrays and objects.">
|
|
|
|
|
|
<link rel="preload" href="/<REPO>/assets/css/0.styles.cf26012d.css" as="style"><link rel="preload" href="/<REPO>/assets/js/app.14e4c2ec.js" as="script"><link rel="preload" href="/<REPO>/assets/js/2.87b3604c.js" as="script"><link rel="preload" href="/<REPO>/assets/js/39.13c74865.js" as="script"><link rel="prefetch" href="/<REPO>/assets/js/10.c61ccac3.js"><link rel="prefetch" href="/<REPO>/assets/js/100.f1cb0dd3.js"><link rel="prefetch" href="/<REPO>/assets/js/101.1db86157.js"><link rel="prefetch" href="/<REPO>/assets/js/102.2bf45f3c.js"><link rel="prefetch" href="/<REPO>/assets/js/103.04f11975.js"><link rel="prefetch" href="/<REPO>/assets/js/104.339b9c78.js"><link rel="prefetch" href="/<REPO>/assets/js/105.02d9eb06.js"><link rel="prefetch" href="/<REPO>/assets/js/106.99937062.js"><link rel="prefetch" href="/<REPO>/assets/js/107.aec6514a.js"><link rel="prefetch" href="/<REPO>/assets/js/108.46ef43a0.js"><link rel="prefetch" href="/<REPO>/assets/js/109.d03c0323.js"><link rel="prefetch" href="/<REPO>/assets/js/11.534c7609.js"><link rel="prefetch" href="/<REPO>/assets/js/110.1301ed6d.js"><link rel="prefetch" href="/<REPO>/assets/js/111.56c1eafe.js"><link rel="prefetch" href="/<REPO>/assets/js/112.876213a1.js"><link rel="prefetch" href="/<REPO>/assets/js/113.ba642269.js"><link rel="prefetch" href="/<REPO>/assets/js/114.4b773f17.js"><link rel="prefetch" href="/<REPO>/assets/js/115.995ef4ff.js"><link rel="prefetch" href="/<REPO>/assets/js/116.fb8e0edf.js"><link rel="prefetch" href="/<REPO>/assets/js/117.e91ef9f2.js"><link rel="prefetch" href="/<REPO>/assets/js/118.7e9c16e0.js"><link rel="prefetch" href="/<REPO>/assets/js/12.ebb0681e.js"><link rel="prefetch" href="/<REPO>/assets/js/13.b3e5d619.js"><link rel="prefetch" href="/<REPO>/assets/js/14.c957ed89.js"><link rel="prefetch" href="/<REPO>/assets/js/15.abbc647d.js"><link rel="prefetch" href="/<REPO>/assets/js/16.78c555be.js"><link rel="prefetch" href="/<REPO>/assets/js/17.7ab9a167.js"><link rel="prefetch" href="/<REPO>/assets/js/18.4b3c73bd.js"><link rel="prefetch" href="/<REPO>/assets/js/19.11a116d9.js"><link rel="prefetch" href="/<REPO>/assets/js/20.19feeb8a.js"><link rel="prefetch" href="/<REPO>/assets/js/21.5745e9aa.js"><link rel="prefetch" href="/<REPO>/assets/js/22.8910c1a3.js"><link rel="prefetch" href="/<REPO>/assets/js/23.fe5c23fe.js"><link rel="prefetch" href="/<REPO>/assets/js/24.6ed6d804.js"><link rel="prefetch" href="/<REPO>/assets/js/25.fd72bb93.js"><link rel="prefetch" href="/<REPO>/assets/js/26.6c22637d.js"><link rel="prefetch" href="/<REPO>/assets/js/27.ff2ad739.js"><link rel="prefetch" href="/<REPO>/assets/js/28.0aabe7f7.js"><link rel="prefetch" href="/<REPO>/assets/js/29.60968b26.js"><link rel="prefetch" href="/<REPO>/assets/js/3.20fa8bd4.js"><link rel="prefetch" href="/<REPO>/assets/js/30.e90c9cf7.js"><link rel="prefetch" href="/<REPO>/assets/js/31.d6437fab.js"><link rel="prefetch" href="/<REPO>/assets/js/32.f28f1d83.js"><link rel="prefetch" href="/<REPO>/assets/js/33.33e5481a.js"><link rel="prefetch" href="/<REPO>/assets/js/34.16e5f595.js"><link rel="prefetch" href="/<REPO>/assets/js/35.9338f581.js"><link rel="prefetch" href="/<REPO>/assets/js/36.4cc1614e.js"><link rel="prefetch" href="/<REPO>/assets/js/37.4c05651c.js"><link rel="prefetch" href="/<REPO>/assets/js/38.253a5089.js"><link rel="prefetch" href="/<REPO>/assets/js/4.c843e0e7.js"><link rel="prefetch" href="/<REPO>/assets/js/40.9f440564.js"><link rel="prefetch" href="/<REPO>/assets/js/41.e3c7c1d9.js"><link rel="prefetch" href="/<REPO>/assets/js/42.1dbcc2a2.js"><link rel="prefetch" href="/<REPO>/assets/js/43.cd5ef633.js"><link rel="prefetch" href="/<REPO>/assets/js/44.eb672d2a.js"><link rel="prefetch" href="/<REPO>/assets/js/45.0bd75a5b.js"><link rel="prefetch" href="/<REPO>/assets/js/46.43143cbf.js"><link rel="prefetch" href="/<REPO>/assets/js/47.80ad8d7d.js"><link rel="prefetch" href="/<REPO>/assets/js/48.acbf3eb9.js"><link rel="prefetch" href="/<REPO>/assets/js/49.fcda4795.js"><link rel="prefetch" href="/<REPO>/assets/js/5.89d5d52d.js"><link rel="prefetch" href="/<REPO>/assets/js/50.c11d7fea.js"><link rel="prefetch" href="/<REPO>/assets/js/51.ac7ef5c5.js"><link rel="prefetch" href="/<REPO>/assets/js/52.20e7e008.js"><link rel="prefetch" href="/<REPO>/assets/js/53.3aebda95.js"><link rel="prefetch" href="/<REPO>/assets/js/54.32dd09e6.js"><link rel="prefetch" href="/<REPO>/assets/js/55.1390733c.js"><link rel="prefetch" href="/<REPO>/assets/js/56.323d9e4f.js"><link rel="prefetch" href="/<REPO>/assets/js/57.4f00873d.js"><link rel="prefetch" href="/<REPO>/assets/js/58.66742d06.js"><link rel="prefetch" href="/<REPO>/assets/js/59.6098fc41.js"><link rel="prefetch" href="/<REPO>/assets/js/6.d17194f0.js"><link rel="prefetch" href="/<REPO>/assets/js/60.ecf75149.js"><link rel="prefetch" href="/<REPO>/assets/js/61.06ecd66d.js"><link rel="prefetch" href="/<REPO>/assets/js/62.55af9c25.js"><link rel="prefetch" href="/<REPO>/assets/js/63.04e3a42d.js"><link rel="prefetch" href="/<REPO>/assets/js/64.434f9ebf.js"><link rel="prefetch" href="/<REPO>/assets/js/65.15c2d225.js"><link rel="prefetch" href="/<REPO>/assets/js/66.621171cc.js"><link rel="prefetch" href="/<REPO>/assets/js/67.b7ed4aa7.js"><link rel="prefetch" href="/<REPO>/assets/js/68.2fc54e06.js"><link rel="prefetch" href="/<REPO>/assets/js/69.8f1752a6.js"><link rel="prefetch" href="/<REPO>/assets/js/7.36d6745d.js"><link rel="prefetch" href="/<REPO>/assets/js/70.72b9acd8.js"><link rel="prefetch" href="/<REPO>/assets/js/71.4c6b2128.js"><link rel="prefetch" href="/<REPO>/assets/js/72.5797f6f2.js"><link rel="prefetch" href="/<REPO>/assets/js/73.c997a141.js"><link rel="prefetch" href="/<REPO>/assets/js/74.e2776c59.js"><link rel="prefetch" href="/<REPO>/assets/js/75.2073b6fa.js"><link rel="prefetch" href="/<REPO>/assets/js/76.8d950a11.js"><link rel="prefetch" href="/<REPO>/assets/js/77.af6025ee.js"><link rel="prefetch" href="/<REPO>/assets/js/78.c3e4ccf2.js"><link rel="prefetch" href="/<REPO>/assets/js/79.03b4b310.js"><link rel="prefetch" href="/<REPO>/assets/js/8.c71b046c.js"><link rel="prefetch" href="/<REPO>/assets/js/80.60847ab0.js"><link rel="prefetch" href="/<REPO>/assets/js/81.6a88a513.js"><link rel="prefetch" href="/<REPO>/assets/js/82.cd643697.js"><link rel="prefetch" href="/<REPO>/assets/js/83.1b506412.js"><link rel="prefetch" href="/<REPO>/assets/js/84.cb48c6e2.js"><link rel="prefetch" href="/<REPO>/assets/js/85.0077989d.js"><link rel="prefetch" href="/<REPO>/assets/js/86.b6139d33.js"><link rel="prefetch" href="/<REPO>/assets/js/87.3e61fc1b.js"><link rel="prefetch" href="/<REPO>/assets/js/88.2ddcbb58.js"><link rel="prefetch" href="/<REPO>/assets/js/89.eeb4b6e4.js"><link rel="prefetch" href="/<REPO>/assets/js/9.536986ca.js"><link rel="prefetch" href="/<REPO>/assets/js/90.13992b52.js"><link rel="prefetch" href="/<REPO>/assets/js/91.a0e54bab.js"><link rel="prefetch" href="/<REPO>/assets/js/92.35497373.js"><link rel="prefetch" href="/<REPO>/assets/js/93.28003955.js"><link rel="prefetch" href="/<REPO>/assets/js/94.f6992f44.js"><link rel="prefetch" href="/<REPO>/assets/js/95.585f327f.js"><link rel="prefetch" href="/<REPO>/assets/js/96.dc20cc78.js"><link rel="prefetch" href="/<REPO>/assets/js/97.c35b80e6.js"><link rel="prefetch" href="/<REPO>/assets/js/98.e29df611.js"><link rel="prefetch" href="/<REPO>/assets/js/99.90ebc36b.js">
|
|
<link rel="stylesheet" href="/<REPO>/assets/css/0.styles.cf26012d.css">
|
|
</head>
|
|
<body>
|
|
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/<REPO>/" class="home-link router-link-active"><!----> <span class="site-name">collect.js</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/<REPO>/" class="nav-link">Home</a></div><div class="nav-item"><a href="/<REPO>/installation.html" class="nav-link">Installation</a></div><div class="nav-item"><a href="/<REPO>/usage.html" class="nav-link">Usage</a></div><div class="nav-item"><a href="/<REPO>/api.html" class="nav-link">API</a></div><div class="nav-item"><a href="https://github.com/ecrmnn/collect.js" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
|
GitHub
|
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/<REPO>/" class="nav-link">Home</a></div><div class="nav-item"><a href="/<REPO>/installation.html" class="nav-link">Installation</a></div><div class="nav-item"><a href="/<REPO>/usage.html" class="nav-link">Usage</a></div><div class="nav-item"><a href="/<REPO>/api.html" class="nav-link">API</a></div><div class="nav-item"><a href="https://github.com/ecrmnn/collect.js" target="_blank" rel="noopener noreferrer" class="nav-link external">
|
|
GitHub
|
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>Get started</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/<REPO>/installation.html" class="sidebar-link">Installation</a></li><li><a href="/<REPO>/usage.html" class="sidebar-link">Usage</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>API</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/<REPO>/api/all.html" class="sidebar-link">all()</a></li><li><a href="/<REPO>/api/average.html" class="sidebar-link">average()</a></li><li><a href="/<REPO>/api/avg.html" class="sidebar-link">avg()</a></li><li><a href="/<REPO>/api/chunk.html" class="sidebar-link">chunk()</a></li><li><a href="/<REPO>/api/collapse.html" class="sidebar-link">collapse()</a></li><li><a href="/<REPO>/api/combine.html" class="sidebar-link">combine()</a></li><li><a href="/<REPO>/api/concat.html" class="sidebar-link">concat()</a></li><li><a href="/<REPO>/api/contains.html" class="sidebar-link">contains()</a></li><li><a href="/<REPO>/api/count.html" class="sidebar-link">count()</a></li><li><a href="/<REPO>/api/countBy.html" class="sidebar-link">countBy()</a></li><li><a href="/<REPO>/api/crossJoin.html" class="sidebar-link">crossJoin()</a></li><li><a href="/<REPO>/api/dd.html" class="sidebar-link">dd()</a></li><li><a href="/<REPO>/api/diff.html" class="sidebar-link">diff()</a></li><li><a href="/<REPO>/api/diffAssoc.html" class="sidebar-link">diffAssoc()</a></li><li><a href="/<REPO>/api/diffKeys.html" class="sidebar-link">diffKeys()</a></li><li><a href="/<REPO>/api/dump.html" class="sidebar-link">dump()</a></li><li><a href="/<REPO>/api/duplicates.html" class="sidebar-link">duplicates()</a></li><li><a href="/<REPO>/api/each.html" class="sidebar-link">each()</a></li><li><a href="/<REPO>/api/eachSpread.html" class="sidebar-link">eachSpread()</a></li><li><a href="/<REPO>/api/every.html" class="sidebar-link">every()</a></li><li><a href="/<REPO>/api/except.html" class="sidebar-link">except()</a></li><li><a href="/<REPO>/api/filter.html" class="sidebar-link">filter()</a></li><li><a href="/<REPO>/api/first.html" class="sidebar-link">first()</a></li><li><a href="/<REPO>/api/firstWhere.html" class="sidebar-link">firstWhere()</a></li><li><a href="/<REPO>/api/flatMap.html" class="sidebar-link">flatMap()</a></li><li><a href="/<REPO>/api/flatten.html" class="sidebar-link">flatten()</a></li><li><a href="/<REPO>/api/flip.html" class="sidebar-link">flip()</a></li><li><a href="/<REPO>/api/forPage.html" class="sidebar-link">forPage()</a></li><li><a href="/<REPO>/api/forget.html" class="sidebar-link">forget()</a></li><li><a href="/<REPO>/api/get.html" class="sidebar-link">get()</a></li><li><a href="/<REPO>/api/groupBy.html" class="sidebar-link">groupBy()</a></li><li><a href="/<REPO>/api/has.html" class="sidebar-link">has()</a></li><li><a href="/<REPO>/api/implode.html" class="active sidebar-link">implode()</a></li><li><a href="/<REPO>/api/intersect.html" class="sidebar-link">intersect()</a></li><li><a href="/<REPO>/api/intersectByKeys.html" class="sidebar-link">intersectByKeys()</a></li><li><a href="/<REPO>/api/isEmpty.html" class="sidebar-link">isEmpty()</a></li><li><a href="/<REPO>/api/isNotEmpty.html" class="sidebar-link">isNotEmpty()</a></li><li><a href="/<REPO>/api/join.html" class="sidebar-link">join()</a></li><li><a href="/<REPO>/api/keyBy.html" class="sidebar-link">keyBy()</a></li><li><a href="/<REPO>/api/keys.html" class="sidebar-link">keys()</a></li><li><a href="/<REPO>/api/last.html" class="sidebar-link">last()</a></li><li><a href="/<REPO>/api/macro.html" class="sidebar-link">macro()</a></li><li><a href="/<REPO>/api/make.html" class="sidebar-link">make()</a></li><li><a href="/<REPO>/api/map.html" class="sidebar-link">map()</a></li><li><a href="/<REPO>/api/mapInto.html" class="sidebar-link">mapInto()</a></li><li><a href="/<REPO>/api/mapSpread.html" class="sidebar-link">mapSpread()</a></li><li><a href="/<REPO>/api/mapToDictionary.html" class="sidebar-link">mapToDictionary()</a></li><li><a href="/<REPO>/api/mapToGroups.html" class="sidebar-link">mapToGroups()</a></li><li><a href="/<REPO>/api/mapWithKeys.html" class="sidebar-link">mapWithKeys()</a></li><li><a href="/<REPO>/api/max.html" class="sidebar-link">max()</a></li><li><a href="/<REPO>/api/median.html" class="sidebar-link">median()</a></li><li><a href="/<REPO>/api/merge.html" class="sidebar-link">merge()</a></li><li><a href="/<REPO>/api/mergeRecursive.html" class="sidebar-link">mergeRecursive()</a></li><li><a href="/<REPO>/api/min.html" class="sidebar-link">min()</a></li><li><a href="/<REPO>/api/mode.html" class="sidebar-link">mode()</a></li><li><a href="/<REPO>/api/nth.html" class="sidebar-link">nth()</a></li><li><a href="/<REPO>/api/only.html" class="sidebar-link">only()</a></li><li><a href="/<REPO>/api/pad.html" class="sidebar-link">pad()</a></li><li><a href="/<REPO>/api/partition.html" class="sidebar-link">partition()</a></li><li><a href="/<REPO>/api/pipe.html" class="sidebar-link">pipe()</a></li><li><a href="/<REPO>/api/pluck.html" class="sidebar-link">pluck()</a></li><li><a href="/<REPO>/api/pop.html" class="sidebar-link">pop()</a></li><li><a href="/<REPO>/api/prepend.html" class="sidebar-link">prepend()</a></li><li><a href="/<REPO>/api/pull.html" class="sidebar-link">pull()</a></li><li><a href="/<REPO>/api/push.html" class="sidebar-link">push()</a></li><li><a href="/<REPO>/api/put.html" class="sidebar-link">put()</a></li><li><a href="/<REPO>/api/random.html" class="sidebar-link">random()</a></li><li><a href="/<REPO>/api/reduce.html" class="sidebar-link">reduce()</a></li><li><a href="/<REPO>/api/reject.html" class="sidebar-link">reject()</a></li><li><a href="/<REPO>/api/replace.html" class="sidebar-link">replace()</a></li><li><a href="/<REPO>/api/replaceRecursive.html" class="sidebar-link">replaceRecursive()</a></li><li><a href="/<REPO>/api/reverse.html" class="sidebar-link">reverse()</a></li><li><a href="/<REPO>/api/search.html" class="sidebar-link">search()</a></li><li><a href="/<REPO>/api/shift.html" class="sidebar-link">shift()</a></li><li><a href="/<REPO>/api/shuffle.html" class="sidebar-link">shuffle()</a></li><li><a href="/<REPO>/api/slice.html" class="sidebar-link">slice()</a></li><li><a href="/<REPO>/api/some.html" class="sidebar-link">some()</a></li><li><a href="/<REPO>/api/sort.html" class="sidebar-link">sort()</a></li><li><a href="/<REPO>/api/sortBy.html" class="sidebar-link">sortBy()</a></li><li><a href="/<REPO>/api/sortByDesc.html" class="sidebar-link">sortByDesc()</a></li><li><a href="/<REPO>/api/sortKeys.html" class="sidebar-link">sortKeys()</a></li><li><a href="/<REPO>/api/sortKeysDesc.html" class="sidebar-link">sortKeysDesc()</a></li><li><a href="/<REPO>/api/splice.html" class="sidebar-link">splice()</a></li><li><a href="/<REPO>/api/split.html" class="sidebar-link">split()</a></li><li><a href="/<REPO>/api/sum.html" class="sidebar-link">sum()</a></li><li><a href="/<REPO>/api/take.html" class="sidebar-link">take()</a></li><li><a href="/<REPO>/api/tap.html" class="sidebar-link">tap()</a></li><li><a href="/<REPO>/api/times.html" class="sidebar-link">times()</a></li><li><a href="/<REPO>/api/toArray.html" class="sidebar-link">toArray()</a></li><li><a href="/<REPO>/api/toJson.html" class="sidebar-link">toJson()</a></li><li><a href="/<REPO>/api/transform.html" class="sidebar-link">transform()</a></li><li><a href="/<REPO>/api/union.html" class="sidebar-link">union()</a></li><li><a href="/<REPO>/api/unique.html" class="sidebar-link">unique()</a></li><li><a href="/<REPO>/api/unless.html" class="sidebar-link">unless()</a></li><li><a href="/<REPO>/api/unlessEmpty.html" class="sidebar-link">unlessEmpty()</a></li><li><a href="/<REPO>/api/unlessNotEmpty.html" class="sidebar-link">unlessNotEmpty()</a></li><li><a href="/<REPO>/api/unwrap.html" class="sidebar-link">unwrap()</a></li><li><a href="/<REPO>/api/values.html" class="sidebar-link">values()</a></li><li><a href="/<REPO>/api/when.html" class="sidebar-link">when()</a></li><li><a href="/<REPO>/api/whenEmpty.html" class="sidebar-link">whenEmpty()</a></li><li><a href="/<REPO>/api/whenNotEmpty.html" class="sidebar-link">whenNotEmpty()</a></li><li><a href="/<REPO>/api/where.html" class="sidebar-link">where()</a></li><li><a href="/<REPO>/api/whereBetween.html" class="sidebar-link">whereBetween()</a></li><li><a href="/<REPO>/api/whereIn.html" class="sidebar-link">whereIn()</a></li><li><a href="/<REPO>/api/whereInstanceOf.html" class="sidebar-link">whereInstanceOf()</a></li><li><a href="/<REPO>/api/whereNotBetween.html" class="sidebar-link">whereNotBetween()</a></li><li><a href="/<REPO>/api/whereNotIn.html" class="sidebar-link">whereNotIn()</a></li><li><a href="/<REPO>/api/wrap.html" class="sidebar-link">wrap()</a></li><li><a href="/<REPO>/api/zip.html" class="sidebar-link">zip()</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="implode"><a href="#implode" aria-hidden="true" class="header-anchor">#</a> <code>implode()</code></h1> <p>The implode method joins the items in a collection. Its arguments depend on the type of items in the collection. If the collection contains arrays or objects, you should pass the key of the attributes you wish to join, and the "glue" string you wish to place between the values:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> collection <span class="token operator">=</span> <span class="token function">collect</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
|
|
<span class="token punctuation">{</span>
|
|
product<span class="token punctuation">:</span> <span class="token string">"Chair"</span><span class="token punctuation">,</span>
|
|
manufacturer<span class="token punctuation">:</span> <span class="token string">"IKEA"</span>
|
|
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
<span class="token punctuation">{</span>
|
|
product<span class="token punctuation">:</span> <span class="token string">"Desk"</span><span class="token punctuation">,</span>
|
|
manufacturer<span class="token punctuation">:</span> <span class="token string">"IKEA"</span>
|
|
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
<span class="token punctuation">{</span>
|
|
product<span class="token punctuation">:</span> <span class="token string">"Chair"</span><span class="token punctuation">,</span>
|
|
manufacturer<span class="token punctuation">:</span> <span class="token string">"Herman Miller"</span>
|
|
<span class="token punctuation">}</span>
|
|
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
|
|
collection<span class="token punctuation">.</span><span class="token function">implode</span><span class="token punctuation">(</span><span class="token string">"product"</span><span class="token punctuation">,</span> <span class="token string">","</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
|
|
<span class="token comment">//=> Chair, Desk, Chair</span>
|
|
</code></pre></div><p>If the collection contains simple strings or numeric values, simply pass the "glue" as the only argument to the method:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token function">collect</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">implode</span><span class="token punctuation">(</span><span class="token string">"-"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
|
|
<span class="token comment">//=> 1-2-3-4-5</span>
|
|
</code></pre></div><p><a href="https://github.com/ecrmnn/collect.js/blob/master/src/methods/implode.js" target="_blank" rel="noopener noreferrer">View source on GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
|
|
←
|
|
<a href="/<REPO>/api/has.html" class="prev">
|
|
has()
|
|
</a></span> <span class="next"><a href="/<REPO>/api/intersect.html">
|
|
intersect()
|
|
</a>
|
|
→
|
|
</span></p></div> </main></div><div class="global-ui"></div></div>
|
|
<script src="/<REPO>/assets/js/app.14e4c2ec.js" defer></script><script src="/<REPO>/assets/js/2.87b3604c.js" defer></script><script src="/<REPO>/assets/js/39.13c74865.js" defer></script>
|
|
</body>
|
|
</html>
|