Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

larvitutils

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitutils - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

test/hashUnsignedIntFromString.js

17

index.js

@@ -161,2 +161,19 @@ 'use strict';

/**
* Genereates a string into an unsigned int
*
* @param {string} str The string to convert
* @return {number} the hashed value
*/
Utils.prototype.hashUnsignedIntFromString = function hashUnsignedIntFromString(str) {
let hash = 0;
if (str.length === 0) return hash;
for (let i = 0; i < str.length; i++) {
hash += (1 << str.charCodeAt(i)) >>> 0;
}
return hash;
};
Utils.prototype.Log.prototype.stdout = function stdout(lvl, msg) {

@@ -163,0 +180,0 @@ console.log((new Date()).toISOString().substring(0, 19) + 'Z [' + lvl + '] ' + msg);

2

package.json
{
"name": "larvitutils",
"version": "2.3.0",
"version": "2.3.1",
"description": "Misc utils",

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

@@ -1,2 +0,4 @@

[![Build Status](https://travis-ci.org/larvit/larvitutils.svg)](https://travis-ci.org/larvit/larvitutils) [![Dependencies](https://david-dm.org/larvit/larvitutils.svg)](https://david-dm.org/larvit/larvitutils.svg)
[![Build Status](https://travis-ci.org/larvit/larvitutils.svg)](https://travis-ci.org/larvit/larvitutils)
[![Dependencies](https://david-dm.org/larvit/larvitutils.svg)](https://david-dm.org/larvit/larvitutils.svg)
[![Coverage Status](https://coveralls.io/repos/github/larvit/larvitutils/badge.svg)](https://coveralls.io/github/larvit/larvitutils)

@@ -3,0 +5,0 @@ # larvitutils

@@ -95,1 +95,78 @@ 'use strict';

});
test('log - Print nothing, even on error, when no valid lvl is set', t => {
const oldStderr = process.stderr.write;
let outputMsg = 'SOMETHING';
const log = new utils.Log('none');
process.stderr.write = msg => outputMsg = msg;
log.error('kattbajs');
process.stderr.write = oldStderr;
t.equal(outputMsg.substring(19), '');
t.end();
});
test('log - Test silly', t => {
const oldStdout = process.stdout.write;
let outputMsg = '';
const log = new utils.Log('silly');
process.stdout.write = msg => outputMsg = msg;
log.silly('kattbajs');
process.stdout.write = oldStdout;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;37msil\x1b[0m] kattbajs\n');
t.end();
});
test('log - Test debug', t => {
const oldStdout = process.stdout.write;
let outputMsg = '';
const log = new utils.Log('debug');
process.stdout.write = msg => outputMsg = msg;
log.debug('kattbajs');
process.stdout.write = oldStdout;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;35mdeb\x1b[0m] kattbajs\n');
t.end();
});
test('log - Test verbose', t => {
const oldStdout = process.stdout.write;
let outputMsg = '';
const log = new utils.Log('verbose');
process.stdout.write = msg => outputMsg = msg;
log.verbose('kattbajs');
process.stdout.write = oldStdout;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;34mver\x1b[0m] kattbajs\n');
t.end();
});
test('log - Test info', t => {
const oldStdout = process.stdout.write;
let outputMsg = '';
const log = new utils.Log('info');
process.stdout.write = msg => outputMsg = msg;
log.info('kattbajs');
process.stdout.write = oldStdout;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;32minf\x1b[0m] kattbajs\n');
t.end();
});
test('log - Test warn', t => {
const oldStderr = process.stderr.write;
let outputMsg = '';
const log = new utils.Log('warn');
process.stderr.write = msg => outputMsg = msg;
log.warn('kattbajs');
process.stderr.write = oldStderr;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;33mwar\x1b[0m] kattbajs\n');
t.end();
});
test('log - Test error', t => {
const oldStderr = process.stderr.write;
let outputMsg = '';
const log = new utils.Log('silly');
process.stderr.write = msg => outputMsg = msg;
log.error('kattbajs');
process.stderr.write = oldStderr;
t.equal(outputMsg.substring(19), 'Z [\x1b[1;31merr\x1b[0m] kattbajs\n');
t.end();
});

Sorry, the diff of this file is not supported yet

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