{"name":"yamlify-object","version":"1.0.0-beta.2","description":"Stringify object/array with yaml syntax","main":"./dist/yamlify-object.js","types":"./dist/index.d.ts","engines":{"node":">=4.0.0"},"devDependencies":{"@types/jest":"^28.1.8","@typescript-eslint/eslint-plugin":"^5.35.1","@typescript-eslint/parser":"^5.35.1","eslint":"^8.23.0","jest":"^28.0.0","ts-jest":"^28.0.8","ts-loader":"^9.3.1","ts-node":"^10.9.1","typescript":"4.7.4","webpack":"^5.74.0","webpack-cli":"^4.10.0"},"scripts":{"build":"webpack","prepublish":"npm run lint && npm test && webpack","lint":"eslint ./src","lint-fix":"eslint ./src --fix","test":"jest test"},"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","gitHead":"d02ba14262372ffadb4772c7aeebb269c8b5c6a5","_id":"yamlify-object@1.0.0-beta.2","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-BPySIMRDiB0nhotdt+keG6SpT936AQa27QApxzg+Bu9iFiNXJLnrU0fseS3h84pHZTg+U/lHBXMVxrhbAV9fLg==","shasum":"72cd68c138775d30e3961a39e59fb709e271636d","tarball":"http://registry-npm.ywwl.com/yamlify-object/download/yamlify-object-1.0.0-beta.2.tgz","fileCount":12,"unpackedSize":22771,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDI3nh7ned9Vwis1FDMwMrW2SPTiw6NA7Vhrgvx0/tVNgIgV+S232k7lj4f8kF3jhHxuwCP6Fji9XoxEI/H+DLvBPM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjC0NdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqz4w//V7k9LCxQNuZvgVeQMAK7KH9i51svb4XKfaHWc+D1hXHqJbgj\r\n5ecg0xoIV/Udot/LBo5+jzp/3bedCyd3yNnJJFWlEZl+OaCOls3lkkfQPTG8\r\nNIIMFeaTFNQqgDLALI7499k2IjtPjXuMAUyi2qcI0dz3iqFGyQlFqUkPiC1I\r\nWrZrEplb8RIPCCnYnrRmv9ivXuMsvIQ4hsDbgKEoA8dnzYBurxsvKBMs3ort\r\nB6uPyLAxCvFkSXdcBLMOaiZqym9juxydS9S6WW70VrCHO8J/BJY5krBqFQFT\r\nWksXpEPVURvovPROyYwhG8yUQw/RHK9mLyBnPT8mxVI0SZkH1yBxPiCyqZ+8\r\nzPd//3lpgFUrzfD2wcBTdEjiIO86yIJbTXwPVGJUZ8a1yFDuExwIjZRRs3ya\r\n9Bm+s9L2PkNm8fC9ZOVQygDuSdIu8cnp4lgir+WjA3zBdLhv8Sd5b+JUWH8p\r\nweXnmelmI8WmAV9AZHpSShQSH5VQDPG1qT4s3I0OZv1qaYFeL9wcjvqFb+MC\r\nfHwKwrE4ZGHv/0uETGY5IL1Wjg9MIMeXv/8wGtN6oJfUn97uUgjzmhfMB/G2\r\n8LiXLDEwNJ6ERJ94X/MGbBDOAMz4sJXsjZvtaUun7cRghvJPeDsaKMsXswMz\r\niv5paMadhZRupbnlqoaOghCNCsKZCBliUnM=\r\n=ZZm0\r\n-----END PGP SIGNATURE-----\r\n","size":7860,"noattachment":false,"key":"/yamlify-object/-/yamlify-object-1.0.0-beta.2.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_1.0.0-beta.2_1661682525728_0.6611223649121367"},"_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":1661682525921,"_cnpm_publish_time":1661682525921,"dist-tags":{"beta":"3.0.0-beta","latest":"3.0.0"}}