Example on README doesn't show that the yield loadAs returns an array
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 30/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- documentation
Research direction
Start with the README example using repo.loadAs("commit", commitHash) and repo.loadAs("tree", commit.tree). Inspect the loadAs behavior to determine why the result contains an object and an undefined second element, then clarify the example and explain the second value if the behavior is intentional. Verify that the README accurately describes the returned value.
Written by the indexing model from the issue text.
Description
Is the README example correct?
For example it says:
var commit = yield repo.loadAs("commit", commitHash);
var tree = yield repo.loadAs("tree", commit.tree);
But when I tried this, the commit was an array with the first element being an object containing tree, while the second element was just undefined.
I end up using the destructuring syntax let [commit] = ... to get around this, but what is the second element for? Even when I pass in a garbage commit hash, it's undefined (at first I thought it might be a [val, err] pattern).
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from creationix/js-git
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
creationix/js-git#144 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
creationix/js-git#145 · 25 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
creationix/js-git#142 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
creationix/js-git#133 · 10 comments ·
-
es-git: js-git 2.0 Open
Difficulty 5/5 Over a week Newbie friendliness 18/100
creationix/js-git#132 · 18 comments · 8 reactions ·
All issues in creationix/js-git
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·