Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Get a git-like diffstat from a css-analyzer-diff and see how much your stats have changed.

License

Notifications You must be signed in to change notification settings

projectwallace/css-analysis-diffstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-analysis-diffstat

Get a git-like diffstat from a css-analyzer-diff and see how much your stats have changed.

NPM Version Weekly downloads Build Status Known Vulnerabilities Dependencies Status Dependencies Status XO code style Project: Wallace

Installation

npm install css-analysis-diffstat

Usage

const cssAnalysisDiffStat = require('css-analysis-diffstat')

// Diff calculated by https://github.com/bartveneman/css-analyzer-diff
const cssAnalyzerDiff = {
  'colors.total': {
    oldValue: 2,
    newValue: 4,
    changed: true,
    diff: {absolute: 2, relative: 1}
  },
  'rules.total': {
    oldValue: 4,
    newValue: 2,
    changed: true,
    diff: {absolute: -2, relative: -0.5}
  },
  'declarations.importants.total': {
    oldValue: 1,
    newValue: 0,
    changed: true,
    diff: {absolute: -1, relative: -1}
  },
  'selectors.identifiers.max.value': {
    oldValue: 'oldValue',
    newValue: 'newValue',
    changed: true
  },
  'colors.unique': [
    {
      value: 'red',
      added: true,
      changed: true,
      removed: false
    },
    {
      value: 'blue',
      added: false,
      changed: false,
      removed: false
    }
  ]
}

const diffStat = cssAnalysisDiffStat(cssAnalyzerDiff)

// =>
{
  changes: 5,
  additions: 4,
  deletions: 4,
  changeRatio: 0.8,
  additionRatio: 0.5,
  deletionRatio: 0.5
}

Related projects

About

Get a git-like diffstat from a css-analyzer-diff and see how much your stats have changed.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published