MCPcopy Create free account
hub / github.com/Khan/perseus / mapcat

Function mapcat

packages/perseus-editor/src/diffs/shared/string-array-diff.ts:45–50  ·  view source on GitHub ↗
(
    lst: ImageEntry[],
    fn: (chunk: ImageEntry) => ImageDiff[],
)

Source from the content-addressed store, hash-verified

43// Apply `fn` to every element in `lst` and then concatenate all the results
44// http://clojuredocs.org/clojure_core/clojure.core/mapcat
45function mapcat(
46 lst: ImageEntry[],
47 fn: (chunk: ImageEntry) => ImageDiff[],
48): ImageDiff[] {
49 return _.flatten(lst.map(fn), true /* only flatten one level */);
50}
51
52// > ArrayDiff.diff([1,2,3], [2,3,4]);
53// = [{ "value": [1],

Callers 1

flattenChunksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected