1.0.14 • Published 2 years ago

@servant/servant-stats v1.0.14

Weekly downloads
-
License
GPL-3.0-or-later
Repository
gitlab
Last release
2 years ago

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

1.0.11

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago