
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@ntlab/ntlib
Advanced tools
Beautify a text.
const { Beautify } = require('@ntlab/ntlib');
console.log(Beautify.beautify('this is the message')); // This Is The Message
Beautify.exceptions.add('is');
console.log(Beautify.beautify('THIS IS THE MESSAGE')); // This is The Message
Class to handle string as a sequence of character.
const { CharSequence } = require('@ntlab/ntlib');
let charseq = new CharSequence('This is a string');
while (!charseq.eof()) {
console.log(charseq.read(1));
}
Provide functions to work with Command Line arguments.
const path = require('path');
const { Cmd } = require('@ntlab/ntlib');
Cmd.addBool('help', 'h', 'Show program usage').setAccessible(false);
Cmd.addVar('something', 's', 'Something description', 'some-argument');
if (!Cmd.parse() || (Cmd.get('help') && usage())) {
process.exit();
}
/* do something here */
function usage() {
console.log('Usage:');
console.log(' node %s [options]', path.basename(process.argv[1]));
console.log('');
console.log('Options:');
console.log(Cmd.dump());
console.log('');
return true;
}
Execute a Command Line Interface (CLI) or HTTP command.
const { CommandExecutor } = require('@ntlab/ntlib');
const cmd = {
bin: 'php',
cli: 'path/to/php.file.to.execute.php',
args: [
'-f',
'%CLI%',
'--',
'%DATA%'
]
}
const p = CommandExecutor(cmd).exec({DATA: 'some-data'});
p.on('exit', (code) => {
/* do something on exit */
});
p.stdout.on('data', (line) => {
/* do something on stdout data */
});
p.stderr.on('data', (line) => {
/* do something on stderr data */
});
Provide a simple logger class.
const { Logger } = require('@ntlab/ntlib');
const log = new Logger('/path/to/logfile');
log.log('Somthing to log');
Convert javascript object to string.
const { Stringify } = require('@ntlab/ntlib');
console.log(Stringify.from({
message: 'message',
raw: Stringify.raw('`string`'),
})); // {message: 'message', raw: `string`}
Provide an utility to parse string into tokens.
const { Token } = require('@ntlab/ntlib');
console.log(Token.split('1, 2, (1, "ABC")')); // [1, 2, [1, "ABC"]]
Internally used by CLI/HTTP Executor, also provide a small set of common functions.
const { AppUtil } = require('@ntlab/ntlib');
console.log(AppUtil.trans('Translate %ME%', {ME: '123'})); // Translate 123
FAQs
A collection of common library
The npm package @ntlab/ntlib receives a total of 4 weekly downloads. As such, @ntlab/ntlib popularity was classified as not popular.
We found that @ntlab/ntlib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.