MCPcopy Create free account
hub / github.com/decaporg/decap-cms / createCursorStore

Function createCursorStore

packages/decap-cms-lib-util/src/Cursor.ts:63–76  ·  view source on GitHub ↗
(...args: {}[])

Source from the content-addressed store, hash-verified

61 - (actions: <array/List>, data: <object/Map>, meta: <optional object/Map>) -> cursor
62*/
63function createCursorStore(...args: {}[]) {
64 const { actions, data, meta } =
65 args.length === 1
66 ? jsToMap(args[0]).toObject()
67 : { actions: args[0], data: args[1], meta: args[2] };
68 return Map({
69 // actions are a Set, rather than a List, to ensure an efficient .has
70 actions: Set(actions),
71
72 // data and meta are Maps
73 data: jsToMap(data),
74 meta: jsToMap(meta).update(filterUnknownMetaKeys),
75 }) as CursorStore;
76}
77
78function hasAction(store: CursorStore, action: string) {
79 return store.hasIn(['actions', action]);

Callers 1

constructorMethod · 0.85

Calls 2

jsToMapFunction · 0.85
MapInterface · 0.85

Tested by

no test coverage detected