Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ofac

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ofac - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

17

index.js

@@ -62,2 +62,19 @@ const fs = require('fs');

},
dbinfo: async () => {
var ret = {};
if (!self.db) await self.init();
return new Promise((resolve, reject) => {
var ln = readline.createInterface({
input: fs.createReadStream(self.db)
});
ln.on('line', function (line) {
var m = line.match(/(Publish_Date|Record_Count)/);
if (m) ret[m[1].replace('_', ' ')] = line.replace(/<.*?>/g, '').trim();
if (ret['Record Count']) {
ln.close();
resolve(ret);
}
});
});
},
search: async (cust, fn = self.db) => {

@@ -64,0 +81,0 @@ if (!fn) fn = await self.init();

2

package.json
{
"name": "ofac",
"version": "1.0.12",
"version": "1.0.13",
"description": "A module to facilitate local OFAC searches",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -91,4 +91,16 @@ var fs = require('fs');

assert.equal(stats.size, 10128, 'File incomplete')
});
});
})
})
describe('Archive information', () => {
var info;
before(async () => {
info = await ofac.dbinfo();
})
it('Returns publish date', () => {
assert.equal(info['Publish Date'], '03/11/2019', 'Date extraction failed')
})
it('Returns record count', () => {
assert.equal(info['Record Count'], '7449', 'Record count extraction failed')
})
})
describe('Search', () => {

@@ -99,3 +111,3 @@ it('Searched by id/country', async () => {

assert.deepEqual(actual, expected);
});
})
it('Searched by id/country with type', async () => {

@@ -105,3 +117,3 @@ var cust = {id: 'J287011', id_type: 'Passport', country: 'Colombia'};

assert.deepEqual(actual, expected);
});
})
it('Searched by id/country with wrong type', async () => {

@@ -111,3 +123,3 @@ var cust = {id: 'J287011', id_type: 'Cedula No.', country: 'Colombia'};

assert.deepEqual(actual, []);
});
})
it('Searched by first/last', async () => {

@@ -117,3 +129,3 @@ var cust = {firstName: 'Helmer', lastName: 'HERRERA BUITRAGO'};

assert.deepEqual(actual, expected, 'Name search differs');
});
})
it('Searched case insensitive', async () => {

@@ -123,3 +135,3 @@ var cust = {firstName: 'Helmer', lastName: 'herrera buitrago'};

assert.deepEqual(actual, expected, 'Name search differs');
});
})
it('Searched clean names', async () => {

@@ -129,3 +141,3 @@ var cust = {firstName: 'Helmer', lastName: 'herrera-buitrago'};

assert.deepEqual(actual, expected, 'Name search differs');
});
})
it('Checked aliases', async () => {

@@ -135,3 +147,3 @@ var cust = {firstName: 'Helmer', lastName: 'pacho'};

assert.deepEqual(actual, expected, 'Name search differs');
});
})
it('Uses external path', async () => {

@@ -151,3 +163,3 @@ var moved = fn.replace(/xml$/, 'moved.xml')

);
});
})
it('No match found', async () => {

@@ -157,4 +169,4 @@ var cust = {firstName: 'XX', lastName: 'XX'};

assert.deepEqual(actual, [], 'Empty array expected');
});
});
});
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc