@es-git/walkers-mixin
Advanced tools
Comparing version 0.5.1 to 0.7.0
import { Mode, Constructor, Hash } from '@es-git/core'; | ||
import { IObjectRepo, CommitObject } from '@es-git/object-mixin'; | ||
export declare type HashAndCommitObject = { | ||
import { IObjectRepo, CommitBody } from '@es-git/object-mixin'; | ||
export declare type HashAndCommitBody = { | ||
readonly hash: Hash; | ||
readonly commit: CommitObject; | ||
readonly commit: CommitBody; | ||
}; | ||
@@ -13,3 +13,3 @@ export declare type HashModePath = { | ||
export interface IWalkersRepo { | ||
walkCommits(...hash: Hash[]): AsyncIterableIterator<HashAndCommitObject>; | ||
walkCommits(...hash: Hash[]): AsyncIterableIterator<HashAndCommitBody>; | ||
walkTree(hash: Hash): AsyncIterableIterator<HashModePath>; | ||
@@ -16,0 +16,0 @@ listFiles(hash: Hash): AsyncIterableIterator<HashModePath>; |
@@ -43,3 +43,3 @@ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } | ||
throw new Error(`Object is not a commit ${hash}`); | ||
const visitParents = yield { hash, commit }; | ||
const visitParents = yield { hash, commit: commit.body }; | ||
if (visitParents === false) | ||
@@ -98,7 +98,8 @@ continue; | ||
export function withFeedback(iterator, feedback) { | ||
const result = Object.assign({}, iterator, { next() { | ||
return iterator.next(result.continue); | ||
return Object.assign({}, iterator, { next() { | ||
const result = iterator.next(this.continue); | ||
this.continue = feedback; | ||
return result; | ||
}, continue: feedback }); | ||
return result; | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -212,3 +212,3 @@ "use strict"; | ||
_context.next = 15; | ||
return { hash: _hash, commit: commit }; | ||
return { hash: _hash, commit: commit.body }; | ||
@@ -527,10 +527,11 @@ case 15: | ||
function withFeedback(iterator, feedback) { | ||
var result = (0, _assign2.default)({}, iterator, { | ||
return (0, _assign2.default)({}, iterator, { | ||
next: function next() { | ||
return iterator.next(result.continue); | ||
var result = iterator.next(this.continue); | ||
this.continue = feedback; | ||
return result; | ||
}, | ||
continue: feedback }); | ||
return result; | ||
} | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@es-git/walkers-mixin", | ||
"version": "0.5.1", | ||
"version": "0.7.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
import { Type, Mode, Constructor, IRawRepo, Hash, isFile } from '@es-git/core'; | ||
import { IObjectRepo, GitObject, CommitObject, TreeObject } from '@es-git/object-mixin'; | ||
import { IObjectRepo, GitObject, CommitObject, TreeObject, CommitBody } from '@es-git/object-mixin'; | ||
export type HashAndCommitObject = { | ||
export type HashAndCommitBody = { | ||
readonly hash : Hash | ||
readonly commit : CommitObject | ||
readonly commit : CommitBody | ||
} | ||
@@ -16,3 +16,3 @@ | ||
export interface IWalkersRepo { | ||
walkCommits(...hash : Hash[]) : AsyncIterableIterator<HashAndCommitObject> | ||
walkCommits(...hash : Hash[]) : AsyncIterableIterator<HashAndCommitBody> | ||
walkTree(hash : Hash) : AsyncIterableIterator<HashModePath> | ||
@@ -28,3 +28,3 @@ listFiles(hash : Hash) : AsyncIterableIterator<HashModePath> | ||
async *walkCommits(...hash : Hash[]) : AsyncIterableIterator<HashAndCommitObject> { | ||
async *walkCommits(...hash : Hash[]) : AsyncIterableIterator<HashAndCommitBody> { | ||
const queue = hash; | ||
@@ -38,3 +38,3 @@ const visited = new Set<Hash>(queue); | ||
if(commit.type !== Type.commit) throw new Error(`Object is not a commit ${hash}`); | ||
const visitParents = yield {hash, commit}; | ||
const visitParents = yield {hash, commit: commit.body}; | ||
if(visitParents === false) continue; | ||
@@ -74,11 +74,11 @@ for(const parent of commit.body.parents){ | ||
export function withFeedback<TOut, TIn>(iterator : AsyncIterableIterator<TOut>, feedback : TIn) : AsyncIterableIterator<TOut> & { continue : TIn} { | ||
const result = { | ||
return { | ||
...iterator, | ||
next() { | ||
return iterator.next(result.continue); | ||
const result = iterator.next(this.continue); | ||
this.continue = feedback; | ||
return result; | ||
}, | ||
continue: feedback | ||
}; | ||
return result; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81049
609