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

edipsy

v1.0.0

Published

Decent EDI file parsing in Node.js.

Downloads

7

Readme

Edipsy

Decent EDI file parsing in Node.js.

Defining file schema

File schemas are defined by each type of register existing in the file to be parsed.

In this example, there are three type of registers: 0, 1 and 2.

You should also set a type for the field data. The available types are string, number and date. If you use the date field type, please note you can define the date format using the dateFormat option.

var EdiFile = require('../index').EdiFile;

var ediFile = new EdiFile({
	"0": [{
		name: 'user_name',
		start: 2,
		end: 17,
		type: 'string',
	}, {
		name: 'user_gender',
		start: 18,
		end: 18,
		type: 'string',
	}, {
		name: 'user_ssn',
		start: 19,
		end: 29,
		type: 'number',
	}, {
		name: 'user_born_at',
		start: 30,
		end: 38,
		type: 'date'
	}],
	"1": [{
		name: 'product_amount',
		start: 2,
		end: 7,
		type: 'number',
	}, {
		name: 'product_name',
		start: 8,
		end: 19,
		type: 'string',
	}, {
		name: 'product_bought_at',
		start: 20,
		end: 27,
		type: 'date'
	}],
	"2": [{
		name: 'products_amount',
		start: 2,
		end: 7,
		type: 'number',
	}, {
		name: 'products_count',
		start: 8,
		end: 10,
		type: 'number',
	}]
}, {
	dateFormat: "DDMMYYYY",
});

Parsing a file

var fileContent = '\
0JOHN APPLESEED  M1192171329619071996\n\
1300000MACBOOK AIR 11062015\n\
1150000IPHONE 6S   01082014\n\
2450000002';

var parsedFile = ediFile.parse(fileContent);

parsedFile will contain the parsed file separated by each type of register:

{ '0': 
   [ { user_name: 'JOHN APPLESEED',
       user_gender: 'M',
       user_ssn: 11921713296,
       user_born_at: Fri Jul 19 1996 00:00:00 GMT-0700 (PDT) } ],
  '1': 
   [ { product_amount: 300000,
       product_name: 'MACBOOK AIR',
       product_bought_at: Thu Jun 11 2015 00:00:00 GMT-0700 (PDT) },
     { product_amount: 150000,
       product_name: 'IPHONE 6S',
       product_bought_at: Fri Aug 01 2014 00:00:00 GMT-0700 (PDT) } ],
  '2': [ { products_amount: 450000, products_count: 2 } ] }