@servant/servant-stats
v1.0.14
Published
Stats analyzer for servant build tool
Downloads
12
Maintainers
Readme
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
Playwright is licensed under Apache-2.0