01332ebead
The rationale is this: the spec string describes the expected behavior unconditionally. The code examples, on the other hand, set up an expectation that is tested with the call to the expect method. The code examples can violate the expectation, but the spec string does not. The value of the spec string is as clearly as possible describing the behavior. Including “should” in that description adds no value. (From http://rubyspec.org/style_guide/)
26 lines
553 B
JavaScript
26 lines
553 B
JavaScript
function noSpecs() {
|
|
xit('has no specs');
|
|
}
|
|
|
|
if (!Array.prototype.map) {
|
|
Array.prototype.map = function(fun /*, thisp */) {
|
|
"use strict";
|
|
|
|
if (this === void 0 || this === null)
|
|
throw new TypeError();
|
|
|
|
var t = Object(this);
|
|
var len = t.length >>> 0;
|
|
if (typeof fun !== "function")
|
|
throw new TypeError();
|
|
|
|
var res = new Array(len);
|
|
var thisp = arguments[1];
|
|
for (var i = 0; i < len; i++) {
|
|
if (i in t)
|
|
res[i] = fun.call(thisp, t[i], i, t);
|
|
}
|
|
|
|
return res;
|
|
};
|
|
} |