From 6ad71902c3cbc825dbd4220fc46a756696b22ea0 Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Tue, 28 Nov 2017 00:30:26 +0530 Subject: [PATCH] feat(globals): add orderBy method --- src/Globals/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Globals/index.js b/src/Globals/index.js index 044fd64..3b4ff5a 100644 --- a/src/Globals/index.js +++ b/src/Globals/index.js @@ -289,6 +289,19 @@ const urlEncode = function (url) { return encodeurl(url) } +/** + * Order an array using a given property. + * + * @method orderBy + * + * @param {Array} collection + * @param {String|Array} property + * @param {String|Array} order + */ +const orderBy = function (collection, property, order) { + return _.orderBy(collection, property, order) +} + module.exports = { range, batch, @@ -307,5 +320,6 @@ module.exports = { capitalize, truncate, toAnchor, - urlEncode + urlEncode, + orderBy }