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

Function createCursorStore

packages/decap-cms-lib-util/src/Cursor.ts:63–77  ·  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 ) as { actions?: Iterable<string>; data?: {}; meta?: {} };
69 return Map({
70 // actions are a Set, rather than a List, to ensure an efficient .has
71 actions: Set(actions),
72
73 // data and meta are Maps
74 data: jsToMap(data),
75 meta: jsToMap(meta).update(filterUnknownMetaKeys),
76 }) as CursorStore;
77}
78
79function hasAction(store: CursorStore, action: string) {
80 return store.hasIn(['actions', action]);

Callers 1

constructorMethod · 0.85

Calls 2

jsToMapFunction · 0.85
MapInterface · 0.85

Tested by

no test coverage detected