Comparing version 5.12.1 to 5.13.0
@@ -204,3 +204,3 @@ function F() { | ||
function assocPathFn(path, newValue, input) { | ||
const pathArrValue = typeof path === 'string' ? path.split('.') : path; | ||
const pathArrValue = typeof path === 'string' ? path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) : path; | ||
@@ -215,6 +215,12 @@ if (pathArrValue.length === 0) { | ||
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index); | ||
const nextinput = condition ? _isInteger(parseInt(pathArrValue[1], 10)) ? [] : {} : input[index]; | ||
const nextinput = condition ? _isInteger(pathArrValue[1]) ? [] : {} : input[index]; | ||
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextinput); | ||
} | ||
if (_isInteger(index) && _isArray(input)) { | ||
const arr = input.slice(); | ||
arr[index] = newValue; | ||
return arr; | ||
} | ||
return assoc(index, newValue, input); | ||
@@ -1655,2 +1661,18 @@ } | ||
function takeWhile(predicate, list) { | ||
const toReturn = []; | ||
let stopFlag = false; | ||
let counter = -1; | ||
while (stopFlag === false && counter++ < list.length) { | ||
if (!predicate(list[counter])) { | ||
stopFlag = true; | ||
} else { | ||
toReturn.push(list[counter]); | ||
} | ||
} | ||
return toReturn; | ||
} | ||
function tap(fn, x) { | ||
@@ -1869,2 +1891,2 @@ if (arguments.length === 1) return _x => tap(fn, _x); | ||
export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, either, endsWith, equals, filter, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, over, partial, partition, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitEvery, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj }; | ||
export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, either, endsWith, equals, filter, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, over, partial, partition, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitEvery, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj }; |
@@ -208,3 +208,3 @@ 'use strict'; | ||
function assocPathFn(path, newValue, input) { | ||
const pathArrValue = typeof path === 'string' ? path.split('.') : path; | ||
const pathArrValue = typeof path === 'string' ? path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) : path; | ||
@@ -219,6 +219,12 @@ if (pathArrValue.length === 0) { | ||
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index); | ||
const nextinput = condition ? _isInteger(parseInt(pathArrValue[1], 10)) ? [] : {} : input[index]; | ||
const nextinput = condition ? _isInteger(pathArrValue[1]) ? [] : {} : input[index]; | ||
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextinput); | ||
} | ||
if (_isInteger(index) && _isArray(input)) { | ||
const arr = input.slice(); | ||
arr[index] = newValue; | ||
return arr; | ||
} | ||
return assoc(index, newValue, input); | ||
@@ -1659,2 +1665,18 @@ } | ||
function takeWhile(predicate, list) { | ||
const toReturn = []; | ||
let stopFlag = false; | ||
let counter = -1; | ||
while (stopFlag === false && counter++ < list.length) { | ||
if (!predicate(list[counter])) { | ||
stopFlag = true; | ||
} else { | ||
toReturn.push(list[counter]); | ||
} | ||
} | ||
return toReturn; | ||
} | ||
function tap(fn, x) { | ||
@@ -2004,2 +2026,3 @@ if (arguments.length === 1) return _x => tap(fn, _x); | ||
exports.takeLast = takeLast; | ||
exports.takeWhile = takeWhile; | ||
exports.tap = tap; | ||
@@ -2006,0 +2029,0 @@ exports.test = test; |
@@ -210,3 +210,3 @@ (function (global, factory) { | ||
function assocPathFn(path, newValue, input) { | ||
const pathArrValue = typeof path === 'string' ? path.split('.') : path; | ||
const pathArrValue = typeof path === 'string' ? path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) : path; | ||
@@ -221,6 +221,12 @@ if (pathArrValue.length === 0) { | ||
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index); | ||
const nextinput = condition ? _isInteger(parseInt(pathArrValue[1], 10)) ? [] : {} : input[index]; | ||
const nextinput = condition ? _isInteger(pathArrValue[1]) ? [] : {} : input[index]; | ||
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextinput); | ||
} | ||
if (_isInteger(index) && _isArray(input)) { | ||
const arr = input.slice(); | ||
arr[index] = newValue; | ||
return arr; | ||
} | ||
return assoc(index, newValue, input); | ||
@@ -1661,2 +1667,18 @@ } | ||
function takeWhile(predicate, list) { | ||
const toReturn = []; | ||
let stopFlag = false; | ||
let counter = -1; | ||
while (stopFlag === false && counter++ < list.length) { | ||
if (!predicate(list[counter])) { | ||
stopFlag = true; | ||
} else { | ||
toReturn.push(list[counter]); | ||
} | ||
} | ||
return toReturn; | ||
} | ||
function tap(fn, x) { | ||
@@ -2006,2 +2028,3 @@ if (arguments.length === 1) return _x => tap(fn, _x); | ||
exports.takeLast = takeLast; | ||
exports.takeWhile = takeWhile; | ||
exports.tap = tap; | ||
@@ -2008,0 +2031,0 @@ exports.test = test; |
@@ -1303,2 +1303,5 @@ import { F as FunctionToolbelt, O as ObjectToolbelt, L as ListToolbelt } from "./_ts-toolbelt/src/ts-toolbelt"; | ||
export function takeWhile<T>(predicate: (x: T) => boolean, list: readonly T[]): T[]; | ||
export function takeWhile<T>(predicate: (x: T) => boolean): (list: readonly T[]) => T[]; | ||
/** | ||
@@ -1305,0 +1308,0 @@ * It applies function `fn` to input `x` and returns `x`. |
@@ -21,3 +21,3 @@ { | ||
"main": "./dist/rambda.js", | ||
"version": "5.12.1", | ||
"version": "5.13.0", | ||
"dependencies": {}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
@@ -9,3 +9,6 @@ import { _isArray } from './_internals/_isArray' | ||
){ | ||
const pathArrValue = typeof path === 'string' ? path.split('.') : path | ||
const pathArrValue = | ||
typeof path === 'string' ? | ||
path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) : | ||
path | ||
if (pathArrValue.length === 0){ | ||
@@ -23,3 +26,3 @@ return newValue | ||
const nextinput = condition ? | ||
_isInteger(parseInt(pathArrValue[ 1 ], 10)) ? | ||
_isInteger(pathArrValue[ 1 ]) ? | ||
[] : | ||
@@ -36,2 +39,9 @@ {} : | ||
if (_isInteger(index) && _isArray(input)){ | ||
const arr = input.slice() | ||
arr[ index ] = newValue | ||
return arr | ||
} | ||
return assoc( | ||
@@ -38,0 +48,0 @@ index, newValue, input |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1029003
431
16419
22145