simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

any_type.js (407B)


      1 var typed = require('../typed-function');
      2 
      3 // create a typed function with an any type argument
      4 var log = typed({
      5   'string, any': function (event, data) {
      6     console.log('event: ' + event + ', data: ' + JSON.stringify(data));
      7   }
      8 });
      9 
     10 // use the typed function
     11 log('start', {count: 2});   // output: 'event: start, data: {"count":2}'
     12 log('end', 'success!');     // output: 'event: start, data: "success!"