
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@lopatnov/javascripttostring
Advanced tools
JavaScript value to string runtime converter. It converts a runtime value into string a value.
npm install @lopatnov/javascripttostring
<script src="//lopatnov.github.io/jsToString/dist/javascripttostring.umd.js"></script>
import javaScriptToString from '@lopatnov/javascripttostring';
var javaScriptToString = require("@lopatnov/javascripttostring");
javaScriptToString(value: any, options?: IJ2SOptions) => string
where
interface IJ2SOptions {
includeFunctionProperties?: boolean; // default true
includeFunctionPrototype?: boolean; // default true
includeBuffers?: boolean; // default true
nestedObjectsAmount?: number; // default Number.POSITIVE_INFINITY
nestedArraysAmount?: number; // default Number.POSITIVE_INFINITY
nestedFunctionsAmount?: number; // default Number.POSITIVE_INFINITY
}
let myStringOfString = javaScriptToString('Hello world');
console.log(myStringOfString);
/* expected myStringOfString value: "\"Hello world\"" */
let myStringOfArray = javaScriptToString(["Hello", "World", ".", "How", "do", "you", "do", "?"]);
console.log(myStringOfArray);
/* expected myStringOfArray value: "[\"Hello\",\"World\",\".\",\"How\",\"do\",\"you\",\"do\",\"?\"]" */
let myObjectString = javaScriptToString({
friend1: "Shurik",
friend2: "Alex",
friends: {
friend3: 123456,
friend4: {},
friend5: ["Hola", "amigo"],
friend6: () => {
console.log("How you doing?");
}
}
});
console.log(myObjectString);
/* expected myObjectString value:
"{friend1: \"Shurik\",friend2: \"Alex\",friends: {friend3: 123456,friend4: {},friend5: [\"Hola\",\"amigo\"],friend6: () => {
console.log(\"How you doing?\");
}}}"
*/
let myFunctionString = javaScriptToString(function(a,b) {
console.log("Just a function");
})
console.log(myFunctionString);
/* expected myFunctionString:
"function(a,b) {
console.log(\"Just a function\");
}"
*/
function Simple(title) {
this.title = title || "world";
}
Simple.count = 0;
Simple.prototype.show = function(){
Simple.count++;
console.log('title = ', this.title);
console.log('count = ', Simple.count);
}
console.log(javaScriptToString(Simple));
/* Expected:
"(function(){
var Simple = function Simple(title) {
this.title = title || \"world\";
};
Simple.count = 0;
Simple.prototype.show = function(){
Simple.count++;
console.log('title = ', this.title);
console.log('count = ', Simple.count);
};
return Simple;
}())"
*/
var x = [1,2,3];
x[0] = x;
console.log(javaScriptToString(x));
/*
"(function(){ var ___j2s_0 = [null, 2, 3]; ___j2s_0['0'] = ___j2s_0; return ___j2s_0; }())"
*/
See, how it's working: https://runkit.com/lopatnov/javascripttostring-demo
Test it with a runkit: https://npm.runkit.com/%40lopatnov%2Fjavascripttostring
License Apache-2.0
Copyright 2019–2021 Oleksandr Lopatnov
FAQs
JavaScript value to string converter
The npm package @lopatnov/javascripttostring receives a total of 2 weekly downloads. As such, @lopatnov/javascripttostring popularity was classified as not popular.
We found that @lopatnov/javascripttostring 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.