Skip to main content
Module

x/rambda/source/times.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import assert from 'assert'
import {identity} from './identity'import {times} from './times'
test('happy', () => { const result = times(identity, 5)
expect(result).toEqual([0, 1, 2, 3, 4])})
test('with bad input', () => { assert.throws(() => { times(3)('cheers!') }, RangeError) assert.throws(() => { times(identity, -1) }, RangeError)})
test('curry', () => { const result = times(identity)(5)
expect(result).toEqual([0, 1, 2, 3, 4])})