-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,3 @@ addons: | |
packages: | ||
- g++-4.8 | ||
- gcc-4.8 | ||
|
||
before_install: | ||
- npm install -g browserify standard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,10 +53,6 @@ npm run benchmark | |
## Test | ||
|
||
``` | ||
npm install -g standard browserify | ||
npm install | ||
npm test | ||
``` | ||
|
||
## Licence | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict' | ||
|
||
var Element = require('./Element') | ||
|
||
module.exports.isNode = function is (el) { | ||
return el instanceof Element || typeof el === 'string' | ||
} | ||
|
||
module.exports.isElement = function isElement (el) { | ||
return el instanceof Element | ||
} | ||
|
||
module.exports.isText = function isText (el) { | ||
return typeof el === 'string' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict' | ||
|
||
var vows = require('vows') | ||
var assert = require('assert') | ||
var ltx = require('..') | ||
var is = require('../lib/is') | ||
var Element = ltx.Element | ||
|
||
vows.describe('isNode').addBatch({ | ||
'isNode': { | ||
'exported correctly': function () { | ||
assert.equal(ltx.isNode, is.isNode) | ||
}, | ||
'returns true for Element': function () { | ||
assert.strictEqual(is.isNode(new Element()), true) | ||
}, | ||
'returns true for strings': function () { | ||
assert.strictEqual(is.isNode('string'), true) | ||
}, | ||
'returns false for anything else': function () { | ||
[123, null, undefined, {}, [], true].forEach(function (value) { | ||
assert.strictEqual(is.isNode(value), false) | ||
}) | ||
} | ||
}, | ||
'isElement': { | ||
'exported correctly': function () { | ||
assert.equal(ltx.isElement, is.isElement) | ||
}, | ||
'returns true for Element': function () { | ||
assert.strictEqual(is.isElement(new Element()), true) | ||
}, | ||
'returns false for anything else': function () { | ||
[123, null, undefined, {}, 'string', [], true].forEach(function (value) { | ||
assert.strictEqual(is.isElement(value), false) | ||
}) | ||
} | ||
}, | ||
'isText': { | ||
'exported correctly': function () { | ||
assert.equal(ltx.isText, is.isText) | ||
}, | ||
'returns true for strings': function () { | ||
assert.strictEqual(is.isText('foo'), true) | ||
}, | ||
'returns false for anything else': function () { | ||
[123, null, undefined, {}, Element, [], true].forEach(function (value) { | ||
assert.strictEqual(is.isText(value), false) | ||
}) | ||
} | ||
} | ||
}).export(module) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters