question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

To form a partial isomorphism with R.zipObj the transformation needs to look like this:

const patient = {
  'abbrev@1':{
    version:'1.0.9',
    resolved:'https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135'
  },
  'shell-quote@git+https://github.com/srghma/node-shell-quote.git#without_unlicenced_jsonify':{
    version:'1.6.0',
    resolved:'git+https://github.com/srghma/node-shell-quote.git#0aa381896e0cd7409ead15fd444f225807a61e0a'
  },
  '@graphile/plugin-supporter@git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git':{
    version:'1.6.0',
    resolved:'git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git#1234commit'
  },
}

const result = unzipObjWith((value, key) => [key, { ...value, name: key }]), patient)

const expected = [
  [
    'abbrev@1', 
    'shell-quote@git+https://github.com/srghma/node-shell-quote.git#without_unlicenced_jsonify',
    '@graphile/plugin-supporter@git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git',
 ],
 [
  {
    name: 'abbrev@1',
    version:'1.0.9',
    resolved:'https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135'
  },
  {
    name: 'shell-quote@git+https://github.com/srghma/node-shell-quote.git#without_unlicenced_jsonify',
    version:'1.6.0',
    resolved:'git+https://github.com/srghma/node-shell-quote.git#0aa381896e0cd7409ead15fd444f225807a61e0a'
  },
  {
    name:   '@graphile/plugin-supporter@git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git',
    version:'1.6.0',
    resolved:'git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git#1234commit'
  },
 ]
]

expect(result).toEqual(result)

So you’ll need to do expected[1] to get what you need. I like that this is generic concept which plays with the rest of the zipping algos.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
char0ncommented, Oct 21, 2019

@thomasmichaelwallace cool your understanding is correct.

n.b. I’ll implement it as you’ve shown, but the function’s signiture (value, key) seems counter-intuitive to me given that the array and map are ordered (key, value)?

It’s a convention ramda uses for object transformers. Take a look at https://ramdajs.com/docs/#forEachObjIndexed or https://ramdajs.com/docs/#mapObjIndexed

0reactions
thomasmichaelwallacecommented, Oct 21, 2019

Interesting- it does make sense to match that consistency. Thanks for pointing it out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unzipObjWith.js - Documentation
* Creates a new list out of the supplied object by applying the function to each key/value pairing. *; * @func unzipObjWith ......
Read more >
ramda-adjunct | Yarn - Package Manager
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested...
Read more >
ramda-adjunct - UNPKG
unzipObjWith.js, 1.04 kB, application/javascript. viewOr.js, 1.15 kB, application/javascript. weave.js, 1.08 kB, application/javascript.
Read more >
https://raw.githubusercontent.com/char0n/ramda-adj...
... closes [#1084](https://github.com/char0n/ramda-adjunct/issues/1084) * **object:** add unzipObjWith ...
Read more >
Unzip 3d models - 3DMDB
...curtains turbosquid clean geometry<br>unzip obj with 7zip. turbosquid ... ...curtains drawn closed turbosquid clean geometry<br>unzip obj with 7zip.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found