Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
[] travis-url [] coveralls-url
Well formatted(customizable) JSON like generator. Not compatible with pure JSON (smart strings/ids qouting).
Its very usefull for easy readble JS-objects dumps because you can define formats for sub-elements of objects deeply pretty.
Returns quoted id
value if it's keyword or not identifier.
id2str('blah'); // blah
id2str('blah-blah'); // 'blah-blah'
id2str('class'); // 'class'
Returns quoted string. Automaticaly detects quotes symbols.
str2str('some string'); // 'some string'
str2str('some "" string with "double" quotes'); // 'some "" string with "double" quotes'
str2str("some '' string with 'single' quotes"); // "some '' string with 'single' quotes"
Returns single qouted string.
qstr('some string'); // 'some string'
qstr('some "" string with "double" quotes'); // 'some "" string with "double" quotes'
qstr("some '' string with 'single' quotes"); // 'some \'\' string with \'single\' quotes'
Returns double quoted string.
dqstr('some string'); // "some string"
dqstr('some "" string with "double" quotes'); // "some \"\" string with \"double\" quotes"
dqstr("some '' string with 'single' quotes"); // "some '' string with 'single' quotes"
Object
;Number
- radix for number values (10 if undefined);Boolean
- stringify root array as list (without square brackets).Returns stringified object.
js2str([ 10, 20, 30 ], 10, 1); // 10,20,30
js2str([ 10, 20, 30 ], 10, 0); // [10,20,30]
js2str([ 10, 20, 30 ], 16, 0); // [0xa,0x14,0x28]
js2str({ a: 1 }); // {a:1}
Object
Object
or String
String
- list format string: '###'Object
- { '':'', ['":':1], ['<>:':][, :]* }
String
- current object list format string: '###'Boolean
- force qouting of object keys flagNumber
- minimal width of object keys (will be padded by spaces)Boolean
- enable array items index number commentsObject
- style for sub-object with identifier IDObject
- style for array sub-itemsString
- indent string ('' by default)String
- one indentation level spaces string' #, # # '
var style = ' #, # # ';
render([ 1, 2, 3 ], style); // '[ 1, 2, 3 ]'
render([ 1 ], style); // '[ 1 ]'
render([ ], style); // '[ ]'
render({ a:1, b:2, c:3 }, style); // '{ a:1, b:2, c:3 }'
render({ a:1 }, style); // '{ a:1 }'
render({ }, style); // '{ }'
'#,##'
var style = '#,##';
render([ 1, 2, 3 ], style); // '[1,2,3]'
render([ 1 ], style); // '[1]'
render([ ], style); // '[]'
render({ a:1, b:2, c:3 }, style); // '{a:1,b:2,c:3}'
render({ a:1 }, style); // '{a:1}'
render({ }, style); // '{}'
'\n+#,\n+#\n=# '
Where the '+' symbol means next level of indentation.
var style = '\n+#,\n+#\n=# ';
render([ 1, 2, 3 ], style, '', ' '); // '[\n 1,\n 2,\n 3\n]'
render([ 1 ], style); // '[\n 1\n]'
render([ ], style); // '[ ]'
render({ a:1, b:2, c:3 }, style); // '{\n a:1,\n b:2,\n c:3\n}'
render({ a:1 }, style); // '{\n a:1\n}'
render({ }, style); // '{ }'
FAQs
A well formatted JS objects stringifyer
We found that nano-json 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.