mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Add utility function getValue.
This commit is contained in:
@@ -873,6 +873,12 @@
|
||||
return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
|
||||
};
|
||||
|
||||
// Get a value from an object as a property or as a function.
|
||||
_.getValue = function(object, prop) {
|
||||
if (object == null) return null;
|
||||
return _.isFunction(object[prop]) ? object[prop]() : object[prop];
|
||||
};
|
||||
|
||||
// Add your own custom functions to the Underscore object, ensuring that
|
||||
// they're correctly added to the OOP wrapper as well.
|
||||
_.mixin = function(obj) {
|
||||
|
||||
Reference in New Issue
Block a user