Sha256: c5b205c8f73c9826adafe3a30e1ac41312c03c1d61e031ad89e12fafb4304d28
Contents?: true
Size: 452 Bytes
Versions: 135
Compression:
Stored size: 452 Bytes
Contents
var test = require('tap').test var once = require('../once.js') test('once', function (t) { var f = 0 function fn (g) { t.equal(f, 0) f ++ return f + g + this } fn.ownProperty = {} var foo = once(fn) t.equal(fn.ownProperty, foo.ownProperty) t.notOk(foo.called) for (var i = 0; i < 1E3; i++) { t.same(f, i === 0 ? 0 : 1) var g = foo.call(1, 1) t.ok(foo.called) t.same(g, 3) t.same(f, 1) } t.end() })
Version data entries
135 entries across 68 versions & 9 rubygems