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

purdy

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

purdy - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

16

lib/index.js

@@ -11,3 +11,2 @@ // Load modules

indentLevel: 0,
seen: [],
colors: {

@@ -43,2 +42,3 @@ BoolFalse: 'red.bold',

}
internals.seen = [];
internals.settings = Hoek.applyToDefaults(internals.defaults, options || {});

@@ -57,3 +57,3 @@ return internals.travel(object);

var type = toString.call(object).split(' ')[1].slice(0,-1);
var type = global.toString.call(object).split(' ')[1].slice(0, -1);
var format = '';

@@ -94,8 +94,8 @@

internals.lengthCompare = function (a,b) {
return a.length - b.length
internals.lengthCompare = function (a, b) {
return a.length - b.length;
};
internals.Object = function(object) {
internals.Object = function (object) {

@@ -160,3 +160,3 @@ if (Object.keys(object).length === 0) {

internals.String = function(str) {
internals.String = function (str) {

@@ -167,3 +167,3 @@ return '\'' + str + '\'';

internals.Boolean = function(bool) {
internals.Boolean = function (bool) {

@@ -177,3 +177,3 @@ if (bool === true) {

internals.Function = function(func) {
internals.Function = function (func) {
if (func.name) {

@@ -180,0 +180,0 @@ return internals.colorize('[Function: ' + func.name + ']', 'Function');

{
"name": "purdy",
"version": "0.3.0",
"version": "0.3.1",
"description": "print objects real purdy in color",

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

@@ -5,12 +5,5 @@ var Lab = require('lab');

// Declare internals
var internals = {};
// Test shortcuts
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;

@@ -20,7 +13,7 @@ var it = Lab.test;

describe('Purdy', function() {
describe('Purdy', function () {
it('should indent array correctly', function(done) {
it('should indent array correctly', function (done) {
var out = Purdy.stringify([1,2,1,1,1,1,12,[1,2]]);
var out = Purdy.stringify([1, 2, 1, 1, 1, 1, 12, [1, 2]]);
expect(out).to.equal('[\n [\u001b[1m\u001b[37m0\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m1\u001b[39m\u001b[22m] \u001b[1m\u001b[34m2\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m2\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m3\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m4\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m5\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m6\u001b[39m\u001b[22m] \u001b[1m\u001b[34m12\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m7\u001b[39m\u001b[22m] [\n [\u001b[1m\u001b[37m0\u001b[39m\u001b[22m] \u001b[1m\u001b[34m1\u001b[39m\u001b[22m,\n [\u001b[1m\u001b[37m1\u001b[39m\u001b[22m] \u001b[1m\u001b[34m2\u001b[39m\u001b[22m\n ]\n]');

@@ -30,5 +23,5 @@ done();

it('should print plain', function(done) {
it('should print plain', function (done) {
var out = Purdy.stringify('plain', {plain: true});
var out = Purdy.stringify('plain', { plain: true });
expect(out).to.equal('\'plain\'');

@@ -38,3 +31,3 @@ done();

it('should handle circular references', function(done) {
it('should handle circular references', function (done) {
var circularObj = { };

@@ -46,3 +39,3 @@ circularObj.a = circularObj;

expect(out).to.equal('{\n \u001b[1m\u001b[37ma\u001b[39m\u001b[22m: \u001b[1m\u001b[90m[Circular]\u001b[39m\u001b[22m\n}');
var out = Purdy.stringify(circ);
out = Purdy.stringify(circ);
expect(out).to.equal('[\n [\u001b[1m\u001b[37m0\u001b[39m\u001b[22m] \u001b[1m\u001b[90m[Circular]\u001b[39m\u001b[22m\n]');

@@ -52,3 +45,3 @@ done();

it('should print a function', function(done) {
it('should print a function', function (done) {

@@ -60,3 +53,3 @@ var out = Purdy.stringify(Array.isArray);

it('should print an anonymous function', function(done) {
it('should print an anonymous function', function (done) {

@@ -69,3 +62,3 @@ var out = Purdy.stringify(it);

it('should print a string', function(done) {
it('should print a string', function (done) {

@@ -77,3 +70,3 @@ var out = Purdy.stringify('hello purdy');

it('should print a date', function(done) {
it('should print a date', function (done) {

@@ -85,3 +78,3 @@ var out = Purdy.stringify(new Date(2014, 5, 6, 21, 22, 21));

it('should print a number', function(done) {
it('should print a number', function (done) {

@@ -93,3 +86,3 @@ var out = Purdy.stringify(123);

it('should print null', function(done) {
it('should print null', function (done) {

@@ -101,3 +94,3 @@ var out = Purdy.stringify(null);

it('should print undefined', function(done) {
it('should print undefined', function (done) {

@@ -109,3 +102,3 @@ var out = Purdy.stringify(undefined);

it('should print a regular expression', function(done) {
it('should print a regular expression', function (done) {

@@ -117,3 +110,3 @@ var out = Purdy.stringify(new RegExp());

it('should print a false boolean', function(done) {
it('should print a false boolean', function (done) {

@@ -125,3 +118,3 @@ var out = Purdy.stringify(false);

it('should print a true boolean', function(done) {
it('should print a true boolean', function (done) {

@@ -133,3 +126,3 @@ var out = Purdy.stringify(true);

it('should print an empty array without extra indentation', function(done) {
it('should print an empty array without extra indentation', function (done) {

@@ -141,3 +134,3 @@ var out = Purdy.stringify([]);

it('should print an empty object without extra indentation', function(done) {
it('should print an empty object without extra indentation', function (done) {

@@ -149,6 +142,6 @@ var out = Purdy.stringify({});

it('should print a more complex object', function(done) {
it('should print a more complex object', function (done) {
var out = Purdy.stringify({
array: [1,2, [1, 2]],
array: [1, 2, [1, 2]],
object: { another: 'string' }

@@ -160,3 +153,12 @@ });

it('should not print circular after second use', function (done) {
var obj = { a: 3 };
Purdy.stringify(obj);
var out = Purdy.stringify(obj, { plain: true });
expect(out).to.not.equal('[Circular]');
done();
});
});
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