writer.js

0.1.0 • Public • Published

writer.js

Just a dumb little JS library providing an abstraction around the concept of writing text to something. Could be stdout, could be a file (not implemented yet), could be a string.

Loosely based off similar concepts in the worlds of Java, .NET (e.g. TextWriter) and probably elsewhere.

Example

var writer = require('writer');

var stringWriter = new writer.StringWriter();
stringWriter.write('foo');
stringWriter.write('bar');
stringWriter.write('baz');

stringWriter.toString();
// => 'foobarbaz'

var consoleWriter = new writer.ConsoleWriter();
consoleWriter.write('hey!');
consoleWriter.write('look!');

Make sense? Makes sense to me, anyway.

Readme

Keywords

Package Sidebar

Install

npm i writer.js

Weekly Downloads

11

Version

0.1.0

License

MIT

Last publish

Collaborators

  • dtao