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

before scripts do not behave as expected when top-level document is not an array #9

Open
charles-dyfis-net opened this issue Oct 28, 2011 · 1 comment
Labels

Comments

@charles-dyfis-net
Copy link

Given a document that looks like so:

{ 'foo': [1,2,3,4] }

I would expect to be able to use a before script to replace the document with only the array, and have my jsawk script operate only on that array:

jsawk -b 'return this["foo"]' <<<"{'foo':[1,2,3,4]}"

However, this fails:

TypeError: IS has no properties
@cyberhuman
Copy link

For those curious how to do it:

jsawk -b 'return this[0].foo' -a 'return [this]' 'return this+1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants