Socket
Socket
Sign inDemoInstall

curl_ifrs

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

test/output.sh

56

build_ifrs_curls.js

@@ -6,5 +6,5 @@ #!/usr/bin/env node

/** Build downloaded filename from Standard title */
const buildFilename = title => {
const numMap = new Map([
/** Build local filename from title of a Standard */
const buildLocalName = title => {
const conversion = [
['IFRS ', '1'],

@@ -14,15 +14,12 @@ ['IAS ', '2'],

['SIC-', '4'],
]);
for (const [key, val] of numMap.entries()) {
const pf = title.match(new RegExp(`^${key}(\\d+) .*`));
if (pf) {
return `${val}${('0' + pf[1]).slice(-2)} ${title}.pdf`;
}
}
return `${title}.pdf`;
];
return conversion.reduce((prev, [from, to]) => {
const pf = title.match(new RegExp(`^${from}(\\d+) .*`));
return pf ? to + ('0' + pf[1]).slice(-2) + ' ' + title : prev;
}, title) + '.pdf';
};
/** Build download URL from Standard title */
const buildUrl = (title, baseUrl) => {
const urlMap = new Map([
/** Build remote filename from title of a Standard */
const buildRemoteName = title => {
const conversion = [
['IFRS ', 'IFRS'],

@@ -32,10 +29,7 @@ ['IAS ', 'IAS'],

['SIC-', 'SIC'],
]);
for (const [key, val] of urlMap.entries()) {
const pf = title.match(new RegExp(`^${key}(\\d+) .*`));
if (pf) {
return `${baseUrl}${val}${pf[1]}.pdf`;
}
}
return `${baseUrl}${title}.pdf`;
];
return conversion.reduce((prev, [from, to]) => {
const pf = title.match(new RegExp(`^${from}(\\d+) .*`));
return pf ? to + pf[1] : prev;
}, title) + '.pdf';
};

@@ -51,11 +45,13 @@

const regulars = titles.map(title => [
baseUrl + buildRemoteName(title),
buildLocalName(title),
]);
const cookie = 'Cookie: JSESSIONID=' + jsessionid;
const printCurl = (url, filename) => {
console.log(`curl -H '${cookie}' '${filename}' > '${url}'`);
const printCurl = ([url, saveas]) => {
console.log(`curl -H '${cookie}' '${url}' > '${saveas}'`);
};
new Map(titles.map(title => [
buildUrl(title, baseUrl),
buildFilename(title),
])).forEach(printCurl);
regulars.forEach(printCurl);
irregulars.forEach(printCurl);

@@ -134,3 +130,3 @@

const irregulars = new Map([
const irregulars = [
[baseUrl + 'framework.pdf', '100 Conceptual Framework for Financial Reporting.pdf'],

@@ -140,3 +136,3 @@ [baseUrl + 'SIC07.pdf', '407 SIC-7 Introduction of the Euro.pdf'],

[baseUrl + 'PS02.pdf', '502 Practice Statement 2: Making Materiality Judgements.pdf'],
]);
];

@@ -143,0 +139,0 @@

{
"name": "curl_ifrs",
"version": "1.0.2",
"version": "1.0.3",
"description": "Utility to download latest unaccompanied IFRS using curl.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "build_ifrs_curls \\$JSESSIONID | diff -u test/output.sh -"
},

@@ -8,0 +8,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc