Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@hume/utils
Advanced tools
Some helpers shared among the rest of the packages.
:coffee: Install Node.js v8 and then:
npm i @hume/utils
:pencil: You can visit the complete example in this tests.
const utils = require('@hume/utils');
console.log('Version');
console.log(utils.version);
:eyes: Full specification. All Lodash methods are in the root, so you can call them directly, ie: utils.map()
.
version
The actual version of the library.
version
(string) - Version number.validator
A wrapper for validator.js.
appEnv
The result of this method to parse the important info from Bluemix app environments (from the package "cfenv"). This package doesn't randomize the port, which is a problem to run all microserices locally in parallel. So we trick it in this library if the env var Q_MICRO
is set to true.
https://github.com/cloudfoundry-community/node-cfenv#getappenvoptions
https://github.com/hoodiehq-archive/node-ports#ports-registry
appEnv
(object) - The environment in JSON format.
async error(msg, error, opts) -> id
To report errors to logger and APM (if enabled).
msg
(string) - Custom message explaining the error.error
(Error) - JavaScript error.opts
(object) - Optional parameters:
userId
(string) - The user ID generating the error. If you want to track also the user in the APM (default: null)custom
(object) - some arbitrary details (default: {})async lb.getUserId(req) -> id
To get the user ID in LoopBack from a request object. To use outside HTTP APIs, there LoopBack has its own mechanism, use next point method instead.
req
(object) - A Loopback "request" object.id
(string) - The user identifierm null
if not found.async lb.addUserId(model) -> null
To add the current user ID to the actual model when present. Thought to be used in the models with endpoints that need it. So, thanks to this LoopBack mechanism we have the field "currentUserId" once this is called.
model
(object) - A Loopback "Model" object.async lb.createUser(app, opts) -> null
To create a first user and the proper roles.
app
(object) - A Loopback "app" object.opts
(object) - An object with:
username
(string) - Username of the user to create. (default: 'admin')password
(string) - Password of the user to create. (default: 'admin')email
(string) - Email of the user to create. (default: 'admin@admin@myapp.mybluemix.net')A wrapper around Pino (with prettystream), but only the next 3 levels are allowed. If the environment variable NODE_ENV
value is production
, prettystream is disable due to performance reasons.
name
(string) - Project name to tag the messages. (default: 'app')log
(object) - Including next points methods.log.error(msg, err, data)-> null
Function used to register errors in log. It acts as adapter of the function pino.error
.
msg
(string) - A message with the explanationerr
(object) - An error to register in the logdata
(object) - An object with additional data to include in error log entrylog.info(msg, data) -> null
Function used to log debug messages. It acts as adapter of the function pino.info
signature.Keep it to the minimal, because it's also printed in production and console.*
methods are sync operations.
msg
(string) - A message with the explanationdata
(object) - An object with additional data to include in info log entrylog.debug(msg, data) -> null
Function used to log debug messages. It acts as adapter of the function pino.debug
signature.
msg
(string) - A message with the explanationdata
(object) - An object with additional data to include in debug log entrySome promises related helpers.
promise
(object) - Including next points methods.promise.map()
A wrapper around p-map
.
promise.mapSeries()
A wrapper around p-map-series
.
promise.eachSeries()
A wrapper around p-each-series
.
sleep()
A wrapper for system-sleep.
randomInt(min, max)
Returns a random integer between min (inclusive) and max (inclusive).
min
(number) - Lower limit.max
(number) - Higher limit.requireDir(module)
A wrapper for node-require-directory.
FAQs
Some helpers shared among the rest of the packages.
The npm package @hume/utils receives a total of 15 weekly downloads. As such, @hume/utils popularity was classified as not popular.
We found that @hume/utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.