-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
I parsed the Markdown files, converted them to markdown, extracted the <pre><code>...</code></pre>
tags, and ran the inner code through JSHint (using Node.js, but I excluded all the warnings about missing semicolons)...
Not sure how many are valid, versus expected warnings for null type checking.
https://raw.github.com/raganwald/homoiconic/master/2012/12/combinators_1.md
var inventory = {
apples: 0,
oranges 144,
eggs: 36
};
get('oranges')(inventory)
//=> 144
Errors:
- line:3 char:11 -- Expected ':' and instead saw '144'.
- line:3 char:14 -- Expected an identifier and instead saw ','.
- line:4 char:3 -- Expected '}' to match '{' from line 1 and instead saw 'eggs'.
- line:4 char:7 -- Expected '(end)' and instead saw ':'.
function isSomething (value) {
return value != null
}
function checksForSomething (value) {
if (isSomething(value)) {
// function's true logic
}
}
Errors:
- line:2 char:16 -- Use '!==' to compare with 'null'.
function maybe (fn) {
return function () {
var i;
if (arguments.length === 0) {
return
}
else {
for (i = 0; i < arguments.length; ++i) {
if (arguments[i] == null) return arguments[i]
}
return fn.apply(this, arguments)
}
}
}
Errors:
- line:10 char:26 -- Use '===' to compare with 'null'.
function checksForSomething = maybe(function (value) {
// function's true logic
});
Errors:
- line:1 char:29 -- Expected '(' and instead saw '='.
- line:1 char:36 -- Expected ')' to match '=' from line 1 and instead saw '('.
- line:1 char:37 -- Expected '{' and instead saw 'function'.
- line:1 char:46 -- Missing name in function declaration.
- line:3 char:2 -- Expected an identifier and instead saw ')'.
- line:3 char:2 -- Expected an assignment or function call and instead saw an expression.
https://raw.github.com/raganwald/homoiconic/master/2012/12/combinators_2md
function (boundmethod) {
return boundmethod()
}
Errors:
- line:1 char:10 -- Missing name in function declaration.
function Cake () {}
extend(Cake.prototype, {
setFlavour: function (flavour) {
return this.flavour = flavour
},
setLayers: function (layers) {
return this.layers = layers
},
bake: function () {
// do some baking
}
});
var cake = new Cake();
cake.setFlavour('chocolate');
cake.setLayers(3);
cake.bake();
Errors:
- line:5 char:26 -- Did you mean to return a conditional instead of an assignment?
- line:8 char:25 -- Did you mean to return a conditional instead of an assignment?
Metadata
Metadata
Assignees
Labels
No labels