ladder

0.0.1 • Public • Published

ladder

A library to detect JSON indentation

Install

$ npm install ladder

Tests

$ npm test

Methods

ladder(jsonString)

jsonString is a valid json string. It returns either the number of spaces or '\t' if tabs are used

Examples

test.json

{
  "test": "hellow"
}

example.js

var ladder = require('ladder'),
    fs     = require('fs'),
    path   = require('path');
 
fs.readFile(path.resolve('./test.json'), function(e, data) {
  console.log(ladder(data.toString())); // => 2
});

License

MIT

/ladder/

    Package Sidebar

    Install

    npm i ladder

    Weekly Downloads

    4

    Version

    0.0.1

    License

    none

    Last publish

    Collaborators

    • yawnt