Skip to content
Myr

Fixed Collection#clone()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 4817007 · Browse files · 3 files+23 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+23 added−1 removed

  • tests:+2 added−0 removed
  • other:+21 added−1 removed

3 files+23 added−1 removed

modified:lib/express/collection.js+7 added-1 removed
12// Express - Collection - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34/**5 * Module dependencies.6 */7 8var utils = require('express/utils')910/**11 * Throw $break in order to stop iteration.12 */1314$break = '__break__'
493 unmodified lines
508 * @api public509 */510 511 clone: function() {506 return this.merge({})512 return $(utils.clone(this.arr))513 },514 515 /**516 * Return the value of a random index.
33 unmodified lines
modified:lib/express/utils.js+14 added
modified:spec/spec.collection.js+2 added
382 unmodified lines
383 var a = $([1,2,3])384 var b = a.clone()385 a.should.not.equal b386 b.arr.should.eql [1,2,3]387 b.arr.should.not.equal a.arr388 end389 390 it 'should clone an object collection'391 var a = $({ foo: 'bar' })392 var b = a.clone()393 a.should.not.equal b394 b.arr.should.eql { foo: 'bar' }395 b.arr.should.not.equal a.arr396 end397 end398 399 describe '#sample()'
75 unmodified lines