Commit 55641b43 by Vladislav Lagunov

Фикс в functions/update-at.ts

parent 2e97c705
...@@ -16,7 +16,7 @@ export default function updateAt(at_: ObjectPath, value: any): <A>(obj: A) => A ...@@ -16,7 +16,7 @@ export default function updateAt(at_: ObjectPath, value: any): <A>(obj: A) => A
let stack: any[] = [obj]; let stack: any[] = [obj];
let tail: any = stack[0]; let tail: any = stack[0];
for (const k of at) { for (const k of at) {
if (!tail.hasOwnProperty(k)) return obj; // Поле отсутствует if (!tail || !tail.hasOwnProperty(k)) return obj; // Поле отсутствует
stack.push(tail[k]); stack.push(tail[k]);
tail = tail[k]; tail = tail[k];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment