Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) => {
Just.prototype.equals = function(x){
return x instanceof Just && R.equals(x.value, this.value)
}
eq(R.uniq([ -0, -0 ]).length, 1)
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) => {
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))
}
} 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))