How to use the rambda.pick function in rambda

To help you get started, we’ve selected a few rambda 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 selfrefactor / rambda / _typings_tests / pick-spec.ts View on Github external
it('infered input type', () => {
    const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
    x // $ExpectType Dictionary
    const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
    y // $ExpectType Dictionary
    const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
    q // $ExpectType Dictionary
  });
});
github selfrefactor / rambda / _typings_tests / pick-spec.ts View on Github external
it('two types', () => {
    interface Output{
      a: number
      c: number
    }

    const x = pick('a,c', {a:1,b:'2',c:3,d:4}); // $ExpectType Output
    x.a // $ExpectType number
    const y = pick('a,c')({a:1,b:'2',c:3,d:4}); // $ExpectType Output
    y.a // $ExpectType number
  });
github selfrefactor / rambda / _typings_tests / pick-spec.ts View on Github external
it('one type', () => {
    const x = pick(['a,c'], {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
    x // $ExpectType Dictionary
    const y = pick(['a,c'])({a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
    y // $ExpectType Dictionary
  });
});
github selfrefactor / rambda / _typings_tests / pick-spec.ts View on Github external
it('infered input type', () => {
    const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
    x // $ExpectType Dictionary
    const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
    y // $ExpectType Dictionary
    const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
    q // $ExpectType Dictionary
  });
});
github selfrefactor / rambda / _typings_tests / pick-spec.ts View on Github external
it('infered input type', () => {
    const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
    x // $ExpectType Dictionary
    const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
    y // $ExpectType Dictionary
    const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
    q // $ExpectType Dictionary
  });
});
github farwayer / mst-decorators / src / index.js View on Github external
const values = new Class()
  const {onSnapshot, onPatch, onAction} = values

  let props = extractTaggedProps(Class, PropsKey)
  props = pipe(
    rdMap(args => args[0]),
    convertValuesToMst,
  )(props)

  const propKeys = Object.keys(props)
  const viewKeys = Object.keys(extractTaggedProps(Class, ViewsKey))
  const ownKeys = Object.getOwnPropertyNames(values)
  const omitKeys = ExcludeKeys.concat(propKeys).concat(viewKeys)
  const descs = getOwnPropertyDescriptors(Class.prototype)

  const views = pick(viewKeys, descs)
  const volatile = omit(omitKeys, pick(ownKeys, values))
  const actions = {}

  pipe(
    filter((desc, key) => !omitKeys.includes(key)),
    forEach((desc, key) => {
      const {get, set, value} = desc
      if (get || set) return views[key] = desc
      if (is.fn(value)) return actions[key] = value
    }),
  )(descs)

  const mstType = getMstType(Class) // es6 extending
  let Model = mstType
    ? mstType.named(name).props(props)
    : MstTypes.model(name, props)