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.0 to 1.0.1

16

index.js

@@ -23,3 +23,3 @@ const fs = require('fs');

if (!fs.existsSync(self.db) || force)
self.unzip(fn);
await self.unzip(fn);

@@ -37,10 +37,16 @@ return self;

zipInfo: (fn, prop) => {
var str = fs.createReadStream(fn).pipe(unzip.Parse());
return new Promise((resolve, reject) => {
str.on('error', reject);
str.on('entry', entry => resolve(prop ? entry[prop] : entry));
fs.createReadStream(fn)
.pipe(unzip.Parse())
.on('error', reject)
.on('entry', entry => resolve(prop ? entry[prop] : entry));
});
},
unzip: (fn, path = './') => {
fs.createReadStream(fn).pipe(unzip.Extract({ path }));
return new Promise((resolve, reject) => {
fs.createReadStream(fn)
.pipe(unzip.Extract({ path }))
.on('error', reject)
.on('close', resolve)
});
},

@@ -47,0 +53,0 @@ search: (cust, fn = self.db) => {

{
"name": "ofac",
"version": "1.0.0",
"version": "1.0.1",
"description": "A module to facilitate OFAC searches",

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

@@ -41,3 +41,3 @@ # OFAC

The customer object may contain the following properties, passed in pairs:
```
```javascript
{

@@ -111,3 +111,3 @@ id, country, // and/or

For more extensive examples please see the test suite
```
```javascript
const ofac = require('ofac');

@@ -122,27 +122,26 @@ ofac.init()

will produce something like:
```
```json
[{
uid: '4106',
firstName: 'helmer',
lastName: 'herrera buitrago',
sdnType: 'individual',
programList: { program: 'SDNT' },
idList: [
{ uid: '1011', idType: 'passport', idNumber: 'j287011', idCountry: 'colombia', firstName: '', lastName: '' },
{ uid: '1010', idType: 'cedula no.', idNumber: '16247821', idCountry: 'colombia', firstName: '', lastName: '' }
"uid": "4106",
"firstName": "helmer",
"lastName": "herrera buitrago",
"sdnType": "individual",
"programList": { "program": "SDNT" },
"idList": [
{ "uid": "1011", "idType": "passport", "idNumber": "j287011", "idCountry": "colombia", "firstName": "", "lastName": "" },
{ "uid": "1010", "idType": "cedula no.", "idNumber": "16247821", "idCountry": "colombia", "firstName": "", "lastName": "" }
],
akaList: [
{ uid: '7776', type: 'a.k.a.', category: 'weak', lastName: 'pacho', firstName: '' },
{ uid: '7777', type: 'a.k.a.', category: 'weak', lastName: 'h7', firstName: '' }
"akaList": [
{ "uid": "7776", "type": "a.k.a.", "category": "weak", "lastName": "pacho", "firstName": "" },
{ "uid": "7777", "type": "a.k.a.", "category": "weak", "lastName": "h7", "firstName": "" }
],
addressList: {
address: { uid: '2006', city: 'Cali', country: 'Colombia' }
"addressList": {
"address": { "uid": "2006", "city": "Cali", "country": "Colombia" }
},
dateOfBirthList: {
dateOfBirthItem: [
{ uid: '1031', dateOfBirth: '24 Aug 1951', mainEntry: 'true' },
{ uid: '1032', dateOfBirth: '05 Jul 1951', mainEntry: 'false' }
"dateOfBirthList": {
"dateOfBirthItem": [
{ "uid": "1031", "dateOfBirth": "24 Aug 1951", "mainEntry": "true" },
{ "uid": "1032", "dateOfBirth": "05 Jul 1951", "mainEntry": "false" }
]
}
}]
```

@@ -30,30 +30,35 @@ var assert = require('assert').strict;

describe('Main', () => {
before(() => {
ofac.init();
})
it('id/country', async () => {
var cust = {id: 'J287011', country: 'Colombia'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected);
describe('OFAC', () => {
describe('search', () => {
before(() => {
ofac.init();
})
it('Searched by id/country', async () => {
var cust = {id: 'J287011', country: 'Colombia'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected);
});
it('Searched by first/last', async () => {
var cust = {firstName: 'Helmer', lastName: 'Herrera-Buitrago'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected, 'Name search differs');
});
it('Checked aliases', async () => {
var cust = {firstName: 'Helmer', lastName: 'pacho'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected, 'Name search differs');
});
it('Bad XML produces exception', (done) => {
var cust = {id: 'J287011', country: 'Colombia'};
assert.rejects(
() => ofac.search(cust, 't/bad.xml').finally(done),
{message: 'Unhandled error. ([object Object])'}
);
});
it('No match found', async () => {
var cust = {firstName: 'XX', lastName: 'XX'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, [], 'Empty array expected');
});
});
it('first/last', async () => {
var cust = {firstName: 'Helmer', lastName: 'Herrera-Buitrago'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected, 'Name search differs');
});
it('aliases', async () => {
var cust = {firstName: 'Helmer', lastName: 'pacho'};
var actual = await ofac.search(cust, fn);
assert.deepEqual(actual, expected, 'Name search differs');
});
it('bad XML', (done) => {
var cust = {id: 'J287011', country: 'Colombia'};
assert.rejects(
() => ofac.search(cust, 't/bad.xml').finally(done),
{message: 'Unhandled error. ([object Object])'}
);
});
});
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