Skip to content

Commit dc4ceee

Browse files
committed
Wrap/re-export common lodash functionality for easy consumption in our projects
1 parent 717f58f commit dc4ceee

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/utilities/collection-utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { List } from "immutable";
2+
import _ from "lodash";
23

34
// -----------------------------------------------------------------------------------------
45
// #region Private Methods
@@ -180,12 +181,18 @@ const _replaceElementAt = <T>(
180181
// -----------------------------------------------------------------------------------------
181182

182183
export const CollectionUtils = {
184+
difference: _.difference,
183185
equalsBy: _equalsBy,
186+
first: _.head,
187+
flattenDeep: _.flattenDeep,
184188
hasValues: _hasValues,
185189
isEmpty: _isEmpty,
186190
isNotEmpty: _isNotEmpty,
187191
length: _length,
188192
replaceElementAt: _replaceElementAt,
193+
sample: _.sample,
194+
sampleSize: _.sampleSize,
195+
take: _.take,
189196
};
190197

191198
// #endregion Exports

src/utilities/core-utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CollectionUtils } from "./collection-utils";
2+
import _ from "lodash";
23

34
// -----------------------------------------------------------------------------------------
45
// #region Private Methods
@@ -84,10 +85,16 @@ const _timer = (name: string) => {
8485
// -----------------------------------------------------------------------------------------
8586

8687
export const CoreUtils = {
88+
bindAll: _.bindAll,
89+
curry: _.curry,
90+
memoize: _.memoize,
8791
numericEnumToPojo: _numericEnumToPojo,
8892
objectToArray: _objectToArray,
93+
range: _.range,
8994
sleep: _sleep,
95+
throttle: _.throttle,
9096
timer: _timer,
97+
times: _.times,
9198
};
9299

93100
// #endregion Exports

src/utilities/string-utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,23 @@ const truncateRight = (value: string, truncateAtPos: number): string => {
6767
// -----------------------------------------------------------------------------------------
6868

6969
const StringUtils = {
70+
camelCase: _.camelCase,
71+
capitalize: _.capitalize,
7072
filename,
7173
hasValue,
7274
isEmpty,
7375
isValidEmail,
76+
lowerFirst: _.lowerFirst,
77+
pad: _.pad,
78+
padEnd: _.padEnd,
79+
padStart: _.padStart,
80+
repeat: _.repeat,
81+
snakeCase: _.snakeCase,
82+
startCase: _.startCase,
83+
template: _.template,
7484
truncateRight,
85+
upperFirst: _.upperFirst,
86+
words: _.words,
7587
};
7688

7789
export default StringUtils;

0 commit comments

Comments
 (0)