New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

code-info

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-info - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

dist-cjs/data/fileSize.d.ts

2

dist-cjs/bin/argv.d.ts
import arg from 'arg';
declare const args: arg.Result<{
'--size': StringConstructor;
'--type': [StringConstructor];
'--exclude': [StringConstructor];
'--include': [StringConstructor];
'-s': string;
'-t': string;

@@ -7,0 +9,0 @@ '-e': string;

@@ -8,5 +8,7 @@ "use strict";

const args = (0, arg_1.default)({
'--size': String,
'--type': [String],
'--exclude': [String],
'--include': [String],
'-s': '--size',
'-t': '--type',

@@ -13,0 +15,0 @@ '-e': '--exclude',

39

dist-cjs/bin/main.js

@@ -10,2 +10,3 @@ "use strict";

const index_js_1 = __importDefault(require("../index.js"));
const fileSize_js_1 = __importDefault(require("../data/fileSize.js"));
const { overview, details } = (0, index_js_1.default)(argv_js_1.default._[0], {

@@ -17,5 +18,17 @@ exclude: argv_js_1.default['--exclude'],

console.log();
const getFileSizeLabel = (label) => {
var _a;
return (label +
` (${fileSize_js_1.default[argv_js_1.default['--size']] ? (_a = argv_js_1.default['--size']) === null || _a === void 0 ? void 0 : _a.toUpperCase() : 'Bytes'})`);
};
const getFileSize = (bytes) => {
var _a;
const base = (_a = fileSize_js_1.default[argv_js_1.default['--size']]) !== null && _a !== void 0 ? _a : 0;
if (!base)
return bytes;
return (bytes / base).toFixed(2);
};
const group = (label, options) => {
console.log('', ansi_colors_1.default.blueBright.bold(label + ':'));
console.log(new cli_table_1.default(Object.assign({ colAligns: ['left', 'middle', 'right', 'right', 'right'] }, options)).toString());
console.log(new cli_table_1.default(Object.assign({ colAligns: ['left', 'middle', 'right', 'right', 'right', 'right'] }, options)).toString());
console.log();

@@ -32,9 +45,10 @@ };

group('Basic Overview', {
head: ['Files', 'Lines', 'ACPL', 'Size (bytes)'],
head: ['Files', 'Lines', 'LPF', 'CPL', getFileSizeLabel('Size')],
rows: [
[
overview.basic.files.toString(),
overview.basic.lines.toString(),
overview.basic.avgCharPerLine.toString(),
overview.basic.size.toString(),
overview.basic.files,
overview.basic.lines,
overview.basic.avgLinePerFile,
overview.basic.avgCharPerLine,
getFileSize(overview.basic.size),
],

@@ -46,6 +60,13 @@ ],

group('Languages details', {
head: ['Name', 'Files', 'Lines', 'ACPL', 'Size (bytes)'],
rows: details.map(({ name, lines, size, files, avgCharPerLine }) => {
return [name, files, lines, avgCharPerLine, size];
head: ['Name', 'Files', 'Lines', 'LPF', 'CPL', getFileSizeLabel('Size')],
rows: details.map(({ name, lines, size, files, avgCharPerLine, avgLinePerFile }) => {
return [
name,
files,
lines,
avgLinePerFile,
avgCharPerLine,
getFileSize(size),
];
}),
});
import { GetFiles } from './scripts/_getFiles.js';
export declare const getFilesInfo: (dir?: string | undefined, config?: GetFiles | undefined) => import("./scripts/getFilesInfo.js").FileInfo[];
export declare const getDetails: (details: import("./scripts/getFilesInfo.js").FileInfo[]) => import("./scripts/getDetails.js").Details[];
export declare const getOverview: (details: import("./scripts/getDetails.js").Details[]) => any;
import getFilesInfo from './scripts/getFilesInfo.js';
import getDetails from './scripts/getDetails.js';
import getOverview from './scripts/getOverview.js';
export { getFilesInfo, getDetails, getOverview };
declare const _default: (dir?: string, config?: GetFiles) => {

@@ -6,0 +7,0 @@ files: import("./scripts/getFilesInfo.js").FileInfo[];

@@ -8,11 +8,11 @@ "use strict";

const getFilesInfo_js_1 = __importDefault(require("./scripts/getFilesInfo.js"));
exports.getFilesInfo = getFilesInfo_js_1.default;
const getDetails_js_1 = __importDefault(require("./scripts/getDetails.js"));
exports.getDetails = getDetails_js_1.default;
const getOverview_js_1 = __importDefault(require("./scripts/getOverview.js"));
exports.getFilesInfo = getFilesInfo_js_1.default;
exports.getDetails = getDetails_js_1.default;
exports.getOverview = getOverview_js_1.default;
exports.default = (dir, config) => {
const files = (0, exports.getFilesInfo)(dir, config);
const details = (0, exports.getDetails)(files);
const overview = (0, exports.getOverview)(details);
const files = (0, getFilesInfo_js_1.default)(dir, config);
const details = (0, getDetails_js_1.default)(files);
const overview = (0, getOverview_js_1.default)(details);
return {

@@ -19,0 +19,0 @@ files,

@@ -8,4 +8,5 @@ import { FileInfo } from './getFilesInfo';

avgCharPerLine: number;
avgLinePerFile: number;
}
declare const _default: (details: FileInfo[]) => Details[];
export default _default;

@@ -51,2 +51,3 @@ "use strict";

avgCharPerLine: Math.round(totalCharPerLine / details.length),
avgLinePerFile: Math.round(totalLines / details.length),
size: +totalSize.toFixed(1),

@@ -53,0 +54,0 @@ });

@@ -7,2 +7,3 @@ import { Details } from './getDetails.js';

avgCharPerLine: number;
avgLinePerFile: number;
}

@@ -9,0 +10,0 @@ interface OverviewLangStats {

@@ -12,2 +12,3 @@ "use strict";

avgCharPerLine: 0,
avgLinePerFile: 0,
};

@@ -23,2 +24,3 @@ const mostUsedBySize = [];

basic.avgCharPerLine = Math.round(basic.avgCharPerLine / details.length);
basic.avgLinePerFile = Math.round(basic.lines / basic.files);
details.forEach((dt) => {

@@ -25,0 +27,0 @@ const getPercentage = (key) => {

import arg from 'arg';
declare const args: arg.Result<{
'--size': StringConstructor;
'--type': [StringConstructor];
'--exclude': [StringConstructor];
'--include': [StringConstructor];
'-s': string;
'-t': string;

@@ -7,0 +9,0 @@ '-e': string;

import arg from 'arg';
const args = arg({
'--size': String,
'--type': [String],
'--exclude': [String],
'--include': [String],
'-s': '--size',
'-t': '--type',

@@ -7,0 +9,0 @@ '-e': '--exclude',

@@ -5,2 +5,3 @@ import argv from './argv.js';

import getAll from '../index.js';
import fileSize from '../data/fileSize.js';
const { overview, details } = getAll(argv._[0], {

@@ -12,5 +13,17 @@ exclude: argv['--exclude'],

console.log();
const getFileSizeLabel = (label) => {
var _a;
return (label +
` (${fileSize[argv['--size']] ? (_a = argv['--size']) === null || _a === void 0 ? void 0 : _a.toUpperCase() : 'Bytes'})`);
};
const getFileSize = (bytes) => {
var _a;
const base = (_a = fileSize[argv['--size']]) !== null && _a !== void 0 ? _a : 0;
if (!base)
return bytes;
return (bytes / base).toFixed(2);
};
const group = (label, options) => {
console.log('', ac.blueBright.bold(label + ':'));
console.log(new Table(Object.assign({ colAligns: ['left', 'middle', 'right', 'right', 'right'] }, options)).toString());
console.log(new Table(Object.assign({ colAligns: ['left', 'middle', 'right', 'right', 'right', 'right'] }, options)).toString());
console.log();

@@ -27,9 +40,10 @@ };

group('Basic Overview', {
head: ['Files', 'Lines', 'ACPL', 'Size (bytes)'],
head: ['Files', 'Lines', 'LPF', 'CPL', getFileSizeLabel('Size')],
rows: [
[
overview.basic.files.toString(),
overview.basic.lines.toString(),
overview.basic.avgCharPerLine.toString(),
overview.basic.size.toString(),
overview.basic.files,
overview.basic.lines,
overview.basic.avgLinePerFile,
overview.basic.avgCharPerLine,
getFileSize(overview.basic.size),
],

@@ -41,6 +55,13 @@ ],

group('Languages details', {
head: ['Name', 'Files', 'Lines', 'ACPL', 'Size (bytes)'],
rows: details.map(({ name, lines, size, files, avgCharPerLine }) => {
return [name, files, lines, avgCharPerLine, size];
head: ['Name', 'Files', 'Lines', 'LPF', 'CPL', getFileSizeLabel('Size')],
rows: details.map(({ name, lines, size, files, avgCharPerLine, avgLinePerFile }) => {
return [
name,
files,
lines,
avgLinePerFile,
avgCharPerLine,
getFileSize(size),
];
}),
});
import { GetFiles } from './scripts/_getFiles.js';
export declare const getFilesInfo: (dir?: string | undefined, config?: GetFiles | undefined) => import("./scripts/getFilesInfo.js").FileInfo[];
export declare const getDetails: (details: import("./scripts/getFilesInfo.js").FileInfo[]) => import("./scripts/getDetails.js").Details[];
export declare const getOverview: (details: import("./scripts/getDetails.js").Details[]) => any;
import getFilesInfo from './scripts/getFilesInfo.js';
import getDetails from './scripts/getDetails.js';
import getOverview from './scripts/getOverview.js';
export { getFilesInfo, getDetails, getOverview };
declare const _default: (dir?: string, config?: GetFiles) => {

@@ -6,0 +7,0 @@ files: import("./scripts/getFilesInfo.js").FileInfo[];

@@ -1,7 +0,5 @@

import _getFilesInfo from './scripts/getFilesInfo.js';
import _getDetails from './scripts/getDetails.js';
import _getOverview from './scripts/getOverview.js';
export const getFilesInfo = _getFilesInfo;
export const getDetails = _getDetails;
export const getOverview = _getOverview;
import getFilesInfo from './scripts/getFilesInfo.js';
import getDetails from './scripts/getDetails.js';
import getOverview from './scripts/getOverview.js';
export { getFilesInfo, getDetails, getOverview };
export default (dir, config) => {

@@ -8,0 +6,0 @@ const files = getFilesInfo(dir, config);

@@ -8,4 +8,5 @@ import { FileInfo } from './getFilesInfo';

avgCharPerLine: number;
avgLinePerFile: number;
}
declare const _default: (details: FileInfo[]) => Details[];
export default _default;

@@ -26,2 +26,3 @@ import langList, { langExtList } from '../data/langList.js';

avgCharPerLine: Math.round(totalCharPerLine / details.length),
avgLinePerFile: Math.round(totalLines / details.length),
size: +totalSize.toFixed(1),

@@ -28,0 +29,0 @@ });

@@ -7,2 +7,3 @@ import { Details } from './getDetails.js';

avgCharPerLine: number;
avgLinePerFile: number;
}

@@ -9,0 +10,0 @@ interface OverviewLangStats {

@@ -10,2 +10,3 @@ const sortAlgoFn = (something) => {

avgCharPerLine: 0,
avgLinePerFile: 0,
};

@@ -21,2 +22,3 @@ const mostUsedBySize = [];

basic.avgCharPerLine = Math.round(basic.avgCharPerLine / details.length);
basic.avgLinePerFile = Math.round(basic.lines / basic.files);
details.forEach((dt) => {

@@ -23,0 +25,0 @@ const getPercentage = (key) => {

{
"name": "code-info",
"version": "1.0.6",
"version": "1.0.7",
"description": "code-info",

@@ -16,3 +16,3 @@ "preferGlobal": true,

"scripts": {
"ci": "node --watch dist-cjs/bin/index.js",
"test": "node --watch dist-cjs/bin/index.js",
"dev": "npm-ez dev",

@@ -19,0 +19,0 @@ "build": "npm-ez build"

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