xpl / string.ify Goto Github PK
View Code? Open in Web Editor NEWA small, simple yet powerful JavaScript object stringifier / pretty-printer
Home Page: http://npmjs.com/package/string.ify
License: The Unlicense
A small, simple yet powerful JavaScript object stringifier / pretty-printer
Home Page: http://npmjs.com/package/string.ify
License: The Unlicense
source:
const o = [1,2,3,4,5,6,7,8,9,10]
console.log(stringify.configure({
maxLength: 0,
maxArrayLength: 5,
fancy: false,
})(o))
output:
<array[10]>
hope like this:
[
1,
2,
3,
4,
5,
...more<5>
]
I'd suggest changing your readme into reference-style documentation rather than tutorial-style. Tutorial style makes it hard to visually parse and find just what you need - you need to read the whole tutorial to figure out what's going on. Reference-style focuses on making it easy to visually parse by making it clear to the reader how to find the piece of information they need. My two cents.
Hi @xpl! I love this library and ololog
, however I just found out that this library, string.bullet
and printable-characters
pollute my webpack bundle with unwanted const
, breaking IE11. I'm assuming this is a configuration error in the build process. Thanks!
In the readme, it says functions will be rendered as valid javascript functions, but when I actually use this module, doing this: stringify({a:function(){}})
renders this: { a: <function:a> }
.
@xpl, this is great. I'm just wondering: is a tool like this available for calling within python, so that string representations like these could be generated from python dicts / objects?
I know that there is e.g. pprint, but it's not as nice---the dict keys do not get right-aligned like they do here. Thank you.
Using string.ify
in a create-react-app
project fails the react-scripts build
, because the printable-characters
dependency can't be minified.
Build snippet...
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/printable-characters/build/printable-characters.js:14
Read more here: http://bit.ly/2tRViJ9
Nice to have - similar to https://www.npmjs.com/package/json-stable-stringify
undefined
is not JSON compatible and will cause e.g. jq
to barf.
First off, thank you for this package. Its configurability is wonderful, just what I needed. My only request is to make an option to pretty print, but without the alignment. Currently, to my knowledge, when the pretty
option is on it aligns object properties, but when it's off it prints everything on a single line, so everything is clustered together and less readable. Any chance of printing on separate lines without the colon alignment?
Thanks again, I appreciate the work on this!
If you try to pretty print an object with long keys the output will be garbled because it becomes far too wide for the terminal. An improvement would be to detect long keys and then truncate/wrap them with a setting to configure the length.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.