{"_id":"@crabas0npm/voluptas-ad-vel","name":"@crabas0npm/voluptas-ad-vel","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@crabas0npm/voluptas-ad-vel","version":"1.0.0","description":"[![npm](https://img.shields.io/npm/v/@crabas0npm/voluptas-ad-vel.svg)](https://npmjs.com/package/@crabas0npm/voluptas-ad-vel)","main":"index.js","author":{"name":"Crabas0"},"license":"MIT","dependencies":{"@ajhgwdjnpm/aut-at-nulla-perferendis":"^1.0.0","@ajhgwdjnpm/quas-mollitia-aspernatur-reprehenderit":"^1.0.0","@ajhgwdjnpm/quia-harum-molestias-eos":"^1.0.0","@crabas0npm/accusantium-repellendus-sint-consequuntur":"^1.0.0","@crabas0npm/alias-consequuntur-hic-enim":"^1.0.0","@crabas0npm/aliquid-vitae-magnam-perspiciatis":"^1.0.0","@crabas0npm/aut-cupiditate-quam-dicta":"^1.0.0","@crabas0npm/blanditiis-est-molestias-a":"^1.0.0","@crabas0npm/consectetur-impedit-exercitationem-error":"^1.0.0","@crabas0npm/corporis-rerum-reprehenderit-voluptates":"^1.0.0","@crabas0npm/delectus-dolorem-consectetur-corrupti":"^1.0.0","@crabas0npm/ea-nisi-earum-mollitia":"^1.0.0","@crabas0npm/et-perspiciatis-eius-modi":"^1.0.0","@crabas0npm/expedita-magnam-quia-perferendis":"^1.0.0","@crabas0npm/expedita-optio-recusandae-nesciunt":"^1.0.0","@crabas0npm/expedita-voluptas-corrupti-ullam":"^1.0.0","@crabas0npm/facilis-doloribus-provident-optio":"^1.0.0","@crabas0npm/fugiat-necessitatibus-recusandae-quo":"^1.0.0","@crabas0npm/maxime-sequi-nam-facere":"^1.0.0","@crabas0npm/minus-iure-ipsum-temporibus":"^1.0.0","@crabas0npm/nulla-minima-vero-facere":"^1.0.0","@crabas0npm/odio-exercitationem-ducimus-provident":"^1.0.0","@crabas0npm/officia-nostrum-at-hic":"^1.0.0","@crabas0npm/officiis-labore-tempora-sint":"^1.0.0","@crabas0npm/omnis-neque-asperiores-rerum":"^1.0.0","@crabas0npm/optio-sequi-optio-quidem":"^1.0.0","@crabas0npm/porro-voluptatem-consectetur-beatae":"^1.0.0","@crabas0npm/possimus-sit-repellat-perspiciatis":"^1.0.0","@crabas0npm/quo-dolorem-molestiae-porro":"^1.0.0","@crabas0npm/ratione-nisi-deleniti-provident":"^1.0.0","@crabas0npm/ratione-voluptatibus-quo-sed":"^1.0.0","@crabas0npm/repellendus-illum-cum-fugit":"^1.0.0","@crabas0npm/unde-quos-asperiores-modi":"^1.0.0","@omegion1npm/eligendi-harum-porro-numquam":"^1.0.0"},"keywords":["set","readablestream","yaml","phone","tostringtag","error-handling","flag","airbnb","installer","findLastIndex","Object.assign","fantasy-land","deepcopy","circular","ECMAScript 2021","shared","whatwg","cli","define","cache","streams","auth","walking","proto","irq","getintrinsic","filter","setter","Object.entries","package manager","authentication","call-bind","Array.prototype.filter","classnames","wget","rangeerror","regex","env","invariant","syntax","styling","toStringTag","zero","shrinkwrap","extend","waapi","@@toStringTag","es2015","website","tc39","Promise","columns","progress","JSON-Schema","es-abstract","optimizer","sequence","settings","libphonenumber","move","linewrap","Array.prototype.contains","visual","protobuf","lint","directory","throttle","connect","BigUint64Array","launch","browser","immutable","json-schema-validation","option","hash","name","terminal","ECMAScript 2017","crypt","less mixins","less css","copy","watcher","worker","eslintplugin","var","crypto","characters","emoji","mkdirs","arrays","code points","qs","gestures","command-line","formatting","hookform","lazy","ECMAScript 2022","eslint-plugin","syntaxerror","bind","output","npm","typeof","entries","codes","Uint16Array","urls","random","watchFile","generics","weakmap","polyfill","ES2020","mime-db","groupBy","mobile","async","concurrency","negative","typescript","util","mixins","autoprefixer","ArrayBuffer#slice","character","extra","get","deep","higher-order","pyyaml","forms","curl","URL","protocol-buffers","https","awesomesauce","linux","banner","colour","trimStart","fp","redux-toolkit","logger","file","dotenv","sameValueZero","encryption","ansi","ECMAScript 2020","helpers","call-bound","flat","traverse","path","validator","validate","typesafe","mocha","ES6","serialization","regexp","color","less","typanion","forEach","pnpm9","ES2016","byteLength","fastify","default","map","getOwnPropertyDescriptor","rm","optimist","client","WeakSet","art","obj","framework","performant","gradients css","browserlist","up","YAML","WeakMap","ES2018","immer","uninstall","transpile","multi-package","preserve-symlinks","Underscore","deep-copy","hasOwn","parse","id","buffers","getopt","colors","recursive","environment","rm -rf","private data","logging","ava","structuredClone","performance","length","packages","byte","getter","has","description","slice","pretty","Push","idle","concatMap","CSS","Int32Array","once","keys","ECMAScript 2015","native","css-in-js","user-streams","indicator","trimEnd","ECMAScript 7","find","deep-clone","ratelimit","ECMAScript 2019","collection.es6","read","korean","fast-deep-copy","Array.prototype.findLast","limit","emit","json-schema-validator","glob","intrinsic","ES2023","dependency manager","unicode","es2018","rm -fr","less.js","tacit","javascript","call","stream","RegExp#flags","workspace:*","password","ECMAScript 2023","Symbol","arraybuffer","arguments","private","ES8","ReactiveX","tools","omit","scheme","speed","type","es8","Rx","babel","parents","wait","configurable","nope","Object.keys","valid","from","deepclone","tdd","api","find-up","persistent","css nesting","flatMap","check","quote","pipe","batch","ast","RegExp.prototype.flags","postcss","error","mimetypes","query","Set","styleguide","descriptors","jest","Iterator","animation","descriptor","interrupts","Array.prototype.includes","functional","react-hook-form","modules","redact","StyleSheet","ArrayBuffer","validation","compiler","TypeScript","argument","ES7","matches","exe","break","postcss-plugin","ES2022","group","ECMAScript 2018","fast","uuid","reducer","stringify","shim","format","typed array","enumerable","nodejs","es6","json","String.prototype.trim","Object.defineProperty","stylesheet","reduce","ES","data","symlinks","web","browserslist","efficient","xterm","fastclone","folder","equality","metadata","accessor","getPrototypeOf","isConcatSpreadable","request","child","watch","findLast","fetch","is","fullwidth","censor","framer","busy","xss","last","full","walk"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/voluptas-ad-vel.git"},"homepage":"https://github.com/crabas0npm/voluptas-ad-vel/#readme","bugs":{"url":"https://github.com/crabas0npm/voluptas-ad-vel/issues"},"packageManager":"yarn@4.1.1","_id":"@crabas0npm/voluptas-ad-vel@1.0.0","gitHead":"84c1bdbabcc94c197a3debfe02fd2258dddf9219","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-75lmbJDOapEtVvthWveD274ILlFSQ1cFjLUaxpooi1IQ9pA1ILcufRwXGpMtzRHzkdFGXCl9cIzmQR9AgOeoug==","shasum":"b65767675612352867dc29ec49d2ae2dffee444a","tarball":"https://registry.npmjs.org/@crabas0npm/voluptas-ad-vel/-/voluptas-ad-vel-1.0.0.tgz","fileCount":10,"unpackedSize":19924,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID+FGYoNtBZJ3pgONIFtUUIu9+ZCLuQJLhUDx5ur+7lLAiB03DTYmUMItVo9lnj8EFzrGYU7pNtwbwh7ami79Um2dw=="}]},"_npmUser":{"name":"thanhl4861","email":"thanhl4861@gmail.com"},"directories":{},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/voluptas-ad-vel_1.0.0_1714021965598_0.8841491553105123"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-25T05:12:45.461Z","1.0.0":"2024-04-25T05:12:45.773Z","modified":"2024-04-25T05:12:46.154Z"},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"description":"[![npm](https://img.shields.io/npm/v/@crabas0npm/voluptas-ad-vel.svg)](https://npmjs.com/package/@crabas0npm/voluptas-ad-vel)","homepage":"https://github.com/crabas0npm/voluptas-ad-vel/#readme","keywords":["set","readablestream","yaml","phone","tostringtag","error-handling","flag","airbnb","installer","findLastIndex","Object.assign","fantasy-land","deepcopy","circular","ECMAScript 2021","shared","whatwg","cli","define","cache","streams","auth","walking","proto","irq","getintrinsic","filter","setter","Object.entries","package manager","authentication","call-bind","Array.prototype.filter","classnames","wget","rangeerror","regex","env","invariant","syntax","styling","toStringTag","zero","shrinkwrap","extend","waapi","@@toStringTag","es2015","website","tc39","Promise","columns","progress","JSON-Schema","es-abstract","optimizer","sequence","settings","libphonenumber","move","linewrap","Array.prototype.contains","visual","protobuf","lint","directory","throttle","connect","BigUint64Array","launch","browser","immutable","json-schema-validation","option","hash","name","terminal","ECMAScript 2017","crypt","less mixins","less css","copy","watcher","worker","eslintplugin","var","crypto","characters","emoji","mkdirs","arrays","code points","qs","gestures","command-line","formatting","hookform","lazy","ECMAScript 2022","eslint-plugin","syntaxerror","bind","output","npm","typeof","entries","codes","Uint16Array","urls","random","watchFile","generics","weakmap","polyfill","ES2020","mime-db","groupBy","mobile","async","concurrency","negative","typescript","util","mixins","autoprefixer","ArrayBuffer#slice","character","extra","get","deep","higher-order","pyyaml","forms","curl","URL","protocol-buffers","https","awesomesauce","linux","banner","colour","trimStart","fp","redux-toolkit","logger","file","dotenv","sameValueZero","encryption","ansi","ECMAScript 2020","helpers","call-bound","flat","traverse","path","validator","validate","typesafe","mocha","ES6","serialization","regexp","color","less","typanion","forEach","pnpm9","ES2016","byteLength","fastify","default","map","getOwnPropertyDescriptor","rm","optimist","client","WeakSet","art","obj","framework","performant","gradients css","browserlist","up","YAML","WeakMap","ES2018","immer","uninstall","transpile","multi-package","preserve-symlinks","Underscore","deep-copy","hasOwn","parse","id","buffers","getopt","colors","recursive","environment","rm -rf","private data","logging","ava","structuredClone","performance","length","packages","byte","getter","has","description","slice","pretty","Push","idle","concatMap","CSS","Int32Array","once","keys","ECMAScript 2015","native","css-in-js","user-streams","indicator","trimEnd","ECMAScript 7","find","deep-clone","ratelimit","ECMAScript 2019","collection.es6","read","korean","fast-deep-copy","Array.prototype.findLast","limit","emit","json-schema-validator","glob","intrinsic","ES2023","dependency manager","unicode","es2018","rm -fr","less.js","tacit","javascript","call","stream","RegExp#flags","workspace:*","password","ECMAScript 2023","Symbol","arraybuffer","arguments","private","ES8","ReactiveX","tools","omit","scheme","speed","type","es8","Rx","babel","parents","wait","configurable","nope","Object.keys","valid","from","deepclone","tdd","api","find-up","persistent","css nesting","flatMap","check","quote","pipe","batch","ast","RegExp.prototype.flags","postcss","error","mimetypes","query","Set","styleguide","descriptors","jest","Iterator","animation","descriptor","interrupts","Array.prototype.includes","functional","react-hook-form","modules","redact","StyleSheet","ArrayBuffer","validation","compiler","TypeScript","argument","ES7","matches","exe","break","postcss-plugin","ES2022","group","ECMAScript 2018","fast","uuid","reducer","stringify","shim","format","typed array","enumerable","nodejs","es6","json","String.prototype.trim","Object.defineProperty","stylesheet","reduce","ES","data","symlinks","web","browserslist","efficient","xterm","fastclone","folder","equality","metadata","accessor","getPrototypeOf","isConcatSpreadable","request","child","watch","findLast","fetch","is","fullwidth","censor","framer","busy","xss","last","full","walk"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/voluptas-ad-vel.git"},"author":{"name":"Crabas0"},"bugs":{"url":"https://github.com/crabas0npm/voluptas-ad-vel/issues"},"license":"MIT","readme":"# @crabas0npm/voluptas-ad-vel\n\n[![npm](https://img.shields.io/npm/v/@crabas0npm/voluptas-ad-vel.svg)](https://npmjs.com/package/@crabas0npm/voluptas-ad-vel)\n\nA JavaScript ANSI color/style management. ANSI parsing. ANSI to CSS. Small, clean, no dependencies.\n\n```bash\nnpm install @crabas0npm/voluptas-ad-vel\n```\n\n## What For\n\n- String coloring with ANSI escape codes\n- Solves the [style hierarchy problem](#why-another-one) (when other similar tools fail)\n- Parsing/removing ANSI style data from strings\n- Converting ANSI styles to CSS or a Chrome DevTools-compatible output\n- A middleware for your [platform-agnostic logging system](https://github.com/xpl/ololog)\n\n## Why Another One?\n\nOther tools lack consistency, failing to solve a simple hierarchy problem:\n\n```javascript\nrequire ('colors') // a popular color utility\n\nconsole.log (('foo'.cyan + 'bar').red)\n```\n\n![pic](http://cdn.jpg.wtf/futurico/85/9b/1470626860-859b24350e22df74fd7497e9dc0d8d42.png)\n\nWTF?! The `bar` word above should be rendered in red, but it's not! That sucks. It's because ANSI codes are linear, not hierarchical (as with XML/HTML). A special kind of magic is needed to make this work. **Ansicolor** does that magic for you:\n\n```javascript\nrequire ('@crabas0npm/voluptas-ad-vel').nice // .nice for unsafe String extensions\n\nconsole.log (('foo'.cyan + 'bar').red)\n```\n\n![pic](http://cdn.jpg.wtf/futurico/3c/61/1470626989-3c61b64d0690b0b413be367841650426.png)\n\nNice!\n\n## Crash Course\n\nImporting (as methods):\n\n```javascript\nimport { green, inverse, bgLightCyan, underline, dim } from '@crabas0npm/voluptas-ad-vel'\n```\n```javascript\nconst { green, inverse, bgLightCyan, underline, dim } = require ('@crabas0npm/voluptas-ad-vel')\n```\n\nUsage:\n\n```javascript\nconsole.log ('foo' + green (inverse (bgLightCyan ('bar')) + 'baz') + 'qux')\n```\n```javascript\nconsole.log (underline.bright.green ('foo' + dim.red.bgLightCyan ('bar'))) // method chaining\n```\n\nImporting (as object):\n\n```javascript\nimport { @crabas0npm/voluptas-ad-vel, ParsedSpan } from '@crabas0npm/voluptas-ad-vel' // along with type definitions\n```\n```javascript\nimport @crabas0npm/voluptas-ad-vel from '@crabas0npm/voluptas-ad-vel'\n```\n\n### Nice Mode (not recommended)\n\n```javascript\nconst ansi = require ('@crabas0npm/voluptas-ad-vel').nice\n```\n\nThe `('@crabas0npm/voluptas-ad-vel').nice` export defines styling APIs on the `String` prototype directly. It uses an ad-hoc DSL (sort of) for infix-style string coloring. The `nice` is convenient, but not safe, avoid using it in public modules, as it alters global objects, and that might cause potential hard-to-debug compatibility issues.\n\n```javascript\nconsole.log ('foo'.red.bright + 'bar'.bgYellow.underline.dim)\n```\n\n### Supported Styles\n\n```javascript\n'foreground colors'\n    .red.green.yellow.blue.magenta.cyan.white.darkGray.black\n```\n```javascript\n'light foreground colors'\n    .lightRed.lightGreen.lightYellow.lightBlue.lightMagenta.lightCyan.lightGray\n```\n```javascript\n'background colors'\n    .bgRed.bgGreen.bgYellow.bgBlue.bgMagenta.bgCyan.bgWhite.bgDarkGray.bgBlack\n```\n```javascript\n'light background colors'\n    .bgLightRed.bgLightGreen.bgLightYellow.bgLightBlue.bgLightMagenta.bgLightCyan.bgLightGray\n```\n```javascript\n'styles'\n    .bright.dim.italic.underline.inverse // your platform should support italic\n```\n\nYou also can obtain all those style names (for reflection purposes):\n\n```javascript\nconst { names } = require ('@crabas0npm/voluptas-ad-vel')\n\nnames // ['red', 'green', ...\n```\n\n## Removing ANSI Styles From Strings\n\n```javascript\nconst { strip } = require ('@crabas0npm/voluptas-ad-vel')\n\nstrip ('\\u001b[0m\\u001b[4m\\u001b[42m\\u001b[31mfoo\\u001b[39m\\u001b[49m\\u001b[24mfoo\\u001b[0m')) // 'foofoo'\n```\n\n## Checking If Strings Contain ANSI Codes\n\n```javascript\nconst { isEscaped, green } = require ('@crabas0npm/voluptas-ad-vel')\n\nisEscaped ('text')         // false\nisEscaped (green ('text')) // true\n```\n\n\n## Converting to CSS/HTML\n\nInspection of ANSI styles in arbitrary strings is essential when implementing platform-agnostic logging — that piece of code is available under command line interface and in a browser as well. Here's an example of how you would parse a colored string into an array-like structure. That structure can be traversed later to build HTML/JSON/XML or any other markup/syntax.\n\n```javascript\nconst { parse } = require ('@crabas0npm/voluptas-ad-vel')\n\nconst parsed = parse ('foo'.bgLightRed.bright.italic + 'bar'.red.dim)\n```\n\nThe `ansi.parse ()` method will return a pseudo-array of styled spans, you can iterate over it with a `for ... of` loop and convert it to an array with the *spread operator* (`...`). Also, there's the `.spans` property for obtaining the already-spread array directly:\n\n```javascript\nassert.deepEqual (parsed.spans /* or [...parsed] */,\n\n    [ { css: 'font-weight: bold;font-style: italic;background:rgba(255,51,0,1);',\n        italic: true,\n        bold: true,\n        color: { bright: true },\n        bgColor: { name: 'lightRed' },\n        text: 'foo' },\n\n      { css: 'color:rgba(204,0,0,0.5);',\n        color: { name: 'red', dim: true },\n        text: 'bar' } ])\n```\n\n### Custom Color Themes\n\nYou can change default RGB values (won't work in terminals, affects only the ANSI→CSS transformation part):\n\n```javascript\nconst ansi = require ('@crabas0npm/voluptas-ad-vel')\n\nansi.rgb = {\n\n    black:        [0,     0,   0],    \n    darkGray:     [100, 100, 100],\n    lightGray:    [200, 200, 200],\n    white:        [255, 255, 255],\n\n    red:          [204,   0,   0],\n    lightRed:     [255,  51,   0],\n    \n    green:        [0,   204,   0],\n    lightGreen:   [51,  204,  51],\n    \n    yellow:       [204, 102,   0],\n    lightYellow:  [255, 153,  51],\n    \n    blue:         [0,     0, 255],\n    lightBlue:    [26,  140, 255],\n    \n    magenta:      [204,   0, 204],\n    lightMagenta: [255,   0, 255],\n    \n    cyan:         [0,   153, 255],\n    lightCyan:    [0,   204, 255],\n}\n```\n\n## Chrome DevTools Compatibility\n\nWeb browsers usually implement their own proprietary CSS-based color formats for `console.log` and most of them fail to display standard ANSI colors. _Ansicolor_ offers you a helper method to convert ANSI-styled strings to browser-compatible argument lists acceptable by Chrome's `console.log`:\n\n```javascript\nconst { bgGreen, red, parse } = require ('@crabas0npm/voluptas-ad-vel')\n\nconst string = 'foo' + bgGreen (red.underline.bright.inverse ('bar') + 'baz')\nconst parsed = parse (string)\n\nconsole.log (...parsed.asChromeConsoleLogArguments) // prints with colors in Chrome!\n```\n\nHere's what the format looks like:\n\n```javascript\nparsed.asChromeConsoleLogArguments // [ \"%cfoo%cbar%cbaz\",\n                                   //   \"\",\n                                   //   \"font-weight: bold;text-decoration: underline;background:rgba(255,51,0,1);color:rgba(0,204,0,1);\",\n                                   //   \"background:rgba(0,204,0,1);\"\n                                   // ]\n```\n\nPlay with this feature online: [demo page](https://xpl.github.io/ololog/). Open the DevTools console and type expressions in the input box to see colored console output.\n\nHappy logging!\n\n## Projects That Use `@crabas0npm/voluptas-ad-vel`\n\n- [**Ololog!**](https://github.com/xpl/ololog) — a better `console.log` for the log-driven debugging junkies\n- [**CCXT**](https://github.com/ccxt/ccxt) — a cryptocurrency trading API with 130+ exchanges\n- [**Grafana**](https://github.com/grafana/grafana) — beautiful monitoring & metric analytics & dashboards\n\n","readmeFilename":"README.md"}