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.

Example from README gives different result

See original GitHub issue

Hi. I really like the idea with lave. Im testing out how to use it to let AlaSQL store itself to a string (so we can restore the state again).

First thing I did was to try the example in on the README. But I get a different result from what is described in the README.

First I installed the modules:

npm install lave 
npm install escodegen

then I copy/paste the example from the README and run:

node << EOF          
  var generate = require('escodegen').generate
  var lave = require('lave')

  var a = [function(){}, new Date, new Buffer('A'), global]
  a.splice(2, 0, a)

  var js = lave(a, {generate, format: 'module'})
  console.log(js)
EOF

The result I get is

export default a;

but the expected result in the README is described as

var a = [
    function (){},
    new Date(1456522677247),
    null,
    Buffer('QQ==', 'base64'),
    (0, eval)('this')
];
a[2] = a;
export default a;

escodegen@1.8.0 + lave@1.1.5 on node@5.3.0 + nvm@3.3.12

Any inputs to why I am not getting same results as described in the README?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jedcommented, Mar 15, 2016

you shouldn’t need an IIFE anymore, thanks to @fgnass: https://github.com/jed/lave/pull/23

0reactions
mathiasrwcommented, Mar 14, 2016

For now, you can run your lave code in an IIFE to prevent this.

Ok - ill try it out.

Any plans on updating the README example?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic writing and formatting syntax - GitHub Docs
Create sophisticated formatting for your prose and code on GitHub with simple syntax.
Read more >
New lines inside paragraph in README.md - Stack Overflow
shows every letter on a new line. However, it seems to me that pushing similar markdown source structure in README.md joins all the...
Read more >
Github Readme Cheatsheet - Level Up Coding
The size of headings can be changed by adding multiple # Together. The greater the number of # is the smaller the heading...
Read more >
README File – Everything you Need to Know - Great Learning
A README file is a text file that describes and launches a project. It comprises information that is frequently needed to grasp the...
Read more >
How to Write a Good README File for Your GitHub Project
In simple words, we can describe a README file as a guide that gives users a detailed description of a project you have...
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