How to use the rambda.equals 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 / files / failing_ramda_tests / compose.js View on Github external
  jsv.property('composes two functions', jsv.fn(), jsv.fn(), jsv.nat, (f, g, x) => R.equals(R.compose(f, g)(x), f(g(x))))
  jsv.property('associative', jsv.fn(), jsv.fn(), jsv.fn(), jsv.nat, (f, g, h, x) => {
github selfrefactor / rambda / files / failing_ramda_tests / uniq.js View on Github external
Just.prototype.equals = function(x){
      return x instanceof Just && R.equals(x.value, this.value)
    }
    eq(R.uniq([ -0, -0 ]).length, 1)
github selfrefactor / rambda / files / failing_ramda_tests / curry.js View on Github external
jsv.property('curries multiple values', funcN(4), jsv.json, jsv.json, jsv.json, jsv.json, (f, a, b, c, d) => {
    const g = R.curry(f)

    return R.all(R.equals(f(a, b, c, d)), [
      g(a, b, c, d),
      g(a)(b)(c)(d),
      g(a)(b, c, d),
      g(a, b)(c, d),
      g(a, b, c)(d),
    ])
  })
  jsv.property('curries with placeholder', funcN(3), jsv.json, jsv.json, jsv.json, (f, a, b, c) => {
github wagerfield / ig-api / src / utils.js View on Github external
import {
  toByteArray,
  decodeBase64,
  encodeBase64,
  convertFromHex
} from 'pidcrypt/pidcrypt_util'
import 'pidcrypt/asn1'
import 'pidcrypt/rsa'
import createError from './error'

const { RSA, ASN1 } = pidcrypt

const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

export const isFunction = pipe(type, equals('Function'))
export const isUndefined = pipe(type, equals('Undefined'))

export function publicEncrypt(key, value) {
  const asn = ASN1.decode(toByteArray(decodeBase64(key)))
  const rsa = new RSA()
  rsa.setPublicKeyFromASN(asn.toHexTree())
  return encodeBase64(convertFromHex(rsa.encrypt(value)))
}

export function get(inputObject, inputPath, defaultValue) {
  const inputValue = path(inputPath, inputObject)
  return isUndefined(inputValue) ? defaultValue : inputValue
}

export function getOption(key, options, defaults) {
  return get(options, key, path(key, defaults))
}
github wagerfield / ig-api / src / utils.js View on Github external
} from 'rambda'
import {
  toByteArray,
  decodeBase64,
  encodeBase64,
  convertFromHex
} from 'pidcrypt/pidcrypt_util'
import 'pidcrypt/asn1'
import 'pidcrypt/rsa'
import createError from './error'

const { RSA, ASN1 } = pidcrypt

const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

export const isFunction = pipe(type, equals('Function'))
export const isUndefined = pipe(type, equals('Undefined'))

export function publicEncrypt(key, value) {
  const asn = ASN1.decode(toByteArray(decodeBase64(key)))
  const rsa = new RSA()
  rsa.setPublicKeyFromASN(asn.toHexTree())
  return encodeBase64(convertFromHex(rsa.encrypt(value)))
}

export function get(inputObject, inputPath, defaultValue) {
  const inputValue = path(inputPath, inputObject)
  return isUndefined(inputValue) ? defaultValue : inputValue
}

export function getOption(key, options, defaults) {
  return get(options, key, path(key, defaults))