Skip to content

Commit

Permalink
Merge pull request jashkenas#1507 from rck109d/master
Browse files Browse the repository at this point in the history
documentation: improved clarity with variable/property distinction
  • Loading branch information
akre54 committed Oct 9, 2014
2 parents 44a47fb + 96e4d18 commit 23285b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,8 @@ <h2 id="objects">Object Functions</h2>
property of any passed-in object.
</p>
<pre>
var moe = {name: 'moe'};
'moe' === _.property('name')(moe);
var stooge = {name: 'moe'};
'moe' === _.property('name')(stooge);
=&gt; true</pre>

<p id="matches">
Expand All @@ -1448,11 +1448,11 @@ <h2 id="objects">Object Functions</h2>
if they should be considered equal.
</p>
<pre>
var moe = {name: 'moe', luckyNumbers: [13, 27, 34]};
var clone = {name: 'moe', luckyNumbers: [13, 27, 34]};
moe == clone;
var stooge = {name: 'moe', luckyNumbers: [13, 27, 34]};
var clone = {name: 'moe', luckyNumbers: [13, 27, 34]};
stooge == clone;
=&gt; false
_.isEqual(moe, clone);
_.isEqual(stooge, clone);
=&gt; true
</pre>

Expand Down Expand Up @@ -1649,8 +1649,8 @@ <h2 id="utility">Utility Functions</h2>
a default iteratee.
</p>
<pre>
var moe = {name: 'moe'};
moe === _.identity(moe);
var stooge = {name: 'moe'};
stooge === _.identity(stooge);
=&gt; true
</pre>

Expand All @@ -1661,8 +1661,8 @@ <h2 id="utility">Utility Functions</h2>
argument of <tt>_.constant</tt>.
</p>
<pre>
var moe = {name: 'moe'};
moe === _.constant(moe)();
var stooge = {name: 'moe'};
stooge === _.constant(stooge)();
=&gt; true</pre>

<p id="noop">
Expand Down
12 changes: 6 additions & 6 deletions test/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
});

test('identity', function() {
var moe = {name : 'moe'};
equal(_.identity(moe), moe, 'moe is the same as his identity');
var stooge = {name : 'moe'};
equal(_.identity(stooge), stooge, 'stooge is the same as his identity');
});

test('constant', function() {
var moe = {name : 'moe'};
equal(_.constant(moe)(), moe, 'should create a function that returns moe');
var stooge = {name : 'moe'};
equal(_.constant(stooge)(), stooge, 'should create a function that returns stooge');
});

test('noop', function() {
strictEqual(_.noop('curly', 'larry', 'moe'), undefined, 'should always return undefined');
});

test('property', function() {
var moe = {name : 'moe'};
equal(_.property('name')(moe), 'moe', 'should return the property with the given name');
var stooge = {name : 'moe'};
equal(_.property('name')(stooge), 'moe', 'should return the property with the given name');
equal(_.property('name')(null), undefined, 'should return undefined for null values');
equal(_.property('name')(undefined), undefined, 'should return undefined for undefined values');
});
Expand Down

0 comments on commit 23285b6

Please sign in to comment.