1.0.4 • Published 6 years ago

api_error_generator v1.0.4

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
6 years ago

API Errors

A useful js library for generating and error list

Usage

JS

//Import Library
var apierrors = require("api_error_generator");

//Generating the code
error_list = apierrors.generateCodes({
  ERR_BASIC: { msg: "Basic Error" },
  ERR_HTTP_BASIC: { msg: "Basic HTTP", http_code: 400 }
});
// => {"ERR_BASIC":{"msg":"Basic Error","code":0},"ERR_HTTP_BASIC":{"msg":"Basic HTTP","http_code":400,"code":1}}

//Convert a json file to a js file
apierrors.convertFile(
  inputFilename,
  outputFilename,
  (format = false),
  (codeCounterBase = 0)
);

CLI

generateapierrors -i input.json -o errors.js -f -c 0

Args:

  • --input or -i The input file, default to errors.json
  • --output or -o The output file, defaults to errors.js
  • --format or -f Whether or not to format the the output file, defaults to false
  • --counter or -c Where to start the counter, default to 0
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago