Giter Site home page Giter Site logo

yigitcukuren / linguist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeisenberg/linguist

0.0 1.0 0.0 2.64 MB

A tool to count the code in the repo

JavaScript 3.30% TypeScript 88.77% Less 4.58% EJS 3.07% HTML 0.03% Python 0.08% Ruby 0.04% C# 0.13%

linguist's Introduction

github-linguist

๐Ÿ’ป Counts the number of lines of code, written in TypeScript.

Warning: This package uses regular expressions to approximate the lines of code in a project. The results are not 100% precise because the regular expressions can return mistakes in edge cases, for example if comment tokens are present inside of multiline strings.

Prerequisites

  • Node.js 6+

Install

npm install github-linguist

or

yarn add github-linguist

Usage

You can use loc in you ternimal, or as a npm package in your projects.

Command line mode

Supports counting lines of code of a file or directory.

1. Lines of code in a single file

# loc file <path>
loc file src/index.ts

loc file <path>

2. Lines of code in a directory

# loc <pattern>
loc dir **/*.ts

loc dir <pattern>

Third-party mode

import { LocFile, LocDir } from 'github-linguist';

// for a file.
const file = new LocFile(filePath);
const { info } = file.getInfo();

//  for a directory.
const dir = new LocDir({
  cwd: // root directory, or leave blank to use process.cwd()
  include: // string or string[] containing path patterns to include (default include all)
  exclude: // string or string[] containing path patterns to exclude (default exclude none)
});
const { info } = dir.loadInfo();

License

MIT License.

linguist's People

Contributors

aeisenberg avatar chenshuai2144 avatar edoardopirovano avatar yigitcukuren avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.