npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

lawkit-js

v2.5.15

Published

A Node.js wrapper for the lawkit CLI tool - statistical law analysis toolkit for fraud detection, data quality assessment, and audit compliance.

Readme

lawkit-js

Node.js wrapper for the lawkit CLI tool - comprehensive statistical law analysis toolkit for fraud detection, data quality assessment, and business intelligence.

Installation

npm install lawkit-js

Includes all platform binaries (universal bundle) - no download required.

Supported Platforms

  • Linux: x86_64
  • macOS: x86_64 and Apple Silicon (ARM64)
  • Windows: x86_64

All binaries are pre-bundled in the package for immediate use:

bin/
├── linux-x64/lawkit
├── darwin-x64/lawkit  
├── darwin-arm64/lawkit
└── win32-x64/lawkit.exe

Quick Start

CLI Usage

# Fraud detection with Benford Law
lawkit benf financial-data.csv

# Business analysis with Pareto principle
lawkit pareto sales.csv --business-analysis

# Multi-law analysis
lawkit analyze data.csv --laws benf,pareto,zipf

# Data validation
lawkit validate data.csv --consistency-check

# Conflict diagnosis
lawkit diagnose data.csv --report detailed

# Generate test data
lawkit generate benf --count 1000 --output-file test-data.csv

JavaScript API

const { benford, pareto, zipf, normal, poisson, analyze, validate, diagnose, generate, list } = require('lawkit-js');

// Analyze array data
const numbers = [1, 10, 100, 1000, 2000];
const result = await benford(numbers, { output: 'json' });
console.log('Risk level:', result.risk_level);

// Analyze file data
const fileResult = await benford('data.csv', { 
  output: 'json',
  confidence: 0.99 
});

// Generate sample data
const sampleData = await generate('benf', { 
  count: 1000,
  outputFile: 'sample.csv' 
});

// Multi-law analysis
const analysisResult = await analyze('data.csv', {
  output: 'json',
  crossValidation: true
});

// Data validation
const validationResult = await validate('data.csv', {
  consistencyCheck: true,
  report: true
});

// List available laws
const availableLaws = await list({ output: 'json' });

API Reference

Analysis Functions

benford(data, options)

Analyze data using Benford's Law for fraud detection.

pareto(data, options)

Analyze data using the Pareto Principle for business insights.

zipf(data, options)

Analyze data using Zipf's Law for text and frequency analysis.

normal(data, options)

Analyze data using Normal Distribution for quality control.

poisson(data, options)

Analyze data using Poisson Distribution for event analysis.

analyze(data, options)

Perform comprehensive multi-law analysis.

validate(data, options)

Validate data quality using statistical tests.

diagnose(data, options)

Diagnose data anomalies and provide recommendations.

Utility Functions

generate(law, options)

Generate sample data for testing statistical laws.

list(options)

List available statistical laws and commands.

isLawkitAvailable()

Check if the lawkit binary is available.

Options

All analysis functions accept these common options:

interface LawkitOptions {
  output?: 'text' | 'json' | 'csv' | 'yaml' | 'toml' | 'xml';
  minCount?: number;
  confidence?: number;
  sampleSize?: number;
  minValue?: number;
  quiet?: boolean;
  verbose?: boolean;
  outputFile?: string;
  businessAnalysis?: boolean;
  giniCoefficient?: boolean;
  percentiles?: string;
  crossValidation?: boolean;
  consistencyCheck?: boolean;
  confidenceLevel?: number;
  report?: boolean;
}

Error Handling

const { benford, LawkitError } = require('lawkit-js');

try {
  const result = await benford('data.csv', { output: 'json' });
  console.log(result);
} catch (error) {
  if (error instanceof LawkitError) {
    console.error('lawkit error:', error.message);
    console.error('Exit code:', error.exitCode);
    console.error('stderr:', error.stderr);
  } else {
    console.error('Unexpected error:', error);
  }
}

Features

  • Universal Binary Support: Automatic platform detection and binary download
  • Comprehensive API: Full JavaScript API with TypeScript definitions
  • Statistical Laws: Benford, Pareto, Zipf, Normal, Poisson distributions
  • Advanced Analysis: Multi-law comparison, validation, diagnostics
  • Data Generation: Create test datasets for validation
  • Multiple Output Formats: JSON, CSV, YAML, TOML, XML support
  • Business Intelligence: Built-in business analysis features
  • Cross-platform: Linux, macOS (Intel & ARM), Windows support

Requirements

  • Node.js 12.0.0 or higher
  • Internet connection for initial binary download

License

MIT

Links