Joined November 2014
·

Nicolai Kamenzky

Tallahassee
·
·

Posted to How do you check undefined ? over 1 year ago

I heard that undefined is immutable in EcmaScript 5. Turns out it actually means something else than I expected: https://gist.github.com/mzgol/5356300

BTW, lodash.js uses solution 1.

If you use Request-Promise you get the same request+promise power with even less lines of code:

var rp = require('request-promise');

var url = "https://raw.github.com/mikeal/request/master/package.json";

rp({ url:url, json:true })
  .then(function (data) {
    console.log("%s@%s: %s", data.name, data.version, data.description);
  })
  .catch(function (reason) {
    console.error("%s; %s", reason.error.message, reason.options.url);
    console.log("%j", reason.response.statusCode);
  });
Achievements
1 Karma
0 Total ProTip Views
Interests & Skills