Skip to content

SteveyPugs/fixy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version Dependency Status devDependency Status Build Status

Fixy

Fixy is an npm module for parsing fixed formatted strings/files.

Install

npm install fixy --save

Usage

var fixy = fixy.parse({
	map: [{
		name: "Age",
		width: 2,
		start: 1,
		type: "int"
	}],
	options: {
		fullwidth: 2,
		skiplines: null,
		format: "json" //default
	}
},"30ABC20151201Y950");

Configuration

map

A map [array of objects] of the column names, width, starting point, type of value, extra type settings.

  • Integer
    • type : "int"
    • name (Required) | Name of the Column
    • width (Required) | Length of Column
    • start (Required) | Start of Column in Row
  • Float
    • type : "float"
    • name (Required) | Name of the Column
    • width (Required) | Length of Column
    • start (Required) | Start of Column in Row
    • percision (Required) | Float Percision Value (Ex: 9.20 is 2)
  • Date
    • type : "date"
    • name (Required) | Name of the Column
    • width (Required) | Length of Column
    • start (Required) | Start of Column in Row
    • inputformat (Required) | Format Date Date is Currently In
    • outputformat (Required) | Format Date Date is Returned As
  • String
    • type : "string"
    • name (Required) | Name of the Column
    • width (Required) | Length of Column
    • start (Required) | Start of Column in Row
  • Boolean
    • type : "bool"
    • name (Required) | Name of the Column
    • width (Required) | Length of Column
    • start (Required) | Start of Column in Row
    • tVal (Required) | String Value of True
    • fVal (Required) | String Value of False
options
  • fullwidth = full length / width of row from start to end
  • skiplines = optional array of rows to be skipped. May be left null
  • format = defaults "json". Valid selections are: json, csv

About

A fixed width file parser for Node.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 10