How to use the ramda.assoc function in ramda

To help you get started, we’ve selected a few ramda examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivan-kleshnin / cyclejs-examples / 1.5-form.alt / src / app.js View on Github external
        intents.form.changeEmail.map(email => assoc("email", email)),             // --//--
        intents.form.register.map((_) => always(seeds.form.input)) // reset `form`
github OpenCTI-Platform / opencti / opencti-platform / opencti-graphql / src / database / grakn.js View on Github external
}
  }
  const entityCreated = await executeWrite(async wTx => {
    logger.debug(`[GRAKN - infer: false] createEntity > ${query}`);
    const iterator = await wTx.tx.query(query);
    const txEntity = await iterator.next();
    const concept = txEntity.map().get('entity');
    const types = await conceptTypes(concept);
    return { id: concept.id, types };
  });
  if (entityCreated) {
    // Transaction succeed, complete the result to send it back
    const completedData = pipe(
      assoc('id', internalId),
      // Grakn identifiers
      assoc('grakn_id', entityCreated.id),
      // Types (entity type directly saved)
      assoc('parent_types', entityCreated.types)
    )(data);
    // Transaction succeed, index the result
    if (indexable) {
      await indexElements([completedData]);
    }
    // Complete with eventual relations (will eventually update the index)
    await addOwner(internalId, entity.createdByOwner, opts);
    await addCreatedByRef(internalId, entity.createdByRef, opts);
    await addMarkingDefs(internalId, entity.markingDefinitions, opts);
    await addTags(internalId, entity.tags, opts);
    await addKillChains(internalId, entity.killChainPhases, opts);
    await addObservableRefs(internalId, entity.observableRefs, opts);
    // Else simply return the data
    return completedData;
github flow-typed / flow-typed / definitions / npm / ramda_v0.26.x / flow_v0.104.x- / test_ramda_v0.26.x_object.js View on Github external
it("should return sum types when passed key already has in passed object", () => {
      (_.assoc("a", "s", { a: 1, b: 2 }): {
        a: number | string,
        b: number | string,
        ...
      });
    });
  });
github nickslevine / zebras / zebras.js View on Github external
  return df.map((row, i) => R.assoc(col, arr[i], row))
})
github facundoolano / aso / lib / scores / traffic.js View on Github external
    .then((stats) => R.assoc('score', getScore(stats), stats)));
}
github broidHQ / integrations / broid-viber / src / core / adapter.ts View on Github external
.then((profile: any) => {
            this.me = R.assoc("_isMe", true, profile);
            normalized.target = this.me;
            return normalized;
          });
      })
github OpenCTI-Platform / opencti / opencti-platform / opencti-graphql / src / domain / campaign.js View on Github external
export const addCampaign = async (user, campaign) => {
  const currentDate = now();
  const campaignToCreate = pipe(
    assoc('first_seen', campaign.first_seen ? campaign.first_seen : currentDate),
    assoc('last_seen', campaign.first_seen ? campaign.first_seen : currentDate)
  )(campaign);
  const created = await createEntity(campaignToCreate, 'Campaign');
  return notify(BUS_TOPICS.StixDomainEntity.ADDED_TOPIC, created, user);
};
github OpenCTI-Platform / opencti / opencti-platform / opencti-graphql / src / database / grakn.js View on Github external
return Promise.resolve(inferencesPromises).then(relationInferences => {
      if (isInversed(relation.relationship_type, fromRoleLabel)) {
        return pipe(
          assoc('fromId', toObject.id),
          assoc('fromRole', toRoleLabel),
          assoc('toId', fromObject.id),
          assoc('toRole', fromRoleLabel),
          assoc('inferences', { edges: relationInferences })
        )(relation);
      }
      return pipe(
        assoc('fromId', fromObject.id),
        assoc('fromRole', fromRoleLabel),
        assoc('toId', toObject.id),
        assoc('toRole', toRoleLabel),
        assoc('inferences', { edges: relationInferences })
      )(relation);
    });
  });
github blockchain / My-Wallet-V3 / src / bch / bch-payment.js View on Github external
clean () {
    return this.map(compose(
      assoc('selection', null),
      assoc('hash', null),
      assoc('rawTx', null)
    ))
  }
github ubyssey / dispatch / dispatch / static / manager / src / js / vendor / dispatch-editor / embeds / WidgetEmbed.js View on Github external
function updateWidgetField(fieldName, fieldValue) {
    props.updateField('data', R.assoc(fieldName, fieldValue, props.data.data))
  }