Search code examples
javascriptjqueryangularjslodash

Noop function that returns first argument


Is there a function that just returns the first arg? Similar to $.noop or angular.noop except that they return undefined. I am using jQuery, Angular, and lodash.


Solution

  • In angular:

    As dfsq said, in angular there is angular.identity.

    In lodash:

    In lodash there is _.identity