Skip to content

Commit

Permalink
spelling: falsy
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Oct 20, 2016
1 parent 8ba46db commit 606bb9e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ <h2 id="changelog">Change Log</h2>
<tt>_.extend</tt> only iterates over the object's own properties.
</li>
<li>
Falsey guards are no longer needed in <tt>_.extend</tt> and
Falsy guards are no longer needed in <tt>_.extend</tt> and
<tt>_.defaults</tt>&mdash;if the passed in argument isn't a JavaScript
object it's just returned.
</li>
Expand Down
10 changes: 5 additions & 5 deletions test/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
assert.deepEqual(_.uniq(list, true, iterator), expected, 'uses the result of `iterator` for uniqueness comparisons (sorted case)');
assert.deepEqual(_.uniq(list, true, 'score'), expected, 'when `iterator` is a string, uses that key for comparisons (sorted case)');

assert.deepEqual(_.uniq([{0: 1}, {0: 1}, {0: 1}, {0: 2}], 0), [{0: 1}, {0: 2}], 'can use falsey pluck like iterator');
assert.deepEqual(_.uniq([{0: 1}, {0: 1}, {0: 1}, {0: 2}], 0), [{0: 1}, {0: 2}], 'can use falsy pluck like iterator');

var result = (function(){ return _.uniq(arguments); }(1, 2, 1, 3, 1, 4));
assert.deepEqual(result, [1, 2, 3, 4], 'works on an arguments object');
Expand Down Expand Up @@ -370,7 +370,7 @@

QUnit.test('lastIndexOf', function(assert) {
var numbers = [1, 0, 1];
var falsey = [void 0, '', 0, false, NaN, null, void 0];
var falsy = [void 0, '', 0, false, NaN, null, void 0];
assert.strictEqual(_.lastIndexOf(numbers, 1), 2);

numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0];
Expand Down Expand Up @@ -406,15 +406,15 @@
assert.strictEqual(_.lastIndexOf(array, '', fromIndex), -1);
});

var expected = _.map(falsey, function(value) {
var expected = _.map(falsy, function(value) {
return typeof value == 'number' ? -1 : 5;
});

var actual = _.map(falsey, function(fromIndex) {
var actual = _.map(falsy, function(fromIndex) {
return _.lastIndexOf(array, 3, fromIndex);
});

assert.deepEqual(actual, expected, 'should treat falsey `fromIndex` values, except `0` and `NaN`, as `array.length`');
assert.deepEqual(actual, expected, 'should treat falsy `fromIndex` values, except `0` and `NaN`, as `array.length`');
assert.strictEqual(_.lastIndexOf(array, 3, '1'), 5, 'should treat non-number `fromIndex` values as `array.length`');
assert.strictEqual(_.lastIndexOf(array, 3, true), 5, 'should treat non-number `fromIndex` values as `array.length`');

Expand Down
6 changes: 3 additions & 3 deletions test/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@
// Deep property access
assert.strictEqual(_.property('a')({a: 1}), 1, 'can get a direct property');
assert.strictEqual(_.property(['a', 'b'])({a: {b: 2}}), 2, 'can get a nested property');
assert.strictEqual(_.property(['a'])({a: false}), false, 'can fetch falsey values');
assert.strictEqual(_.property(['a'])({a: false}), false, 'can fetch falsy values');
assert.strictEqual(_.property(['x', 'y'])({x: {y: null}}), null, 'can fetch null values deeply');
assert.strictEqual(_.property(['x', 'y'])({x: null}), void 0, 'does not crash on property access of nested non-objects');
assert.strictEqual(_.property([])({x: 'y'}), void 0, 'returns `undefined` for a path that is an empty array');
Expand Down Expand Up @@ -988,7 +988,7 @@

//null edge cases
var oCon = {constructor: Object};
assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false, true], 'doesnt falsey match constructor on undefined/null');
assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false, true], 'doesnt falsy match constructor on undefined/null');
});

QUnit.test('matcher', function(assert) {
Expand Down Expand Up @@ -1045,7 +1045,7 @@

//null edge cases
var oCon = _.matcher({constructor: Object});
assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsey match constructor on undefined/null');
assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsy match constructor on undefined/null');
});

QUnit.test('matches', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion test/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
assert.strictEqual(_.result({a: 1}, 'b', 2), 2, 'uses the fallback value when property is missing');
assert.strictEqual(_.result({a: 1}, ['b', 'c'], 2), 2, 'uses the fallback value when any property is missing');
assert.strictEqual(_.result({a: void 0}, ['a'], 1), 1, 'uses the fallback when value is undefined');
assert.strictEqual(_.result({a: false}, ['a'], 'foo'), false, 'can fetch falsey values');
assert.strictEqual(_.result({a: false}, ['a'], 'foo'), false, 'can fetch falsy values');

assert.strictEqual(_.result({a: func}, 'a'), 'f', 'can get a direct method');
assert.strictEqual(_.result({a: {b: func}}, ['a', 'b']), 'f', 'can get a nested method');
Expand Down

0 comments on commit 606bb9e

Please sign in to comment.