
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@ava/pretty-format
Advanced tools
Stringify any JavaScript value.
JSON.stringify
and significantly faster than Node's util.format
)ReactTestComponent
)$ npm install @ava/pretty-format
var prettyFormat = require('pretty-format');
var obj = { property: {} };
obj.circularReference = obj;
obj[Symbol('foo')] = 'foo';
obj.map = new Map();
obj.map.set('prop', 'value');
obj.array = [1, NaN, Infinity];
console.log(prettyFormat(obj));
Result:
Object {
"property": Object {},
"circularReference": [Circular],
"map": Map {
"prop" => "value"
},
"array": Array [
1,
NaN,
Infinity
],
Symbol(foo): "foo"
}
Object
, Array
, ArrayBuffer
, DataView
, Float32Array
, Float64Array
, Int8Array
, Int16Array
, Int32Array
, Uint8Array
, Uint8ClampedArray
, Uint16Array
, Uint32Array
, arguments
, Boolean
, Date
, Error
, Function
, Infinity
, Map
, NaN
, null
, Number
, RegExp
, Set
, String
, Symbol
, undefined
, WeakMap
, WeakSet
console.log(prettyFormat(object));
console.log(prettyFormat(object, options));
Options:
callToJSON
boolean
, default: true
toJSON()
on passed object.indent
number
, default: 2
maxDepth
number
, default: Infinity
min
boolean
, default: false
plugins
array
, default: []
printFunctionName
boolean
, default: true
[Function]
.escapeRegex
boolean
, default: false
highlight
boolean
, default: false
ReactTestComponent
and ReactElement
plugins.theme
object
, default: {tag: 'cyan', content: 'reset'...}
reset
for no color.tag
, content
, prop
and value
.Pretty format also supports adding plugins:
var fooPlugin = {
test: function(val) {
return val && val.hasOwnProperty('foo');
},
print: function(val, print, indent) {
return 'Foo: ' + print(val.foo);
}
};
var obj = { foo: { bar: {} } };
prettyFormat(obj, {
plugins: [fooPlugin]
});
// Foo: Object {
// "bar": Object {}
// }
ReactTestComponent
and ReactElement
pluginsvar prettyFormat = require('pretty-format');
var reactTestPlugin = require('pretty-format/plugins/ReactTestComponent');
var reactElementPlugin = require('pretty-format/plugins/ReactElement');
var React = require('react');
var renderer = require('react-test-renderer');
var jsx = React.createElement('h1', null, 'Hello World');
prettyFormat(renderer.create(jsx).toJSON(), {
plugins: [reactTestPlugin, reactElementPlugin]
});
// <h1>
// Hello World
// </h1>
FAQs
Stringify any JavaScript value
We found that @ava/pretty-format demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.