mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
23 lines
377 B
JavaScript
23 lines
377 B
JavaScript
'use strict';
|
|
const _ = require('lodash');
|
|
|
|
/**
|
|
* @param {Array.<*>} array
|
|
* @param {*} obj
|
|
*/
|
|
function addIfMissing(array, obj) {
|
|
if (!_.includes(array, obj)) {
|
|
array.push(obj);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} str
|
|
* @return {string}
|
|
*/
|
|
function capitalize(str) {
|
|
return str[0].toUpperCase() + str.slice(1);
|
|
}
|
|
|
|
module.exports = {addIfMissing, capitalize};
|