/
toolkit_v0.019.js
39 lines (32 loc) · 971 Bytes
/
toolkit_v0.019.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Import Lodash as an ES6 module from a CDN
const faker = require ('https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js');
//check that faker imported as part of this module
function checkFaker(){
return faker.simpleFaker.date.future(3)
}
// Define your functions and variables
function selectOptions(data, label, value) {
return _.orderBy(
_.uniqBy(data.map(obj => ({
label: _.get(obj, label),
value: _.get(obj, value)
})).filter(obj => !!obj.label && !!obj.value), o => o.label), 'label');
}
// New function that uses Lodash
function myFunctionWithLodash(arr) {
// Example Lodash operation - Sort the array
return _.sortBy(arr);
}
const myVariable1 = 'Value 1';
const myVariable2 = 42;
// Export the functions and variables as a toolkit object
const toolkit = {
faker,
checkFaker,
selectOptions,
myFunctionWithLodash, // Add the new function
myVariable1,
myVariable2
};
export { toolkit };
export default {}