diff --git a/docs/index.html b/docs/index.html index c643f8350..a6ec001a6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -74,7 +74,7 @@ document.getElementById('doc-drawer-checkbox').checked = false; } }, false); - }
Creates a function that accepts up to n arguments, ignoring any additional arguments.
n
Call the provided function, fn, with up to n arguments, using Array.slice(0,n) and the spread operator (...).
fn
Array.slice(0,n)
...
const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); + } 30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.Adapterary call collectInto flip over overArgs pipeAsyncFunctions pipeFunctions promisify rearg spreadOver unaryArrayall any bifurcate bifurcateBy chunk compact countBy countOccurrences deepFlatten difference differenceBy differenceWith drop dropRight dropRightWhile dropWhile everyNth filterNonUnique findLast findLastIndex flatten forEachRight groupBy head indexOfAll initial initialize2DArray initializeArrayWithRange initializeArrayWithRangeRight initializeArrayWithValues intersection intersectionBy intersectionWith isSorted join last longestItem mapObject maxN minN none nthElement partition permutations pull pullAtIndex pullAtValue pullBy reducedFilter reduceSuccessive reduceWhich remove sample sampleSize shuffle similarity sortedIndex sortedIndexBy sortedLastIndex sortedLastIndexBy stableSort symmetricDifference symmetricDifferenceBy symmetricDifferenceWith tail take takeRight takeRightWhile takeWhile union unionBy unionWith uniqueElements unzip unzipWith without xProd zip zipObject zipWithBrowserarrayToHtmlList bottomVisible copyToClipboard createElement createEventHub currentURL detectDeviceType elementIsVisibleInViewport getScrollPosition getStyle hasClass hashBrowser hide httpsRedirect observeMutations off on onUserInputChange redirect runAsync scrollToTop setStyle show toggleClass UUIDGeneratorBrowserDateformatDuration getColonTimeFromDate getDaysDiffBetweenDates getMeridiemSuffixOfInteger tomorrowFunctionattempt bind bindKey chainAsync compose composeRight converge curry debounce defer delay functionName memoize negate once partial partialRight runPromisesInSeries sleep throttle times uncurry unfoldMathapproximatelyEqual average averageBy binomialCoefficient clampNumber degreesToRads digitize distance elo factorial fibonacci gcd geometricProgression hammingDistance inRange isDivisible isEven isPrime lcm luhnCheck maxBy median minBy percentile powerset primes radsToDegrees randomIntArrayInRange randomIntegerInRange randomNumberInRange round sdbm standardDeviation sum sumBy sumPower toSafeIntegerNodeatob btoa colorize hasFlags hashNode isTravisCI JSONToFile readFileLines untildify UUIDGeneratorNodeObjectbindAll deepClone defaults equals findKey findLastKey flattenObject forOwn forOwnRight functions get invertKeyValues lowercaseKeys mapKeys mapValues matches matchesWith merge objectFromPairs objectToPairs omit omitBy orderBy pick pickBy shallowClone size transform truthCheckCollection unflattenObjectStringbyteSize capitalize capitalizeEveryWord decapitalize escapeHTML escapeRegExp fromCamelCase isAbsoluteURL isAnagram isLowerCase isUpperCase mask palindrome pluralize removeNonASCII reverseString sortCharactersInString splitLines stringPermutations stripHTMLTags toCamelCase toKebabCase toSnakeCase truncateString unescapeHTML URLJoin wordsTypegetType is isArrayLike isBoolean isEmpty isFunction isNil isNull isNumber isObject isObjectLike isPlainObject isPrimitive isPromiseLike isString isSymbol isUndefined isValidJSONUtilitycastArray cloneRegExp coalesce coalesceFactory extendHex getURLParameters hexToRGB httpGet httpPost mostPerformant nthArg parseCookie prettyBytes randomHexColorCode RGBToHex serializeCookie timeTaken toCurrency toDecimalMark toOrdinalSuffix validateNumber yesNo AdapteraryCreates a function that accepts up to n arguments, ignoring any additional arguments.Call the provided function, fn, with up to n arguments, using Array.slice(0,n) and the spread operator (...).const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); Show examplesconst firstTwoMax = ary(Math.max, 2); [[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)); // [6, 8, 10] 📋 Copy to clipboardcallGiven a key and a set of arguments, call them when given a context. Primarily useful in composition.Use a closure to call a stored key with stored arguments.const call = (key, ...args) => context => context[key](...args);
const ary = (fn, n) => (...args) => fn(...args.slice(0, n));
const firstTwoMax = ary(Math.max, 2); [[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)); // [6, 8, 10]
Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
Use a closure to call a stored key with stored arguments.
const call = (key, ...args) => context => context[key](...args);