support `false` as a browser field value, added examples #14

Merged
merged 6 commits into from Mar 28, 2013

Conversation

Projects
None yet
2 participants
Collaborator

substack commented Mar 28, 2013

false is really nice as a browser field value because it can serve as a handy ignore mechanism.

For instance for some code like this:

if (typeof window === 'undefined') {
    var Canvas = require('canvas');
}
else {
    // browser already has Canvas defined
}

you can just "canvas": false in your package.json browser field:

{
  "name": "skip",
  "version": "0.0.0",
  "browser": {
    "canvas": false
  }
}
Collaborator

substack commented Mar 28, 2013

updated the example to use tar instead:

var tar = require('tar');

exports.add = function (a, b) {
    return a + b;
};

exports.parse = function () {
    return tar.Parse();
};

defunctzombie added a commit that referenced this pull request Mar 28, 2013

Merge pull request #14 from substack/false
support `false` as a browser field value, added examples

@defunctzombie defunctzombie merged commit a163827 into defunctzombie:master Mar 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment