Repository URL to install this package:
|
Version:
1.2.8 ▾
|
// const isFirstLetterUppercase = x => {
// const first = x[0]
// return first.toUpperCase() === first
// }
//
// function remapPaths(typeRemapping, data) {
// let transformed = clone(data)
//
// // @NOTE not tail-call recursion, using traverser
// recurse(data).forEach((x, key, traverser) => {
// // ignore first
// if (!key) return
//
// const { path } = traverser
//
// // ignore it, if the property is an uppercase, count it as a schemaPath
// if (isFirstLetterUppercase(key)) {
// return
// }
//
// let evolution = get(typeRemapping, path)
//
// if (evolution !== undefined) {
// // object, path, value
// set(transformed, path, evolution(x))
// }
// })
//
// return transformed
// }
//
// // @NOTE this was a could be this way
// // const key = Object.keys(keyVal)[0]
// // const property = keyVal[key]
// // {label: 'value'}
// const indexByKeyVal = curry(3, (key, property, list) => {
// const indexed = {}
// list.forEach(item => {
// const atKey = item[key]
// indexed[atKey] = item[property]
// })
//
// // to get the array back out again
// Object.defineProperty(indexed, Symbol.for('array'), {
// configurable: false,
// enumerable: false,
// value: list,
// })
//
// return indexed
// })
// const indexByLabelValue = indexByKeyVal('label', 'value')
"use strict";