scriptie-talkie
Makes your code tell you what the intermediate results are when executing a script.
Last updated 7 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install scriptie-talkie 
SYNC missed versions from official npm registry.

scriptie-talkie build status

Makes your code tell you what the intermediate results are when executing a script.

var a = 3;

a = a + 1;
a++;

var b = 2;
b = b + a;

changing-var

Installation

npm install scriptie-talkie

(Add -g to install as global command line tool)

Command Line Tool

scriptie-talkie path/to/script.js

Prints the highlighted code of script.js with intermediate results.

API

scriptie-talkie(script, scriptPath, opts)

/**
 * Evaluates all snippets in the given script and calls opts.write with the result.
 * 
 * @name exports
 * @function
 * @param script {String} The String to evaluate.
 * @param scriptPath {String} The path to the script (important to resolve require statements)
 * @param opts {Object} { 
 *    toLines: function(code:String) -> [String] - to split script into lines -- uses cardinal syntax highlighter by default
 *    write  : function(result:String) - to be called to write the result -- default console.log
 */
var talk    =  require('scriptie-talkie')
  , fs      =  require('fs');
  ,  script =  fs.readFileSync(scriptPath, 'utf-8');

talk(script, scriptPath, { write: console.error });

Roadmap

  • version that works in the browser
  • integrate with replpad

More Examples

var o = { a: 1 };

o.a = 2;

objects-simple

var a = 3;

a + b;

var b = 2;

console.log(b.hello());

error

var a = 1;
foo();

function foo () {
  return a++;
}
foo() + 1;

function-call-before-declaration.png

Current Tags

  • 0.4.7                                ...           latest (7 years ago)

14 Versions

  • 0.4.7                                ...           7 years ago
  • 0.4.6                                ...           8 years ago
  • 0.4.5                                ...           8 years ago
  • 0.4.4                                ...           8 years ago
  • 0.4.3                                ...           8 years ago
  • 0.4.2                                ...           8 years ago
  • 0.4.1                                ...           8 years ago
  • 0.4.0                                ...           8 years ago
  • 0.3.1                                ...           8 years ago
  • 0.3.0                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (10)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |