Procházet zdrojové kódy

Extract var atCurrentPath.

Herby Vojčík před 6 roky
rodič
revize
33aeea590d
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      index.js

+ 2 - 1
index.js

@@ -56,6 +56,7 @@ const modifier = (key, value, valueModifier) => {
 
 
 const atPathBeginningWith = prefix => (...keyDescriptions) => {
 const atPathBeginningWith = prefix => (...keyDescriptions) => {
     const keys = parseKeysInto(keyDescriptions, [...prefix]),
     const keys = parseKeysInto(keyDescriptions, [...prefix]),
+        atCurrentPath = atPathBeginningWith(keys),
         keyChain = chain(keys),
         keyChain = chain(keys),
         putChain = keyChain((key, next) => x => modifier(key, getKey(x, key), next)(x)),
         putChain = keyChain((key, next) => x => modifier(key, getKey(x, key), next)(x)),
         mapChain = keyChain((key, next) => x => {
         mapChain = keyChain((key, next) => x => {
@@ -64,7 +65,7 @@ const atPathBeginningWith = prefix => (...keyDescriptions) => {
             return modifier(key, valueWithCheck.value, next)(x);
             return modifier(key, valueWithCheck.value, next)(x);
         });
         });
 
 
-    return Object.assign(atPathBeginningWith(keys), {
+    return Object.assign(atCurrentPath, {
         get: obj => keys.reduce(getKey, obj),
         get: obj => keys.reduce(getKey, obj),
         put: val => putChain(() => val),
         put: val => putChain(() => val),
         map: mapChain
         map: mapChain