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.

setIn behavior contradicts documentation

See original GitHub issue

Problem

Using collectable@0.22.0

It looks like C.setIn() tries to interact with values at times when I expect it to be interacting with keys.

See this webpackbin for a demo.

Take special note of map2, which is the operation that appears to throw the type error. Copy-pasted from the README:

import * as C from 'collectable';

const input = {
  foo: 'abc', <--- setIn tries to do stuff to 'abc' when it should be operating on input.foo...
  xyz: [3, [5, 6], 7, 9]
};
const map0 = C.from(input); // <{foo: 'abc', xyz: <[3, [5, 6], 7, 9]>}>
const map1 = C.updateIn(['xyz', 1, 0], n => 4, map0); // <{foo: 'abc', xyz: <[3, [4, 6], 7, 9]>}>
const map2 = C.setIn(['foo', 'bar'], x => 'baz', map1); // <{foo: <{bar: 'baz'}>, xyz: ...>

VM181 dll.js:9431 Uncaught TypeError: Cannot use 'in' operator to search for '@@is-collection' in abc
    at isCollection (VM181 dll.js:9431)
    at isIndexedCollection (VM181 dll.js:9434)
    at setDeep (VM181 dll.js:7644)
    at path.length.__WEBPACK_IMPORTED_MODULE_0__collectable_core__.IndexedCollection.updateEntry (VM181 dll.js:7647)
    at update (VM181 dll.js:9817)
    at HashMapStructure.@@update (VM181 dll.js:3664)
    at Object.updateEntry (VM181 dll.js:9425)
    at setDeep (VM181 dll.js:7647)
    at Object.setIn (VM181 dll.js:7639)
    at Object.<anonymous> (VM182 main.js:96)

Desired Outcome

  • If the documentation is misleading, then the example would be corrected to demonstrate the actual setIn() behavior. This is likely, since there are many calls for documentation throughout the project.

  • If the documentation reflects the intended API correctly, then this is a bug in the implementation of setIn()

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
joefraleycommented, Aug 9, 2017

@axefrog cool, i’ll open a new issue about settling the second parameter API. i’d also like to add some list tests in for the number implication you described

1reaction
SimonMeskenscommented, Aug 4, 2017

Oh you want watching?

“gulp watch --pkg list”

Read more comments on GitHub >

github_iconTop Results From Across the Web

mode is mandatory, which contradicts docs · Issue #1111
Current behavior With a basic configuration, semantic-release throws an error saying no mode is specified. Expected behavior The docs say that by default ......
Read more >
Documentation on encryption context in contradiction with ...
"When an encryption context is provided in an encryption request, it is cryptographically bound to the ciphertext such that the same encryption context...
Read more >
How Taking Inconsistent Positions Can Lead to Dismissal ...
This is because the doctrine prevents a contradictory position, but does not examine the truth of either statement made by a litigant.
Read more >
Re: Reporting Nodes Added Automatically When Moving iSCSI- ...
This behavior contradicts NetApp documentation which indicates it must be done manually. Has anyone else encountered this? Does anyone know if there's a ......
Read more >
INTERROGATION TECHNIQUES
The Reid website describes the Behavior Analysis Interview (BAI) as a non-accusatory question and answer session, involving both standard investigative ...
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