@palett/fluo-entries
Advanced tools
Comparing version
@@ -1,29 +0,25 @@ | ||
import { arrToPres, Fluo } from '@palett/fluo'; | ||
import { mutazip } from '@vect/entries-zipper'; | ||
import { serialEntries } from '@spare/serial'; | ||
function unflattenVector(vector, columnNumber) { | ||
const rows = []; | ||
for (let i = 0; i < vector.length; i += columnNumber) { | ||
rows.push(vector.slice(i, i + columnNumber)); | ||
} | ||
return rows | ||
} | ||
/** | ||
* @typedef {Object|Preset} Preset | ||
* @typedef {string} Preset.min | ||
* @typedef {string} Preset.max | ||
* @typedef {string} Preset.na | ||
* @typedef {string[]} Preset.effects | ||
* @typedef {Function} Preset.by | ||
* @typedef {Function} Preset.to | ||
* | ||
* @param {[*,*][]} entries | ||
* @param {Preset[]} pres | ||
* @param {number} [keyWd] | ||
* @param {number} [valWd] | ||
* @param {Presm} presm | ||
* @returns {[string,string][]} | ||
*/ | ||
const fluoEntries = function (entries, pres, keyWd, valWd) { | ||
if (!entries?.length || !pres) return entries | ||
if (Array.isArray(pres)) pres = arrToPres(pres); | ||
const mode = this?.colorant, mutate = this?.mutate; | ||
const rendered = Fluo.entries(entries, pres, keyWd, valWd, mode); | ||
return mutate | ||
? mutazip(entries, rendered, (a, b) => b) | ||
: rendered | ||
}; | ||
function fluoEntries(entries, presm) { | ||
presm = presm ?? this; | ||
if (!entries?.length || !presm) return entries | ||
if (!presm) return entries | ||
const serial = serialEntries.call(presm, entries); | ||
return unflattenVector(serial, 2) | ||
} | ||
export { fluoEntries }; |
{ | ||
"name": "@palett/fluo-entries", | ||
"version": "0.12.19", | ||
"version": "0.12.20", | ||
"description": "A colorant to string", | ||
@@ -17,6 +17,8 @@ "type": "module", | ||
"dependencies": { | ||
"@spare/serial": "^0.16.17" | ||
}, | ||
"devDependencies": { | ||
"@vect/entries-init": "^0.8.0", | ||
"@vect/entries-unwind": "^0.6.13", | ||
"@vect/entries-zipper": "^0.8.0", | ||
"@palett/fluo": "^0.12.19" | ||
"@palett/fluo": "^0.12.20" | ||
}, | ||
@@ -23,0 +25,0 @@ "repository": { |
## @palett/fluoMatrix-entries | ||
A colorant to string | ||
@@ -13,14 +14,25 @@ | ||
[//]: <> (Shields) | ||
[npm-image]: https://img.shields.io/npm/v/@palett/fluo-entries.svg?style=flat-square | ||
[quality-image]: http://npm.packagequality.com/shield/@palett/fluo-entries.svg?style=flat-square | ||
[download-image]: https://img.shields.io/npm/dm/@palett/fluo-entries.svg?style=flat-square | ||
[total-download-image]:https://img.shields.io/npm/dt/@palett/fluo-entries.svg?style=flat-square | ||
[license-image]: https://img.shields.io/npm/l/@palett/fluo-entries.svg?style=flat-square | ||
[commit-image]: https://img.shields.io/github/commit-activity/y/hoyeungw/@palett/fluo-entries?style=flat-square | ||
[size]: https://packagephobia.now.sh/badge?p=@palett/fluo-entries | ||
[//]: <> (Link) | ||
[npm-url]: https://npmjs.org/package/@palett/fluo-entries | ||
[quality-url]: http://packagequality.com/#?package=@palett/fluo-entries | ||
[github-url]: https://github.com/hoyeungw/@palett/fluo-entries | ||
[size-url]: https://packagephobia.now.sh/result?p=@palett/fluo-entries | ||
@@ -33,2 +45,3 @@ | ||
## Install | ||
```console | ||
@@ -39,2 +52,3 @@ $ npm install @palett/fluoMatrix-entries | ||
## Usage | ||
```js | ||
@@ -45,2 +59,3 @@ import { Temp } from '@palett/fluoMatrix-entries' | ||
## Meta | ||
[LICENSE (MIT)](/LICENSE) |
1
-75%58
34.88%4364
-4.94%3
Infinity%21
-22.22%+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed