@servant/servant-stats
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

Servant Servant stats module

Quick references: Command line, Node API, servant.json, dev-server

What is it?

This module is for internal usage in servant. Can receive file stats base on files paths. Is expected that file paths are loaded before with some glob pattern module or something similar.

Simple usage

import { stats } from "@servant/servant-stats";

async function loadStats() {
	const data = stats(files);

	console.log(data);
}
{
	files: {
		"/content/sources/index.css": {
			file: "/content/sources/index.css",

			//object stats
			// type 0 => unknown
			// type 1 => directory
			// type 2 => file
			// type 3 => link
			stats: { size: 100, type: 2 },

			//options: countLines = true
			//sum count of lines for file
			//  all => all files
			//  meaningful => non empty liens and lines that are not part of comments
			lines: { all: 6, meaningful: 4 },
		},
	},
	lines: {
		//options: countLines = true
		//sum count of lines based on extension
		".css": { all: 6, meaningful: 4 },
	},
}

option: countLines, default value true

If this options is turned on, stats also count lines in files. Default value is true so module automatically count of lines for every provided file. Can be turned off. Returned object has still lines, but are not filled and for file return -1 as lines count.

const data = stats(files, { countLines: false });

License

Licensed under GPLv3

Playwright is licensed under Apache-2.0

Package Sidebar

Install

npm i @servant/servant-stats

Weekly Downloads

3

Version

1.0.14

License

GPL-3.0-or-later

Unpacked Size

48.2 kB

Total Files

9

Last publish

Collaborators

  • hacker.stanislav