New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.13 to 1.0.14

66

index.js

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

xml: 'sdn.xml',
fetch: (url, opts) => fetch(url, opts)
fetch
},

@@ -38,3 +38,3 @@ config: (opts) => {

res.body.pipe(dest, {end: true});
dest.on('close', () => resolve(fn));
res.body.on('close', () => resolve(fn));
dest.on('error', reject);

@@ -127,6 +127,11 @@ }));

function lc(o) {
for (var k in o) if (o.hasOwnProperty(k) && typeof o[k] == 'string')
o[k] = o[k].toLowerCase();
for (var k of 'firstName|lastName'.split('|'))
o[k] = (o[k] || '').replace(/\W/g, ' ');
var t = typeof o;
if (t == 'undefined') return '';
if (t == 'string') return o.toLowerCase();
if (Array.isArray(o) || t != 'object') return o;
o.each(o => typeof o == 'string' ? o.toLowerCase() : o);
for (var k of 'firstName/lastName'.split('/'))
if (o[k]) o[k] = (o[k] || '').replace(/\W/g, ' ');
return o;

@@ -137,17 +142,10 @@ }

o = o.sdnEntry;
if (o.idList) {
o.idList = o.idList.id;
if (!Array.isArray(o.idList)) o.idList = [o.idList];
for (var i = 0; i < o.idList.length; i++)
lc(o.idList[i]);
} else o.idList = [];
if (o.akaList) {
o.akaList = o.akaList.aka;
if (!Array.isArray(o.akaList)) o.akaList = [o.akaList];
for (var i = 0; i < o.akaList.length; i++)
lc(o.akaList[i]);
} else o.akaList = [];
return lc(o);
for (var k in o) {
if (!k.match(/List$/)) continue;
if (!o[k]) { o[k] = []; continue; }
let kk = Object.keys(o[k])[0];
o[k] = (o[k] || {})[kk] || [];
if (!Array.isArray(o[k])) o[k] = [o[k]];
}
return o;
}

@@ -159,7 +157,7 @@

var ok = res.idList.filter(o => {
let ok = o.idNumber == cust.id;
let ok = lc(o.idNumber) == cust.id;
if (o.idCountry && cust.country)
ok = ok && o.idCountry == cust.country;
ok = ok && lc(o.idCountry) == cust.country;
if (o.idType && cust.id_type)
ok = ok && o.idType == cust.id_type;
ok = ok && lc(o.idType) == cust.id_type;
return ok;

@@ -173,5 +171,5 @@ });

if (res.firstName && cust.firstName)
ok = ok && res.firstName == cust.firstName;
ok = ok && lc(res.firstName) == cust.firstName;
if (res.lastName && cust.lastName)
ok = ok && res.lastName == cust.lastName;
ok = ok && lc(res.lastName) == cust.lastName;
if (ok) return true;

@@ -183,4 +181,4 @@

let o = res.akaList[i];
let ok = (o.firstName || res.firstName || '') == cust.firstName;
ok = ok && (o.lastName || res.lastName || '') == cust.lastName;
let ok = lc(o.firstName || res.firstName || '') == cust.firstName;
ok = ok && lc(o.lastName || res.lastName || '') == cust.lastName;
if (ok) return true;

@@ -190,2 +188,12 @@ }

}
};
};
if (!Object.prototype.keys)
Object.prototype.keys = function() {
return Object.keys(this);
}
if (!Object.prototype.each)
Object.prototype.each = function(fn) {
this.keys().map(k => this[k] = fn(this[k], k));
}
{
"name": "ofac",
"version": "1.0.13",
"version": "1.0.14",
"description": "A module to facilitate local OFAC searches",

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

@@ -8,23 +8,21 @@ var fs = require('fs');

uid: '4106',
firstName: 'helmer',
lastName: 'herrera buitrago',
sdnType: 'individual',
programList: { program: 'SDNT' },
firstName: 'Helmer',
lastName: 'HERRERA BUITRAGO',
sdnType: 'Individual',
programList: [ 'SDNT' ],
idList: [
{ uid: '1011', idType: 'passport', idNumber: 'j287011', idCountry: 'colombia', firstName: '', lastName: '' },
{ uid: '1010', idType: 'cedula no.', idNumber: '16247821', idCountry: 'colombia', firstName: '', lastName: '' }
{ uid: '1011', idType: 'Passport', idNumber: 'J287011', idCountry: 'Colombia' },
{ uid: '1010', idType: 'Cedula No.', idNumber: '16247821', idCountry: 'Colombia' }
],
akaList: [
{ uid: '7776', type: 'a.k.a.', category: 'weak', lastName: 'pacho', firstName: '' },
{ uid: '7777', type: 'a.k.a.', category: 'weak', lastName: 'h7', firstName: '' }
{ uid: '7776', type: 'a.k.a.', category: 'weak', lastName: 'PACHO' },
{ uid: '7777', type: 'a.k.a.', category: 'weak', lastName: 'H7' }
],
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' }
]
}
addressList: [
{ uid: '2006', city: 'Cali', country: 'Colombia' }
],
dateOfBirthList: [
{ uid: '1031', dateOfBirth: '24 Aug 1951', mainEntry: 'true' },
{ uid: '1032', dateOfBirth: '05 Jul 1951', mainEntry: 'false' }
]
}];

@@ -36,8 +34,5 @@

before(() => {
function pipe(dest) {
var rs = fs.createReadStream('t/sdn.xml.zip')
rs.pipe(dest);
}
var rs = fs.createReadStream('t/sdn.xml.zip')
ofac.config({
fetch: () => Promise.resolve({body: {pipe}})
fetch: () => Promise.resolve({body: rs})
})

@@ -44,0 +39,0 @@ if (fs.existsSync(zip)) fs.unlinkSync(zip);

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