Skip to content

Commit

Permalink
Add isMeitrack
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Mar 2, 2016
1 parent c98f271 commit 807e60d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,13 @@ const parse = (raw) => {
return result;
};

const isMeitrack = (raw) => {
return patterns.mvt380.test(raw.toString());
};

module.exports = {
parse: parse,
patterns: patterns,
getMvt380: getMvt380
getMvt380: getMvt380,
isMeitrack: isMeitrack
};
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,11 @@ describe('meitrack-parzer', () => {
expect(data.status.output['7']).to.be.false;
expect(data.status.output['8']).to.be.false;
});

it('should return the true', () => {
const raw = new Buffer('$$A138,862170013556541,AAA,35,7.092076,79.960473,140412132808,A,10,9,57,275,1,14,5783799,7403612,413|1|F6E0|3933,0000,000B|0009||02D8|0122,*EE\r\n');
const data = meitrack.isMeitrack(raw);
expect(data).to.be.true;
});
});
});

0 comments on commit 807e60d

Please sign in to comment.