Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / composition / remapPaths.js
Size: Mime:
// 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";