mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 20:07:06 +00:00
Review feedback on supporting multiple relatives in node-grid columns
This commit is contained in:
@@ -28,5 +28,14 @@ export function moveElement(array, from, to) {
|
||||
}
|
||||
|
||||
export function intersperse(items, value) {
|
||||
//
|
||||
// intersperse([1, 2, 3], 'a') => [1, 'a', 2, 'a', 3]
|
||||
//
|
||||
// Useful for when you wanna do: [<MyReactListItem />, <MyReactListItem />].join(' ')
|
||||
// But you can't because React Components aren't strings.
|
||||
//
|
||||
// intersperse([<MyReactListItem />, <MyReactListItem />], ' ')
|
||||
// Will get you there!
|
||||
//
|
||||
return [].concat(...items.map(e => [value, e])).slice(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user