{"name":"yamlify-object","version":"0.6.1","description":"Stringify object/array with yaml syntax","main":"./dist/index.js","engines":{"node":">=4.0.0"},"devDependencies":{"babel-cli":"^6.24.1","babel-lab":"^2.0.0","babel-plugin-array-includes":"^2.0.3","babel-preset-env":"^1.5.1","codecov.io":"^0.1.6","eslint":"^3.19.0","eslint-config-airbnb-base":"^11.1.3","eslint-plugin-import":"^2.2.0","lab":"^13.0.2"},"scripts":{"build":"babel src -d dist","prepublish":"npm run build","eslint":"eslint ./src","eslint-fix":"eslint ./src --fix","test":"lab -T node_modules/babel-lab test/**/*.js -l","codecov":"lab -T node_modules/babel-lab -r lcov | codecov"},"repository":{"type":"git","url":"git+https://github.com/eugeny-dementev/yamlify-object.git"},"keywords":["formatter","console","log","yaml","beauty","stringify","yamlify"],"author":{"name":"Eugeny Dementev","url":"http://github.com/eugeny-dementev"},"license":"MIT","bugs":{"url":"https://github.com/eugeny-dementev/yamlify-object/issues"},"homepage":"https://github.com/eugeny-dementev/yamlify-object","types":"./dist/index.d.ts","gitHead":"c91f2090aab47aa45ae9ba794c4624006e09f335","_id":"yamlify-object@0.6.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-ZLk2nxgzIGC5v78DGe3P7ebzfpt+lOkm4qzTv3CsWSwG926QLEcmyEIMU36JFyka4xWBlNRVMj5UtxIoWweY7Q==","shasum":"6eb066dc4532bc86b628a27b9bf6b6f68971ef90","tarball":"http://registry-npm.ywwl.com/yamlify-object/download/yamlify-object-0.6.1.tgz","fileCount":30,"unpackedSize":35864,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjGbonZ/RRHhSKw9RjinQ3IR+nkSZywLUz91YuEate9gIhAKq9VzXVklpndjVoeFRxsChF8J1q0R7NuiGGJx5rrYUT"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjC0SEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8jA//WpTnEDXBK7RiEioOm+IsWioz5Oktw56O7UCQ2Tsjxkjdv560\r\nTrwHDvynWNRoAxMxqENvFnrYPYWOikRlrd+84IJPHPRs5vYv1Y7AV6cveupE\r\nrczgHdRgZQVBagDf3Wj7CY3VzxaqaHVr41/vmCx7oPLXJwQWzJzCWeJ1Gnrx\r\nPCL46dRZrFK6cgctHCWKtiCvGAZUzLWkwp6xWckYcy2SLx0GkxY5jB9EHnv+\r\n1eNiKlV7A7zT/zU0sqn9Xdpo8APlJkvIzwWeSDr+beZ3Xl/9Nxj75Z1uyBjg\r\nRRXJ/rXj1lsHnFE7hlHF6RQyHpfVMmnPUsg5FW4GM+V3QafrlMjkGOqP3F91\r\n8mQM/RMN6Qjh8Y3Tq/dXy47YqdNaNax3waRdBwTUMKK6uZntdtz8XWmqa1hW\r\nbzCTfEjxlZuOoeuKTWdxhgxFCngLPmqmSWGlFY7h7VE4+oI4rwg02vzGdzid\r\n5UaJQni6MG41UuES3SiCLdeKrEslyUq7eh9I51imu8rDr+rvRnekIFq/+RrP\r\n/lLVBdL0Z7cK4QMd9OWzcYb9tNLNfSH19PC7097qlZAutqaIw8pMIkTKrfun\r\ne4UBsb+pfg6AuHpvPjMxV4Sb62az0IGTs/8x3VJGM5h6VzXdsw0kCJGXeiYG\r\n94IDbz8c646mJk6VNJlre17+j4lPyC8JrPg=\r\n=KDOH\r\n-----END PGP SIGNATURE-----\r\n","size":10178,"noattachment":false,"key":"/yamlify-object/-/yamlify-object-0.6.1.tgz"},"_npmUser":{"name":"eugeny-dementev","email":"eugeny.dementev@ya.ru"},"directories":{},"maintainers":[{"name":"eugeny-dementev","email":"eugeny.dementev@ya.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yamlify-object_0.6.1_1661682820021_0.21226429216235143"},"_hasShrinkwrap":false,"readme":"# yamlify-object\n\nStringify object/array with yaml syntax\n\n## Install\n\n```\nnpm install yamlify-object\n```\n\n## Usage\n\n```ts\nimport yamlifyObject from 'yamlify-object';\n\nconst obj = {\n  array: [\n    2,\n    'two',\n    {\n      emptyArray: [],\n    },\n  ],\n  error: new Error('message'),\n  date: new Date(0),\n  object: {\n    number: 200,\n    bool: false,\n    null: null,\n    undefined: undefined,\n    emptyObject: {},\n  },\n};\n\nobj.circular = obj;\n\nconst formattedString = yamlifyObject(obj, {\n  indent: '  ',\n  prefix: '\\n',\n  postfix: '\\n',\n});\n\nconsole.log(formattedString);\n/*\n\n  array:\n    - 2\n    - two\n    - emptyArray: []\n  error: Error: message\n  date: new Date(1970-01-01T00:00:00.000Z)\n  object:\n    number: 200\n    bool: false\n    null: null\n    undefined: undefined\n    emptyObject: {}\n  circular: [Circular]\n\n*/\n```\n## API\n\n### yamlifyObject(input, [options])\n\n#### input\n\nType: `Object` `Array`\n\n#### options\n\n##### indent\n\nType: `string`<br>\nDefault: `' '` - single space\n\n##### prefix\n\nType: `string`<br>\nDefault: `'\\n'`\n\n##### postfix\n\nType: `string`<br>\nDefault: `''`\n\n##### dateToString(date: Date)\n\nType: `Function`\n\nExpected to return a `string` that stringified version of Date instance.\n\n##### errorToString(error: Error)\n\nType: `Function`\n\nExpected to return a `string` that stringified version of Error instance.\n\n##### colors\n\nType: `object`<br>\nDefault:\n``` ts\n{\n  date: function (s: string): string,\n  error: function (s: string): string,\n  symbol: function (s: string): string,\n  string: function (s: string): string,\n  number: function (s: string): string,\n  boolean: function (s: string): string,\n  null: function (s: string): string,\n  undefined: function (s: string): string,\n}\n```\n\nEach property of colors object expected to be a `function` that\nexpected to return somehow colorified version of passed `string` argument.\n\nYou can specify colors only for types you need and, if have the need, the base text color.\nThe rest will stay colorless strings:\n\n``` js\nconst obj = {\n  number: 1\n  string: 'str',\n  bool: true,\n};\n\nconst formattedString = yamlifyObject(obj, {\n  colors: {\n    base: (text) => `COLOR_CODE${text}COLOR_CODE`,\n    number: (value) => `COLOR_CODE${value}COLOR_CODE`,\n    boolean: (value) => `COLOR_CODE${value}COLOR_CODE`,\n  },\n});\n\nconsole.log(formattedString);\n/*\n number: COLOR_CODE1COLOR_CODE\n string: str\n bool: COLOR_CODEtrueCOLOR_CODE\n*/\n```\n\n`base` color is the text that is not related to the values (names of the properties, dashes, brackets, etc)\n\n\nFor terminal can be used [yamlify-object-colors](https://github.com/eugeny-dementev/yamlify-object-colors) preset: \n\n![Object formating example](https://raw.githubusercontent.com/eugeny-dementev/yamlify-object-colors/master/terminal.png \"Object formating example\")\n\n[travis-img]: https://travis-ci.org/eugeny-dementev/yamlify-object.svg?branch=master\n[travis-url]: https://travis-ci.org/eugeny-dementev/yamlify-object\n\n[codecov-img]: https://codecov.io/github/eugeny-dementev/yamlify-object/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/eugeny-dementev/yamlify-object?branch=master\n","publish_time":1661682820216,"_cnpm_publish_time":1661682820216,"dist-tags":{"beta":"3.0.0-beta","latest":"3.0.0"}}