             return
         v = []
         for x in patches
-            if x? and not @_times[x.time - 0] or (x.snapshot? and not @_snapshot_times[x.time - 0])
+            if x? and (not @_times[x.time - 0] or (x.snapshot? and not @_snapshot_times[x.time - 0]))
                 v.push(x)
                 @_times[x.time - 0] = true
                 if x.snapshot?

    # the most recent snapshot. This function returns the time at which we
    # must make a snapshot.
    time_of_unmade_periodic_snapshot: (interval) =>
        if @_patches.length < 2*interval
            # definitely no need to make a snapshot
            return
        n = @_patches.length - 1
        for i in [n .. 0]
            if @_patches[i].snapshot?
                # this is the most recent snapshot
                if i + interval + interval <= n
                    # far enough back in time that we make a snapshot
                    return @_patches[i + interval].time
                else
                    # recent snapshot is too recent
                    return


###
The SyncDoc class enables synchronized editing of a document that can be represented by a string.

    value: (time) =>
        if time? and not misc.is_date(time)
            throw Error("time must be a date")
        cache_time = 0
        if not time? and @_cache?
            value = @_cache.value
            for x in @_patches.slice(@_cache.start, @_patches.length)
                value = apply_patch(x.patch, value)[0]
                cache_time = x.patch.time
        else
            # find the newest snapshot at a time that is <=time
            value = '' # default in case no snapshots
            start = 0
            if @_patches.length > 0
                for i in [@_patches.length-1 .. 0]
                    if (not time? or @_patches[i].time - time <= 0) and @_patches[i].snapshot?
                        value = @_patches[i].snapshot
                        start = i + 1
                        break
            for i in [start...@_patches.length]
