How to use the transit-js.map function in transit-js

To help you get started, we’ve selected a few transit-js 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 sweet-js / sweet-core / src / serializer.js View on Github external
if (List.isList(v.token)) {
      return [v.token, v.scopesets];
    } else {
      let t = transit.objectToMap(v.token);
      t.set("type", typeMap.indexOf(v.token.type));
      return [t, v.scopesets];
    }
  }
});
let SymbolHandler = transit.makeWriteHandler({
  tag: () => "symb",
  rep: (v) =>  [v.name]
});

let writer = transit.writer("json", {
  handlers: transit.map([
    List, ListHandler,
    Map, MapHandler,
    Syntax, SyntaxHandler,
    SymbolClass, SymbolHandler
  ])
});

function makeReader(bindings) {
  return transit.reader("json", {
    arrayBuilder: {
      init: () => List().asMutable(),
      add: (ret, val) => ret.push(val),
      finalize: (ret) => ret.asImmutable(),
      fromArray: (arr) => List(arr)
    },
    mapBuilder: {

transit-js

Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from Javascript.

Apache-2.0
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis