Last Updated: February 25, 2016
·
1.676K
· denizac

jsig - precise & concise JavaScript signature notation

Sure, JavaScript is a dynamically typed languages, but I've found having an explicit notation to be the fastest way to communicate to another developer how to use a module I've written.

I wrote up jsig - JavaScript signature notation - to formalize the notation we've been using in our codebase at work and in the documentation for my npm modules.

Here's what it looks like:

 // ({stderr: ReadStream, stdout: ReadStream }) => void
function log(stdio) {
  file = require('fs').createWriteStream('io.log')
  stdio.stdout.pipe(file)
  stdio.stderr.pipe(file)
}

jsig helps write clear, accurate function comments and documentation with fewer words and less ambiguity.

Have feedback? Please contribute and open an issue on the GitHub repo.

You can see jsig in action in the readme for minq

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside