How to use the flatted.parse function in flatted

To help you get started, we’ve selected a few flatted examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github postmanlabs / uvm / lib / uvm / bridge.browser.js View on Github external
forwardEmits = function (e) {
            if (!(e && e.data && _.isString(e.data.__emit_uvm) && (e.data.__id_uvm === id))) { return; }

            var args;
            try { args = Flatted.parse(e.data.__emit_uvm); }
            catch (err) { return bridge.emit(ERROR, err); }
            bridge.emit.apply(bridge, args); // eslint-disable-line prefer-spread
        },
github n8n-io / n8n / packages / editor-ui / src / components / mixins / restApi.ts View on Github external
function unflattenExecutionData (fullExecutionData: IExecutionFlattedResponse): IExecutionResponse {
	// Unflatten the data
	const returnData: IExecutionResponse = {
		...fullExecutionData,
		workflowData: fullExecutionData.workflowData as IWorkflowDb,
		data: parse(fullExecutionData.data),
	};

	returnData.finished = returnData.finished ? returnData.finished : false;

	if (fullExecutionData.id) {
		returnData.id = fullExecutionData.id;
	}

	return returnData;
}
github LucasBassetti / react-simple-chatbot / tests / lib / ChatBot.spec.js View on Github external
it('should cache the steps', () => {
      const data = parse(localStorage.getItem('rsc_cache'));
      expect(data.renderedSteps.length).to.be.equal(2);
    });
  });
github mitchellhamilton / magical-types / packages / macro / runtime / src / index.tsx View on Github external
function parseStringified(val: string): MagicalNode {
  try {
    return flatted.parse(val);
  } catch (err) {
    console.error("error parsing stringified node:", val);
    throw err;
  }
}
github publiclab / Leaflet.DistortableImage / node_modules / log4js / lib / LoggingEvent.js View on Github external
static deserialise(serialised) {
    let event;
    try {
      const rehydratedEvent = flatted.parse(serialised);
      rehydratedEvent.data = rehydratedEvent.data.map((e) => {
        if (e && e.message && e.stack) {
          const fakeError = new Error(e);
          Object.keys(e).forEach((key) => { fakeError[key] = e[key]; });
          e = fakeError;
        }
        return e;
      });
      event = new LoggingEvent(
        rehydratedEvent.categoryName,
        levels.getLevel(rehydratedEvent.level.levelStr),
        rehydratedEvent.data,
        rehydratedEvent.context
      );
      event.startTime = new Date(rehydratedEvent.startTime);
      event.pid = rehydratedEvent.pid;
github nicolodavis / boardgame.io / src / client / debug / debug.js View on Github external
restoreState = () => {
    const gamestateJSON = window.localStorage.getItem('gamestate');
    if (gamestateJSON !== null) {
      const gamestate = parse(gamestateJSON);
      this.props.store.dispatch(sync(gamestate));
    }
  };
github log4js-node / log4js-node / lib / LoggingEvent.js View on Github external
static deserialise(serialised) {
    let event;
    try {
      const rehydratedEvent = flatted.parse(serialised);
      rehydratedEvent.data = rehydratedEvent.data.map((e) => {
        if (e && e.message && e.stack) {
          const fakeError = new Error(e);
          Object.keys(e).forEach((key) => { fakeError[key] = e[key]; });
          e = fakeError;
        }
        return e;
      });
      event = new LoggingEvent(
        rehydratedEvent.categoryName,
        levels.getLevel(rehydratedEvent.level.levelStr),
        rehydratedEvent.data,
        rehydratedEvent.context
      );
      event.startTime = new Date(rehydratedEvent.startTime);
      event.pid = rehydratedEvent.pid;
github n8n-io / n8n / packages / cli / src / ResponseHelper.ts View on Github external
export function unflattenExecutionData(fullExecutionData: IExecutionFlattedDb): IExecutionResponse {

	const returnData: IExecutionResponse = Object.assign({}, {
		id: fullExecutionData.id.toString(),
		workflowData: fullExecutionData.workflowData as IWorkflowDb,
		data: parse(fullExecutionData.data),
		mode: fullExecutionData.mode,
		startedAt: fullExecutionData.startedAt,
		stoppedAt: fullExecutionData.stoppedAt,
		finished: fullExecutionData.finished ? fullExecutionData.finished : false
	});

	return returnData;
}
github royriojas / flat-cache / utils.js View on Github external
readJSON: function ( filePath ) {
    return flatted.parse( fs.readFileSync( filePath, {
      encoding: 'utf8'
    } ) );
  },

flatted

A super light and fast circular JSON parser.

ISC
Latest version published 3 months ago

Package Health Score

77 / 100
Full package analysis