mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Consistent parens usage for arrow functions with body.
This commit is contained in:
@@ -38,6 +38,10 @@ module.exports = {
|
||||
'requireReturnForObjectLiteral': false
|
||||
}],
|
||||
|
||||
'arrow-parens': ['error', 'as-needed', {
|
||||
'requireForBlockBody': true
|
||||
}],
|
||||
|
||||
'arrow-spacing': ['error', {
|
||||
'before': true,
|
||||
'after': true
|
||||
|
||||
@@ -22,7 +22,7 @@ function baseMatchesProperty(path, srcValue) {
|
||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||
return matchesStrictComparable(toKey(path), srcValue)
|
||||
}
|
||||
return object => {
|
||||
return (object) => {
|
||||
const objValue = get(object, path)
|
||||
return (objValue === undefined && objValue === srcValue)
|
||||
? hasIn(object, path)
|
||||
|
||||
@@ -11,7 +11,7 @@ import toString from '../toString.js'
|
||||
* @returns {Function} Returns the new case function.
|
||||
*/
|
||||
function createCaseFirst(methodName) {
|
||||
return string => {
|
||||
return (string) => {
|
||||
string = toString(string)
|
||||
|
||||
const strSymbols = hasUnicode(string)
|
||||
|
||||
@@ -13,7 +13,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
const getSymbols = !nativeGetSymbols ? () => [] : object => {
|
||||
const getSymbols = !nativeGetSymbols ? () => [] : (object) => {
|
||||
if (object == null) {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of symbols.
|
||||
*/
|
||||
const getSymbolsIn = !nativeGetSymbols ? () => [] : object => {
|
||||
const getSymbolsIn = !nativeGetSymbols ? () => [] : (object) => {
|
||||
const result = []
|
||||
while (object) {
|
||||
result.push(...getSymbols(object))
|
||||
|
||||
@@ -31,7 +31,7 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||
(getTag(Promise.resolve()) != promiseTag) ||
|
||||
(getTag(new Set) != setTag) ||
|
||||
(getTag(new WeakMap) != weakMapTag)) {
|
||||
getTag = value => {
|
||||
getTag = (value) => {
|
||||
const result = baseGetTag(value)
|
||||
const Ctor = result == objectTag ? value.constructor : undefined
|
||||
const ctorString = Ctor ? toSource(Ctor) : ''
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function matchesStrictComparable(key, srcValue) {
|
||||
return object => {
|
||||
return (object) => {
|
||||
if (object == null) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const MAX_MEMOIZE_SIZE = 500
|
||||
* @returns {Function} Returns the new memoized function.
|
||||
*/
|
||||
function memoizeCapped(func) {
|
||||
const result = memoize(func, key => {
|
||||
const result = memoize(func, (key) => {
|
||||
const { cache } = result
|
||||
if (cache.size === MAX_MEMOIZE_SIZE) {
|
||||
cache.clear()
|
||||
|
||||
@@ -9,7 +9,7 @@ function setToArray(set) {
|
||||
let index = -1
|
||||
const result = Array(set.size)
|
||||
|
||||
set.forEach(value => {
|
||||
set.forEach((value) => {
|
||||
result[++index] = value
|
||||
})
|
||||
return result
|
||||
|
||||
@@ -23,7 +23,7 @@ const rePropName = RegExp(
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the property path array.
|
||||
*/
|
||||
const stringToPath = memoizeCapped(string => {
|
||||
const stringToPath = memoizeCapped((string) => {
|
||||
const result = []
|
||||
if (reLeadingDot.test(string)) {
|
||||
result.push('')
|
||||
|
||||
2
cond.js
2
cond.js
@@ -30,7 +30,7 @@ import arrayMap from './.internal/arrayMap.js'
|
||||
function cond(pairs) {
|
||||
const length = pairs == null ? 0 : pairs.length
|
||||
|
||||
pairs = !length ? [] : arrayMap(pairs, pair => {
|
||||
pairs = !length ? [] : arrayMap(pairs, (pair) => {
|
||||
if (typeof pair[1] != 'function') {
|
||||
throw new TypeError('Expected a function')
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function toString(value) {
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
// Recursively convert values (susceptible to call stack limits).
|
||||
return `${ arrayMap(value, (other) => other == null ? other : toString(other)) }`
|
||||
return `${ arrayMap(value, other => other == null ? other : toString(other)) }`
|
||||
}
|
||||
if (isSymbol(value)) {
|
||||
return symbolToString ? symbolToString.call(value) : ''
|
||||
|
||||
Reference in New Issue
Block a user