Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What is the node repl outputting here?

What is the node repl outputting here?


What are all these properties? Are they properties or methods or what? They look like labels. super_, fail, equal (equal to what?), deepequal, what do they mean? How do you access these properties|methods|whatever they are called? Are they specific to node?

// $ node #start the node repl 
// > assert //outputs the below
{ [Function: ok]
   { [Function: AssertionError]
      { [Function: Error]
        captureStackTrace: [Function: captureStackTrace],
        stackTraceLimit: 10 } },
  fail: [Function: fail],
  ok: [Circular],
  equal: [Function: equal],
  notEqual: [Function: notEqual],
  deepEqual: [Function: deepEqual],
  notDeepEqual: [Function: notDeepEqual],
  strictEqual: [Function: strictEqual],
  notStrictEqual: [Function: notStrictEqual],
  throws: [Function],
  doesNotThrow: [Function],
  ifError: [Function] }
Problem courtesy of: Leila Hamon


They're properties and methods of Node's assert module:

Solution courtesy of: Joe Friedl


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

What is the node repl outputting here?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription