UNPKG

@eluvio/elv-js-helpers

Version:

A collection of Javascript helper functions used by several Eluvio libraries.

15 lines (13 loc) 634 B
// AUTO-GENERATED TEST - DO NOT MODIFY, CHANGES WILL BE OVERWRITTEN DURING BUILD 'use strict' const TH = require('../../../test-helpers') const mapWithIndex = TH.requireSrcFile('Functional/mapWithIndex') describe('mapWithIndex JSDoc example', () => { it('should execute correctly as described', () => { 'use strict' mapWithIndex((e, i) => `${e}-${i}`, ['a', 'b', 'c']).should.eql(['a-0', 'b-1', 'c-2']) // function is curried: call with just 1 arg to obtain a narrower function const addIndexSuffix = mapWithIndex((e, i) => `${e}-${i}`) addIndexSuffix(['a', 'b', 'c']).should.eql(['a-0', 'b-1', 'c-2']) }) })