-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmutamax.js
649 lines (587 loc) · 22.9 KB
/
mutamax.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
/*
* Data transformations typically occurring while processing server requests/responses.
* */
'use strict'
const {
ERROR_MESSAGE_MAP_DATA_INVALID, ERROR_MESSAGE_MAP_ITERATEE_INVALID,
ERROR_MESSAGE_MERGE_DATA_INVALID, ERROR_MESSAGE_MERGE_PROPS_INVALID,
ERROR_MESSAGE_ADD_DATA_INVALID, ERROR_MESSAGE_ADD_PROPS_INVALID,
ERROR_MESSAGE_DELETE_DATA_INVALID, ERROR_MESSAGE_DELETE_PROPS_INVALID,
ERROR_MESSAGE_RENAME_DATA_INVALID, ERROR_MESSAGE_RENAME_PROPS_INVALID,
ERROR_MESSAGE_LIMIT_TO_DATA_INVALID, ERROR_MESSAGE_LIMIT_TO_PROPS_INVALID,
ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_DATA_INVALID,
ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_PROPS_INVALID,
ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_PROPS_PROPERTY_INVALID,
ERROR_MESSAGE_REPLACE_ALL_VALUES_IF_EQUALS_DATA_INVALID,
ERROR_MESSAGE_REPLACE_ALL_VALUES_IF_EQUALS_PROPS_INVALID,
ERROR_MESSAGE_CAPITALIZE_FIRST_CHAR_DATA_INVALID,
ERROR_MESSAGE_DECAPITALIZE_FIRST_CHAR_DATA_INVALID,
VERSION
} = require('./constants.js')
const mutamax = (function () {
const Public = {}
const Private = {
isRenameReverseOrder: false
}
/**
* Transforms `data` key-value pares by running each element of `data` through `iteratee`.
* The iteratee is invoked with two arguments: key and value.
* The expected output of iteratee is: {newKey: 'myNewKey', newValue: 'my-new-value'}.
* `newKey` and/or `newValue` can be the same as before or transformed.
*
* @since 0.1.0
* @param {object|Array<object>} data The object/collection to iterate over.
* @param {Function} iteratee The iteratee to transform key/value pares. Expected output of iteratee is: {newKey: 'myNewKey', newValue: 'my-new-value'}
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
* mutamax.map({a: 1, b: 'bats'}, function (key, value) {
* let newValue
*
* if (typeof value == 'number') {
* newValue = value.toString()
* } else {
* newValue = value
* }
*
* return {newKey: key.toUpperCase(), newValue: newValue}
* })
* // => {A: '1', B: 'bats'}
*
* mutamax.map([{a: 1, b: 'bats'}, {c: 'color'}], function (key, value) {
* let newKey, newValue
*
* if (typeof value == 'number') {
* newValue = value.toString()
* } else if (typeof value == 'string') {
* newValue = value.toUpperCase()
* }
*
* return {newKey: key, newValue: newValue}
* })
* // => [{a: '1', b: 'BATS'}, {c: 'COLOR'}]
*/
Public.map = function (data, iteratee) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_MAP_DATA_INVALID)
}
if (Object.prototype.toString.call(iteratee) !== '[object Function]') {
throw new TypeError(ERROR_MESSAGE_MAP_ITERATEE_INVALID)
}
if (this.isObject(data)) {
Private.object.map(data, iteratee)
} else if (this.isArray(data)) {
Private.collection.map(data, iteratee)
}
}
/**
* Merge properties of an object into another object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection into which new properties will be merged.
* @param {object} props The object defining merged properties and their values.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.merge({a: 1, b: 'bats'}, {a: 2, hello: 'all'})
* // => {a: 2, b: 'bats', hello: 'all'}
*
* mutamax.merge([{a: 1, b: 'bats'}, {c: 'color'}], {a: 2, hello: 'all'})
* // => [{a: 2, b: 'bats', hello: 'all'}, {a: 2, c: 'color', hello: 'all'}]
*
*/
Public.merge = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_MERGE_DATA_INVALID)
}
if (!this.isObject(props)) {
throw new TypeError(ERROR_MESSAGE_MERGE_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.merge(data, props, true)
} else if (this.isArray(data)) {
Private.collection.merge(data, props, true)
}
}
/**
* Add non-existing properties of an object to another object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection to which new properties will be added.
* @param {object} props The object defining new properties and their values.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.add({a: 1, b: 'bats'}, {a: 2, hello: 'all'})
* // => {a: 1, b: 'bats', hello: 'all'}
*
* mutamax.add([{a: 1, b: 'bats'}, {c: 'color'}], {a: 2, hello: 'all'})
* // => [{a: 1, b: 'bats', hello: 'all'}, {a: 2, c: 'color', hello: 'all'}]
*
*/
Public.add = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_ADD_DATA_INVALID)
}
if (!this.isObject(props)) {
throw new TypeError(ERROR_MESSAGE_ADD_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.merge(data, props, false)
} else if (this.isArray(data)) {
Private.collection.merge(data, props, false)
}
}
/**
* Delete properties of an object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection from which properties will be deleted.
* @param {string|Array<string>} props The string or array defining properties to be deleted.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.delete({a: 1, b: 'bats'}, 'a')
* // => {b: 'bats'}
*
* mutamax.delete({a: 1, b: 'bats', c: 'color'}, ['a', 'c'])
* // => {b: 'bats'}
*
* mutamax.delete([{a: 1, b: 'bats'}, {c: 'color' }], 'a')
* // => [{b: 'bats'}, {c: 'color'}]
*
* mutamax.delete([{a: 1, b: 'bats'}, {c: 'color' }], ['a', 'c'])
* // => [{b: 'bats'}, {}]
*
*/
Public.delete = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_DELETE_DATA_INVALID)
}
if (!(typeof props === 'string' || this.isArray(props))) {
throw new TypeError(ERROR_MESSAGE_DELETE_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.delete(data, props)
} else if (this.isArray(data)) {
Private.collection.delete(data, props)
}
}
/**
* Rename properties of an object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection whose properties need to be renamed.
* @param {object} props The object defining the old property name in its key and the new property name in its value.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.rename({a: 1, b: 'bats', c: 'color'}, {b: 'mammals', c: 'orange'})
* // => {a: 1, mammals: 'bats', orange: 'color'}
*
* mutamax.rename([{a: 1, b: 'bats'}, {c: 'color'}], {b: 'mammals', c: 'orange'})
* // => [{a: 1, mammals: 'bats'}, {orange: 'color'}]
*
*/
Public.rename = function (data, props) {
const isReverseOrder = Private.isRenameReverseOrder
Private.isRenameReverseOrder = false
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_RENAME_DATA_INVALID)
}
if (!this.isObject(props)) {
throw new TypeError(ERROR_MESSAGE_RENAME_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.rename(data, props, isReverseOrder)
} else if (this.isArray(data)) {
Private.collection.rename(data, props, isReverseOrder)
}
}
/**
* Rename properties of an object or collection in the direction opposite to how rename method does it.
* Rename and renameReverse applied one after the other with the same parameters will yield object or collection with original naming.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection whose properties need to be renamed.
* @param {object} props The object defining the old property name in its value and the new property name in its key.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.renameReverse({a: 1, b: 'bats', c: 'color'}, {mammals: 'b', orange: 'c'})
* // => {a: 1, mammals: 'bats', orange: 'color'}
*
* mutamax.renameReverse([{a: 1, b: 'bats'}, {c: 'color', d: 'USD'}], {mammals: 'b', orange: 'c'})
* // => [{a: 1, mammals: 'bats'}, {orange: 'color', d: 'USD'}]
*
*/
Public.renameReverse = function (data, props) {
Private.isRenameReverseOrder = true
this.rename(data, props)
}
/**
* Delete all properties of an object or collection except those specified by the second argument.
* Cleans up `data` from unnecessary properties.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection whose properties need to be cleaned up.
* @param {Array<string>} props The array defining properties that will be deleted from `data`.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.limitTo({a: 1, b: 'bats', c: 'color'}, ['a', 'c'])
* // => {a: 1, c: 'color'}
*
* mutamax.limitTo([{a: 1, b: 'bats'}, {c: 'color', d: 'USD'}], ['a', 'c'])
* // => [{a: 1}, {c: 'color'}]
*
*/
Public.limitTo = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_LIMIT_TO_DATA_INVALID)
}
if (!this.isArray(props)) {
throw new TypeError(ERROR_MESSAGE_LIMIT_TO_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.limitTo(data, props)
} else if (this.isArray(data)) {
Private.collection.limitTo(data, props)
}
}
/**
* Replace values of specified properties to another value in case they are equal to `ifEquals`.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection where values transformations will take place.
* @param {object} props The object defining property(s) whose values need to be changed.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.replaceValueIfEquals({a: 1, b: null}, {property: 'b', ifEquals: null, replaceWith: ''})
* // => {a: 1, b: ''}
*
* mutamax.replaceValueIfEquals({a: undefined, b: undefined, c: true}, {property: ['a', 'b'], ifEquals: undefined, replaceWith: null})
* // => {a: null, b: null, c: true}
*
* mutamax.replaceValueIfEquals([{a: 1, b: 'bats'}, {a: 2, b: undefined}], {property: 'b', ifEquals: undefined, replaceWith: ''})
* // => [{a: 1, b: 'bats'}, {a: 2, b: ''}]
*
* mutamax.replaceValueIfEquals([{a: '', b: ''}, {a: '', b: 'fruit'}], {property: ['a', 'b'], ifEquals: '', replaceWith: null})
* // => [{a: null, b: null}, {a: null, b: 'fruit'}]
*
*/
Public.replaceValueIfEquals = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_DATA_INVALID)
}
if (!this.isObject(props)) {
throw new TypeError(ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.replaceValueIfEquals(data, props)
} else if (this.isArray(data)) {
Private.collection.replaceValueIfEquals(data, props)
}
}
/**
* Replace all values of object or collection - which equal to `ifEquals` - to another value.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection where values transformations will take place.
* @param {object} props The object defining values that need to be changed.
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.replaceAllValuesIfEquals({a: 1, b: null, c: null}, {ifEquals: null, replaceWith: ''})
* // => {a: 1, b: '', c: ''}
*
* mutamax.replaceAllValuesIfEquals([{a: undefined, b: 'bats'}, {a: undefined, b: undefined}], {ifEquals: undefined, replaceWith: ''})
* // => [{a: '', b: 'bats'}, {a: '', b: ''}]
*
*/
Public.replaceAllValuesIfEquals = function (data, props) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_REPLACE_ALL_VALUES_IF_EQUALS_DATA_INVALID)
}
if (!this.isObject(props)) {
throw new TypeError(ERROR_MESSAGE_REPLACE_ALL_VALUES_IF_EQUALS_PROPS_INVALID)
}
if (this.isObject(data)) {
Private.object.replaceAllValuesIfEquals(data, props)
} else if (this.isArray(data)) {
Private.collection.replaceAllValuesIfEquals(data, props)
}
}
/**
* Capitalize first property character of object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection whose properties need to be changed
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.capitalizeFirstChar({a: 1, mammal: 'bats', color: 'c'})
* // => {A: 1, Mammal: 'bats', Color: 'c'}
*
* mutamax.capitalizeFirstChar([{a: 1, mammal: 'bats'}, {color: 'c'}])
* // => [{A: 1, Mammal: 'bats'}, {Color: 'c'}]
*
*/
Public.capitalizeFirstChar = function (data) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_CAPITALIZE_FIRST_CHAR_DATA_INVALID)
}
Private.changePropertyCaseFirstChar(data, 'toUpperCase')
}
/**
* Decapitalize the first properties' character of object or collection.
*
* @since 0.1.0
* @param {object|Array<object>} data The object or collection whose properties need to be changed
* @returns {undefined} The passed `data` will be mutamaxd, no specific return is needed.
* @example
*
*
* mutamax.deCapitalizeFirstChar({A: 1, Mammal: 'bats', Color: 'c'})
* // => {a: 1, mammal: 'bats', color: 'c'}
*
* mutamax.deCapitalizeFirstChar([{A: 1, Mammal: 'bats'}, {Color: 'c'}])
* // => [{a: 1, mammal: 'bats'}, {color: 'c'}]
*
*/
Public.deCapitalizeFirstChar = function (data) {
if (!(this.isObject(data) || this.isArray(data))) {
throw new TypeError(ERROR_MESSAGE_DECAPITALIZE_FIRST_CHAR_DATA_INVALID)
}
Private.changePropertyCaseFirstChar(data, 'toLowerCase')
}
/**
* Checks if value is an object.
*
* @since 0.1.0
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
*
* mutamax.isObject({})
* // => true
*
* mutamax.isObject(new Object())
* // => true
*
* mutamax.isObject(Object('abc'))
* // => false
*
* mutamax.isObject(null)
* // => false
*
* mutamax.isObject((function getArgumentsObject() { return arguments })())
* // => false
*/
Public.isObject = function (value) {
return Object.prototype.toString.call(value) === '[object Object]'
}
/**
* Checks if value is an array.
*
* @since 0.1.0
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
*
* mutamax.isArray([])
* // => true
*
* mutamax.isArray(new Array())
* // => true
*
* mutamax.isArray(Object('abc'))
* // => false
*
* mutamax.isArray(null)
* // => false
*
* mutamax.isArray((function getArgumentsObject() { return arguments })())
* // => false
*/
Public.isArray = function (value) {
return Object.prototype.toString.call(value) === '[object Array]'
}
/**
* The semantic version number.
*
* @static
* @type {string}
* @example
*
*
* console.log(mutamax.VERSION)
* // => 0.2.2
*/
Public.VERSION = VERSION
Private.object = {
map: function (data, iteratee) {
Object.entries(data).forEach(function (entry) {
const key = entry[0]
const value = entry[1]
const {newKey, newValue} = iteratee(key, value)
delete data[key]
data[newKey] = newValue
})
},
delete: function (data, props) {
if (typeof props === 'string') {
delete data[props]
} else if (Public.isArray(props)) {
props.forEach(function (property) {
delete data[property]
})
}
},
rename: function (data, props, isReverseOrder) {
Object.entries(props).forEach(function (entry) {
let newPropName = ''
let oldPropName = ''
if (isReverseOrder) {
newPropName = entry[0]
oldPropName = entry[1]
} else {
newPropName = entry[1]
oldPropName = entry[0]
}
if (newPropName !== oldPropName && Object.prototype.hasOwnProperty.call(data, oldPropName)) {
const existingValue = data[oldPropName]
data[newPropName] = existingValue
delete data[oldPropName]
}
})
},
limitTo: function (data, props) {
Object.keys(data).forEach((property) => {
if (props.indexOf(property) === -1) {
delete data[property]
}
})
},
merge: function (data, props, isOverwriteExistingProps) {
Object.entries(props).forEach(function (entry) {
const [newPropName, newPropValue] = entry
if (isOverwriteExistingProps) {
data[newPropName] = newPropValue
} else {
if (!Object.prototype.hasOwnProperty.call(data, newPropName)) {
data[newPropName] = newPropValue
}
}
})
},
replaceAllValuesIfEquals: function (data, props) {
Object.keys(data).forEach((property) => {
if (data[property] === props.ifEquals) {
data[property] = props.replaceWith
}
})
},
replaceValueIfEquals: function (data, props) {
const replace = (data, property, ifEquals, replaceWith) => {
Object.keys(data).forEach((existingProperty) => {
if (existingProperty === property && data[existingProperty] === ifEquals) {
data[existingProperty] = replaceWith
}
})
}
if (typeof props.property === 'string') {
replace(data, props.property, props.ifEquals, props.replaceWith)
} else if (Public.isArray(props.property)) {
props.property.forEach((singleProperty) => {
replace(data, singleProperty, props.ifEquals, props.replaceWith)
})
} else {
throw new TypeError(ERROR_MESSAGE_REPLACE_VALUE_IF_EQUALS_PROPS_PROPERTY_INVALID)
}
},
changePropertyCaseFirstChar: function (data, capitalizationFunctionName) {
Object.keys(data).forEach((property) => {
const firstOriginalPropertyChar = property[0]
const firstTransformedPropertyChar = firstOriginalPropertyChar[capitalizationFunctionName]()
if (firstOriginalPropertyChar !== firstTransformedPropertyChar) {
data[firstTransformedPropertyChar + property.slice(1)] = data[property]
delete data[property]
}
})
}
}
Private.collection = {
map: function (data, iteratee) {
data.forEach(function (item) {
Private.object.map(item, iteratee)
})
},
delete: function (data, props) {
if (typeof props === 'string') {
this.deleteSingleProp(data, props)
} else if (Public.isArray(props)) {
props.forEach(function (property) {
this.deleteSingleProp(data, property)
}, this)
}
},
deleteSingleProp: function (data, singleProp) {
data.forEach(function (item) {
delete item[singleProp]
})
},
rename: function (data, props, isReverseOrder) {
data.forEach(function (item) {
Private.object.rename(item, props, isReverseOrder)
})
},
limitTo: function (data, props) {
data.forEach(function (item) {
Private.object.limitTo(item, props)
})
},
merge: function (data, props, isOverwriteExistingProps) {
data.forEach(function (item) {
Private.object.merge(item, props, isOverwriteExistingProps)
})
},
replaceValueIfEquals: function (data, props) {
data.forEach(function (item) {
Private.object.replaceValueIfEquals(item, props)
})
},
replaceAllValuesIfEquals: function (data, props) {
data.forEach(function (item) {
Private.object.replaceAllValuesIfEquals(item, props)
})
},
changePropertyCaseFirstChar: function (data, capitalizationFunctionName) {
data.forEach(function (item) {
Private.object.changePropertyCaseFirstChar(item, capitalizationFunctionName)
})
}
}
Private.changePropertyCaseFirstChar = function (data, capitalizationFunctionName) {
if (Public.isObject(data)) {
Private.object.changePropertyCaseFirstChar(data, capitalizationFunctionName)
} else if (Public.isArray(data)) {
Private.collection.changePropertyCaseFirstChar(data, capitalizationFunctionName)
}
}
return Public
}())
module.exports = mutamax
module.exports.default = module.exports // For TypeScript