New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

idea-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
381
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-toolbox - npm Package Compare versions

Comparing version 0.10.2 to 0.11.0

CONTRIBUTING.md

54

index.js

@@ -35,4 +35,5 @@ 'use strict';

createSNSPushPlatormEndpoint, publishSNSPush,
// OTHER
ISODateToItalianFormat, cleanStr, joinArraysOnKeys, isEmpty
// UTILITIES
ISODateToItalianFormat, cleanStr, joinArraysOnKeys, isEmpty, APIrequest,
saveObjToFile, sequelizeConnectToDB
}

@@ -448,3 +449,3 @@

///
/// OTHER
/// UTILITIES
///

@@ -523,2 +524,49 @@

}
}
/**
* Request wrapper to enable API requests with simplified parameters
* @param {*} method enum: HTTP methods
* @param {*} options typical requests options (e.g. url, body, headers, etc.)
* @return Promise
*/
function APIrequest(method, options) {
return new Promise((resolve, reject) => {
// prepare the parameters and the options
method = method.toLowerCase();
options.body = options.body ? JSON.stringify(options.body) : null;
// execute the request and reject or resolve the promise
Request[method](options, (err, data) => {
if(err) reject(err);
else resolve(JSON.parse(data.body));
});
});
}
/**
* Save the content of an object to the desired folder (as a log file).
* @param {*} name name of the object (== filename)
* @param {*} obj the JSON object
* @param {*} folder if null, uses the Config.LOGS.FOLDER
*/
function saveObjToFile(name, obj, folder) {
folder = folder || Config.LOGS.FOLDER;
Fs.writeFileSync(`${folder}/${name}.json`, JSON.stringify(obj));
}
/**
* Connect to a db through the usual IDEA's configuration and return a usable Sequelize object.
* @param {*} dbConfig {
* DATABASE: string; PASSWORD: string, HOST: stirng, DIALECT: string, INSTANCE: string
* LOGGING: string
* }
* @return Sequelize object
*/
function sequelizeConnectToDB(dbConfig) {
return new Sequelize(dbConfig.DATABASE, dbConfig.USERNAME, dbConfig.PASSWORD, {
host: dbConfig.HOST,
dialect: dbConfig.DIALECT,
logging: dbConfig.LOGGING,
dialectOptions: { instanceName: dbConfig.INSTANCE }
});
}

2

package.json
{
"name": "idea-toolbox",
"version": "0.10.2",
"version": "0.11.0",
"description": "IDEA's utility functions",

@@ -5,0 +5,0 @@ "engines": {

@@ -5,12 +5,2 @@ # IDEA's toolbox

## Installation
`npm install idea-toolbox`
## Release a new version on npm
1. Commit the changes on GitHub.
1. Update the versions in the files (find and replace, e.g. 0.0.1 -> 0.0.2).
1. Commit the files changed in the previous point and commit them using the name of the version
as commit description (e.g. v0.0.2).
1. Release the new version on npm with `npm publish`.
## References
- https://medium.com/@jdaudier/how-to-create-and-publish-your-first-node-js-module-444e7585b738
`npm install idea-toolbox`
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