Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@es-git/walkers-mixin

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@es-git/walkers-mixin

This is part of the [ES-Git](https://github.com/es-git/es-git) project.

  • 0.10.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

walkers-mixin

This is part of the ES-Git project.

Install

npm install --save @es-git/walkers-mixin

Usage

Mix this in with an IObjectRepo.

This mixin provides ways to walk the repo, either along it's history or in the tree of one commit. This mixin uses async iterables

import objectsMixin from '@es-git/objects-mixin';
import walkersMixin from '@es-git/walkers-mixin';
import MemoryRepo from '@es-git/memory-repo';

const Repo = mix(MemoryRepo)
            .with(objectsMixin)
            .with(walkersMixin);

const repo = new Repo();
for await(const commit of repo.walkComits(await repo.getRef('refs/heads/master'))){
  console.log(commit.message);
}
for await(const fileOrFolder of repo.walkTree(await repo.getRef('refs/heads/master'))){
  console.log(fileOrFolder.path.join('/'));
}
for await(const file of repo.listFiles(await repo.getRef('refs/heads/master'))){
  console.log(file.path.join('/'));
}

Interfaces

IWalkersRepo

interface IWalkersRepo {
  walkCommits(...hash : Hash[]) : AsyncIterableIterator<HashAndCommitObject>
  walkTree(hash : Hash) : AsyncIterableIterator<HashModePath>
  listFiles(hash: Hash): AsyncIterableIterator<HashModePath>
}

type Hash = string;

type HashAndCommitObject = {
  readonly hash : Hash
  readonly commit : CommitObject
}

type HashModePath = {
  readonly hash : Hash
  readonly mode : Mode
  readonly path : string[]
}

FAQs

Package last updated on 02 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc