function createMachine({ states, context, initial }, { actions }) {
  let currentState = initial;
  let currentContext = context;

  return {
    send: (event) => {
      const currentStateOn = states[currentState].on;
      const transitionConfig = currentStateOn && currentStateOn[event.type];

      if (transitionConfig) {
        currentState = transitionConfig.target;
        if (transitionConfig.actions) {
          transitionConfig.actions.forEach((actName) => {
            const actionImpl = actions[actName];

            const nextContextValue =
              actionImpl && actionImpl(currentContext, event);

            if (nextContextValue) {
              currentContext = {
                ...currentContext,
                ...nextContextValue,
              };
            }
          });
        }
      }
    },
  };
}
A simplified `createMachine` from `@xstate/fsm` with the following differences:

 - the returned machine is technically a "service". No `interpret(machine).start()` is needed.
 - the state definition only support `on` and target must be declared with { target: 'nextState', actions: [] } explicitly.
 - event passed to `send` must be an object with `type` property.
 - actions implementation will be [assign action](https://xstate.js.org/docs/guides/context.html#assign-action) if you return any value.
 Do not return anything if you just want to invoke side effect.

The goal of this custom function is to avoid installing the entire `'xstate/fsm'` package, while enabling modeling using
state machine. You can copy the first parameter into the editor at https://stately.ai/viz to visualize the state machine.

@param {Options} options
@param {Implementation} implementation