ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
18 lines (17 loc) • 393 B
JavaScript
import { clone, thunkify } from 'ramda';
/**
* Returns a function that creates new instances of whatever argument
* is passed in each time it's called.
*
* @func
* @private
* @example
*
* const alwaysNewArray = alwaysNew([]);
* const a = alwaysNewArray();
* const b = alwaysNewArray();
* // a !== b
*
*/
var alwaysNew = /*#__PURE__*/thunkify(clone);
export default alwaysNew;