How to use the ramda.keys 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 tylerlong / subx / test / proxy.spec.js View on Github external
deleteProperty: function (target, property) {
        expect(R.keys(target).length).toBe(3) // deletion hasn't performed
        // console.log('Deleted %s', property)
        delete target[property]
        return true
      },
      set: function (target, property, value, receiver) {
github jongold / tachyons-js / generate.js View on Github external
/*
const queries = {
  '@media (--breakpoint-not-small)': '@media screen and (min-width: 48em)',
  '@media (--breakpoint-medium)': '@media screen and (min-width: 48em) and (max-width: 64em)',
  '@media (--breakpoint-large)': '@media screen and (min-width: 64em)',
}
*/

const queries = {
  '@media (--breakpoint-not-small)': '@media screen and (min-width: 30em)',
  '@media (--breakpoint-medium)': '@media screen and (min-width: 30em) and (max-width: 60em)',
  '@media (--breakpoint-large)': '@media screen and (min-width: 60em)'
};

const queryKeys = R.keys(queries);

// mergeMediaQueries :: a -> a
const mergeMediaQueries = styles => {
  const noQueries = R.omit(queryKeys, styles);

  const flipMediaQuery = key => {
    const rules = styles[key];

    return R.reduce((acc, selector) => {
      const newBp = queries[key];
      return R.assocPath([selector, newBp], rules[selector], acc);
    }, {}, R.keys(rules));
  }

  const flippedQueries = R.reduce((acc, key) => {
    return R.merge(acc, flipMediaQuery(key));
github ai-labs-team / casium / src / view_wrapper.tsx View on Github external
const parent = this.context.execContext;
    const { container, delegate, env, childProps } = this.props;

    if (delegate && !parent) {
      const msg = `Attempting to delegate state property '${delegate.toString()}' with no parent container`;
      console.warn(msg); // tslint:disable-line:no-console
    }
    this.execContext = new ExecContext({ env, parent, container, delegate });
    this.unsubscribe = this.execContext.subscribe(pipe(this.mergeWithRelay.bind(this), this.setState.bind(this)));

    if (this.dispatchLifecycleMessage(Activate, this.props)) {
      return;
    }

    const state = this.execContext.state();
    this.setState(this.execContext.push(merge(state, pick(keys(state), childProps))));
  }
github gpestana / kapacitor-unit / components / test_manager / lib / fs.js View on Github external
.map(tests_def => {
      _.keys(tests_def).map(key => {
        const script = load_script(key).getOrElse({});
        tests_def[key].script = script;
      });
      return Right(tests_def);
    });
}
github broidHQ / integrations / broid-slack / src / core / Adapter.ts View on Github external
public listen(): Observable {
    const rtmEvents = R.pick(['MESSAGE'], RTM_EVENTS);
    const events = R.map(
      (key) => Observable.fromEvent(this.session, rtmEvents[key]),
      R.keys(rtmEvents));
    const webHookEvent = Observable.fromEvent(this.emitter, 'message')
      .mergeMap(parseWebHookEvent);
    events.push(webHookEvent);

    return Observable.merge(...events)
      .switchMap((value) => {
        return Observable.of(value)
          .mergeMap((event: ISlackMessage) => {
            if (!R.contains(event.type, [
              'message',
              'event_callback',
              'slash_command',
              'interactive_message',
            ])) { return Promise.resolve(null); }

            if (event.type === 'message' && R.contains(event.subtype, [
github xxhomey19 / nba-bar / renderer / components / Preview / Table.js View on Github external
<b>
              <p>
                {key === 'plus_minus'
                  ? '+/-'
                  : key.toUpperCase().replace('_PCT', '%')}
              </p>
            </b>
          
          
            <p>{visitor[key]}</p>
          
        
      ),
      R.keys(home)
    )}
  
);
github serverless / components / src / utils / components / getComponentsFromServerlessFile.js View on Github external
const nestedComponents = mergeAll(
    await Promise.all(
      map(async (componentAlias) => {
        const nestedComponentRoot = await getComponentRootPath(
          component.components[componentAlias].type
        )
        const nestedComponentInputs = component.components[componentAlias].inputs || {}
        const nestedComponentId = component.components[componentAlias].id
        return getComponentsFromServerlessFile(
          stateFile,
          nestedComponentRoot,
          nestedComponentInputs,
          nestedComponentId
        )
      }, keys(component.components) || [])
    )
  )

  return assoc(
    component.id,
    {
      id: component.id,
      type: component.type,
      inputs: component.inputs,
      inputTypes: component.inputTypes,
      outputs: {},
      outputTypes: component.outputTypes,
      rootPath: componentRoot,
      state: getState(stateFile, component.id),
      dependencies: getDependencies(component.inputs),
      children: getChildrenIds(component) || {},
github wavesplatform / WavesGUI / src / modules / dex / directives / createOrder / CreateOrder.js View on Github external
_applyState(newState) {
                keys(newState).forEach(key => {
                    this[key] = newState[key];
                });
                this.order.$setDirty();
            }