This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Truncate a string with ellipsis | |
| * @param {string} str - Original string | |
| * @param {number} maxLength - Maximum length of the resulting string including ellipsis | |
| * @param {'middle'|'end'} [mode='middle'] - Truncation mode: 'middle' or 'end' | |
| * @returns {string} - Truncated string with ellipsis | |
| */ | |
| export const truncateString = (str, maxLength, mode = 'middle') => { | |
| if (str.length <= maxLength || maxLength <= 3) return str; | |
| if (mode === 'end') return str.slice(0, maxLength - 1) + '…'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Deep diff between two object, using lodash | |
| * @param {Object} object Object compared | |
| * @param {Object} base Object to compare with | |
| * @return {Object} Return a new object who represent the diff | |
| */ | |
| function difference(object, base) { | |
| function changes(object, base) { | |
| return _.transform(object, function(result, value, key) { | |
| if (!_.isEqual(value, base[key])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git branch | grep -v "master\|develop" | xargs git branch -D | |
| Алиас для удаления: | |
| alias gbDA="git branch | grep -v 'master\|develop' | xargs git branch -D" | |
| git alias для удаления: | |
| git config --global alias.clean-branches "!git branch | grep -v 'master\|develop' | xargs git branch -D" | |
| Исключить ветки из удаления: | |
| "master\|develop\|current_branch" |