Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set {key: string } #203

Open
gen4sp opened this issue Mar 2, 2018 · 0 comments · May be fixed by #211
Open

Set {key: string } #203

gen4sp opened this issue Mar 2, 2018 · 0 comments · May be fixed by #211

Comments

@gen4sp
Copy link

gen4sp commented Mar 2, 2018

I want to set a string for some objects.

find('div.section > div.container-14.w-container > div.row-3.w-row > div.column-space.w-col.w-col-4 > a:nth-child(3)')
      .set({
        links: {
          url: '@href',
          type: '"web "',
        },
      })
find('div.section > div.container-14.w-container > div.row-3.w-row > div.column-space.w-col.w-col-4 > a:nth-child(5)')
      .set({
        links: {
          url: '@href',
          type: '"slack "',
        },
      })

I've tried to set type: () => 'slack but it didnt work too

samogot added a commit to samogot/node-osmosis that referenced this issue May 13, 2018
There is a "feature" that any function passed as one of properties of
object parameters to any command is replaced with than command. It is
rather inconvenience than handy, because it makes imposible to use
contextCallbacks in set command using object syntax. If setting several
simple properties can be bypassed, by calling set command several times,
using contextCallbacks for nested properties is completely imposible.

It is uncertain what was the reason behind such behaviour. It's hard for
me imagine where sole than command may be usefull in set or any oter
command parameter context. It neither documented, nor covered by tests,
so the proposal is to remove this "feature". This may cause some
regressions in some existing code that relies on such behaviour (is such
code exists), but it will be rather easy to fix by calling then commad
explisitly.

This commit also fixes rchipka#203 as `type: () => "some string"` now works.
@samogot samogot linked a pull request May 13, 2018 that will close this issue
samogot added a commit to samogot/node-osmosis that referenced this issue Nov 13, 2018
There is a "feature" that any function passed as one of properties of
object parameters to any command is replaced with than command. It is
rather inconvenience than handy, because it makes imposible to use
contextCallbacks in set command using object syntax. If setting several
simple properties can be bypassed, by calling set command several times,
using contextCallbacks for nested properties is completely imposible.

It is uncertain what was the reason behind such behaviour. It's hard for
me imagine where sole than command may be usefull in set or any oter
command parameter context. It neither documented, nor covered by tests,
so the proposal is to remove this "feature". This may cause some
regressions in some existing code that relies on such behaviour (is such
code exists), but it will be rather easy to fix by calling then commad
explisitly.

This commit also fixes rchipka#203 as `type: () => "some string"` now works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant