How to use the once function from ramda

Find comprehensive JavaScript ramda.once code examples handpicked from public code repositorys.

53
54
55
56
57
58
59
60
61
62
63
    alg: global.basicConfig.keyAlg,
    kid: global.basicConfig.keyId
  }
}))


const secretKey = R.once(() => {
  const salt = fs.readFileSync(config.get('saltFile'), 'utf8')
  return /=\s*(\S+)/.exec(salt)[1]
})

fork icon16
star icon5
watch icon0

+ 8 other calls in file

3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
 * @sig (a... -> b) -> (a... -> b)
 * @param {Function} fn The function to wrap in a call-only-once wrapper.
 * @return {Function} The wrapped function.
 * @example
 *
 *      var addOneOnce = R.once(x => x + 1);
 *      addOneOnce(10); //=> 11
 *      addOneOnce(addOneOnce(50)); //=> 11
 */
var once = _curry1(function once(fn) {
fork icon0
star icon0
watch icon0

+ 17 other calls in file

10663
10664
10665
10666
10667
10668
10669
10670
10671
* @sig (a... -> b) -> (a... -> b)
* @param {Function} fn The function to wrap in a call-only-once wrapper.
* @return {Function} The wrapped function.
* @example
*
*      const addOneOnce = R.once(x => x + 1);
*      addOneOnce(10); //=> 11
*      addOneOnce(addOneOnce(50)); //=> 11
*/
fork icon0
star icon0
watch icon2

+ 3 other calls in file

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)