How to use the flatted.stringify 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 samdenty / gqless / packages / logger / src / Logger.ts View on Github external
console.error(error)
    } else {
      console.log(...format(['Result', headerStyles]), response)
    }

    // Accessors
    console.groupCollapsed(...format(['Accessors', headerStyles]))
    for (const accessor of accessors) {
      console.log(accessor)
    }
    console.groupEnd()

    // Cache
    console.log(
      ...format(['Cache snapshot', headerStyles]),
      parse(stringify(this.client.cache))
    )

    console.groupEnd()
  }) as PluginMethod<'onFetch'>
}
github log4js-node / log4js-node / lib / LoggingEvent.js View on Github external
serialise() {
    const logData = this.data.map((e) => {
      // JSON.stringify(new Error('test')) returns {}, which is not really useful for us.
      // The following allows us to serialize errors correctly.
      if (e && e.message && e.stack) {
        e = Object.assign({ message: e.message, stack: e.stack }, e);
      }
      return e;
    });
    this.data = logData;
    return flatted.stringify(this);
  }
github publiclab / Leaflet.DistortableImage / node_modules / log4js / lib / LoggingEvent.js View on Github external
serialise() {
    const logData = this.data.map((e) => {
      // JSON.stringify(new Error('test')) returns {}, which is not really useful for us.
      // The following allows us to serialize errors correctly.
      if (e && e.message && e.stack) {
        e = Object.assign({ message: e.message, stack: e.stack }, e);
      }
      return e;
    });
    this.data = logData;
    return flatted.stringify(this);
  }
github LucasBassetti / react-simple-chatbot / tests / lib / schema.spec.js View on Github external
it('should delete a invalid key', () => {
    const step = schema.parse({
      id: '1',
      message: 'test',
      test: 'test',
    });
    const resultStep = stringify({ id: '1', message: 'test' });
    expect(stringify(step)).to.be.equal(resultStep);
  });
github TypeScriptToLua / TypeScriptToLua / test / test_thread.ts View on Github external
testRunner.onTestComplete(result => {
        if (result.outcome === TestOutcome.Fail) {
            if (result.error instanceof MatchError) {
                console.log(`Test ${result.testFixture.description}, ${result.test.key}(${flatted.stringify(result.testCase.caseArguments)}) Failed!`);
                console.log(" ---\n" +
                '   message: "' +
                result.error.message +
                '"\n' +
                "   severity: fail\n" +
                "   data:\n" +
                "     got: " +
                result.error.actual +
                "\n" +
                "     expect: " +
                result.error.expected +
                "\n");
            }
            failedTestCount++;
        }
        testCount++;
github LucasBassetti / react-simple-chatbot / tests / lib / schema.spec.js View on Github external
it('should throw a key required error', () => {
    const step = { message: 'test' };
    expect(() => {
      schema.parse(step);
    }).to.throw(Error, `Key 'id' is required in step ${stringify(step)}`);
  });
github postmanlabs / uvm / lib / uvm / bridge.browser.js View on Github external
bridge._dispatch = function () {
                if (!iframe) {
                    return bridge.emit(ERROR,
                        new Error('uvm: unable to dispatch "' + arguments[0] + '" post disconnection.'));
                }

                iframe.contentWindow.postMessage({
                    __emit_uvm: Flatted.stringify(Array.prototype.slice.call(arguments)),
                    __id_uvm: id
                }, TARGET_ALL);
            };
github royriojas / flat-cache / utils.js View on Github external
writeJSON: function ( filePath, data ) {
    write.sync( filePath, flatted.stringify( data ) );
  }
};
github sanity-io / gatsby-source-sanity / src / util / getExampleValues.ts View on Github external
function hash(content: any) {
  return crypto
    .createHash('md5')
    .update(stringify(content))
    .digest('hex')
}
github airyrooms / maleo.js / packages / Maleo.js / src / render / _document.tsx View on Github external
render() {
    const { preloadScripts, initialProps } = this.context;

    return (

flatted

A super light and fast circular JSON parser.

ISC
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis