From 77c3bde5e3d906cbc86de991bbe6c9818e42669a Mon Sep 17 00:00:00 2001 From: Lareb Khalil Syed Date: Wed, 22 Jun 2022 02:32:17 +0500 Subject: [PATCH 1/2] Update lodash_idl.ts --- src/lodash_idl.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lodash_idl.ts b/src/lodash_idl.ts index fe79aa9..b7ed3e5 100644 --- a/src/lodash_idl.ts +++ b/src/lodash_idl.ts @@ -59,6 +59,7 @@ const lodashProps = ` get: Path mapValues: Path + compute: Path # Creates an array of values corresponding to paths of object. at: [Path!] From 8e8fdf7544b6660218be8a1fcf757e9223e9a981 Mon Sep 17 00:00:00 2001 From: Lareb Khalil Syed Date: Wed, 22 Jun 2022 02:37:33 +0500 Subject: [PATCH 2/2] Update transformations.ts --- src/transformations.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/transformations.ts b/src/transformations.ts index 7093010..76e7020 100644 --- a/src/transformations.ts +++ b/src/transformations.ts @@ -30,6 +30,7 @@ import maxBy from 'lodash-es/maxBy'; import meanBy from 'lodash-es/meanBy'; import sumBy from 'lodash-es/sumBy'; import join from 'lodash-es/join'; +import expression from 'lodash-es/join'; import get from 'lodash-es/get'; import mapValues from 'lodash-es/mapValues'; @@ -40,10 +41,17 @@ import invertBy from 'lodash-es/invertBy'; import keys from 'lodash-es/keys'; import values from 'lodash-es/values'; +const compute = function(scope, expression) { + return _.template("<%= " + expression + " %>")(scope); +} + const transformations = { Array: { each: (array, arg) => { return map(array, item => applyTransformations(item, arg)); + }, + mapCompute: (array, arg) => { + return compute(array, item => applyTransformations(item, arg)); }, map, keyBy, @@ -84,6 +92,7 @@ const transformations = { invertBy, keys, values, + compute, }, Number: { lt,