@palett/fluo-vector
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -13,2 +13,3 @@ 'use strict'; | ||
var vector = require('@vect/vector'); | ||
var oneself = require('@ject/oneself'); | ||
var projector = require('@palett/projector'); | ||
@@ -68,32 +69,29 @@ var nullish = require('@typen/nullish'); | ||
* | ||
* @typedef {Object} PalettProjectConfig | ||
* @typedef {Function} PalettProjectConfig.filter | ||
* @typedef {Function} PalettProjectConfig.mapper | ||
* @typedef {Object} PalettProjectConfig.preset | ||
* @typedef {Object} PresetAndConfig | ||
* @typedef {string} PresetAndConfig.max | ||
* @typedef {string} PresetAndConfig.min | ||
* @typedef {string} PresetAndConfig.na | ||
* @typedef {Function} PresetAndConfig.mapper | ||
* @typedef {Function} PresetAndConfig.filter | ||
* | ||
* @param vec | ||
* @param {PalettProjectConfig[]} presets | ||
* @param {PresetAndConfig[]} configs | ||
* @param {string[]} effects | ||
*/ | ||
const fluoVec = function (vec, presets$1 = [], effects) { | ||
var _x$preset, _y$preset; | ||
const fluoVec = function (vec, configs = [], effects) { | ||
if (!(vec === null || vec === void 0 ? void 0 : vec.length)) return []; | ||
const colorant = this === null || this === void 0 ? void 0 : this.colorant, | ||
mutate = this === null || this === void 0 ? void 0 : this.mutate; | ||
const [x, y] = presets$1; | ||
const pX = (_x$preset = x === null || x === void 0 ? void 0 : x.preset) !== null && _x$preset !== void 0 ? _x$preset : presets.FRESH, | ||
pY = (_y$preset = y === null || y === void 0 ? void 0 : y.preset) !== null && _y$preset !== void 0 ? _y$preset : presets.PLANET; | ||
const [bX, bY] = boundVector.duobound(vec, presets$1); | ||
const dX = projector.Projector(bX, pX, effects), | ||
dY = projector.Projector(bY, pY, effects); | ||
const [presetX, presetY] = configs; | ||
const [vecWithBoundX, vecWithBoundY] = boundVector.duobound(vec, configs); | ||
const dyeX = presetX ? projector.Projector(utilFluo.extractBound(vecWithBoundX), presetX, effects) : oneself.Oneself, | ||
dyeY = presetY ? projector.Projector(utilFluo.extractBound(vecWithBoundY), presetY, effects) : oneself.Oneself; | ||
const mapper = mutate ? vector.mutate : vector.mapper; | ||
return colorant ? mapper(vec, Colorant(bX, dX, bY, dY, utilFluo.presetToFlat(pX))) : mapper(vec, Pigment(bX, dX, bY, dY, utilFluo.presetToFlat(pY))); | ||
return colorant ? mapper(vec, Colorant(vecWithBoundX, dyeX, vecWithBoundY, dyeY, presetX ? utilFluo.presetToFlat(presetX) : oneself.oneself)) : mapper(vec, Pigment(vecWithBoundX, dyeX, vecWithBoundY, dyeY, presetY ? utilFluo.presetToFlat(presetY) : oneself.oneself)); | ||
}; | ||
const Colorant = function (bX, dX, bY, dY, dye) { | ||
return (_, i) => { | ||
const x = bX && bX[i], | ||
y = bY && bY[i]; | ||
return !nullish.nullish(x) ? dX(x) : !nullish.nullish(y) ? dY(y) : dye; | ||
let x, y; | ||
return !nullish.nullish(x = bX && bX[i]) ? dX(x) : !nullish.nullish(y = bY && bY[i]) ? dY(y) : dye; | ||
}; | ||
@@ -105,5 +103,4 @@ }; | ||
const x = bX && bX[i], | ||
y = bY && bY[i]; | ||
return !nullish.nullish(x) ? (_n = n, dX(x)(_n)) : !nullish.nullish(y) ? (_n2 = n, dY(y)(_n2)) : (_n3 = n, dye(_n3)); | ||
let x, y; | ||
return !nullish.nullish(x = bX && bX[i]) ? (_n = n, dX(x)(_n)) : !nullish.nullish(y = bY && bY[i]) ? (_n2 = n, dY(y)(_n2)) : (_n3 = n, dye(_n3)); | ||
}; | ||
@@ -110,0 +107,0 @@ }; |
@@ -5,6 +5,7 @@ import { bound, duobound } from '@aryth/bound-vector'; | ||
import { FRESH, JUNGLE, PLANET } from '@palett/presets'; | ||
import { dyezip, presetToFlat } from '@palett/util-fluo'; | ||
import { dyezip, extractBound, presetToFlat } from '@palett/util-fluo'; | ||
import { isLiteral } from '@typen/literal'; | ||
import { isNumeric } from '@typen/num-strict'; | ||
import { mutazip, zipper, mutate, mapper } from '@vect/vector'; | ||
import { Oneself, oneself } from '@ject/oneself'; | ||
import { Projector } from '@palett/projector'; | ||
@@ -64,32 +65,29 @@ import { nullish } from '@typen/nullish'; | ||
* | ||
* @typedef {Object} PalettProjectConfig | ||
* @typedef {Function} PalettProjectConfig.filter | ||
* @typedef {Function} PalettProjectConfig.mapper | ||
* @typedef {Object} PalettProjectConfig.preset | ||
* @typedef {Object} PresetAndConfig | ||
* @typedef {string} PresetAndConfig.max | ||
* @typedef {string} PresetAndConfig.min | ||
* @typedef {string} PresetAndConfig.na | ||
* @typedef {Function} PresetAndConfig.mapper | ||
* @typedef {Function} PresetAndConfig.filter | ||
* | ||
* @param vec | ||
* @param {PalettProjectConfig[]} presets | ||
* @param {PresetAndConfig[]} configs | ||
* @param {string[]} effects | ||
*/ | ||
const fluoVec = function (vec, presets = [], effects) { | ||
var _x$preset, _y$preset; | ||
const fluoVec = function (vec, configs = [], effects) { | ||
if (!(vec === null || vec === void 0 ? void 0 : vec.length)) return []; | ||
const colorant = this === null || this === void 0 ? void 0 : this.colorant, | ||
mutate$1 = this === null || this === void 0 ? void 0 : this.mutate; | ||
const [x, y] = presets; | ||
const pX = (_x$preset = x === null || x === void 0 ? void 0 : x.preset) !== null && _x$preset !== void 0 ? _x$preset : FRESH, | ||
pY = (_y$preset = y === null || y === void 0 ? void 0 : y.preset) !== null && _y$preset !== void 0 ? _y$preset : PLANET; | ||
const [bX, bY] = duobound(vec, presets); | ||
const dX = Projector(bX, pX, effects), | ||
dY = Projector(bY, pY, effects); | ||
const [presetX, presetY] = configs; | ||
const [vecWithBoundX, vecWithBoundY] = duobound(vec, configs); | ||
const dyeX = presetX ? Projector(extractBound(vecWithBoundX), presetX, effects) : Oneself, | ||
dyeY = presetY ? Projector(extractBound(vecWithBoundY), presetY, effects) : Oneself; | ||
const mapper$1 = mutate$1 ? mutate : mapper; | ||
return colorant ? mapper$1(vec, Colorant(bX, dX, bY, dY, presetToFlat(pX))) : mapper$1(vec, Pigment(bX, dX, bY, dY, presetToFlat(pY))); | ||
return colorant ? mapper$1(vec, Colorant(vecWithBoundX, dyeX, vecWithBoundY, dyeY, presetX ? presetToFlat(presetX) : oneself)) : mapper$1(vec, Pigment(vecWithBoundX, dyeX, vecWithBoundY, dyeY, presetY ? presetToFlat(presetY) : oneself)); | ||
}; | ||
const Colorant = function (bX, dX, bY, dY, dye) { | ||
return (_, i) => { | ||
const x = bX && bX[i], | ||
y = bY && bY[i]; | ||
return !nullish(x) ? dX(x) : !nullish(y) ? dY(y) : dye; | ||
let x, y; | ||
return !nullish(x = bX && bX[i]) ? dX(x) : !nullish(y = bY && bY[i]) ? dY(y) : dye; | ||
}; | ||
@@ -101,5 +99,4 @@ }; | ||
const x = bX && bX[i], | ||
y = bY && bY[i]; | ||
return !nullish(x) ? (_n = n, dX(x)(_n)) : !nullish(y) ? (_n2 = n, dY(y)(_n2)) : (_n3 = n, dye(_n3)); | ||
let x, y; | ||
return !nullish(x = bX && bX[i]) ? (_n = n, dX(x)(_n)) : !nullish(y = bY && bY[i]) ? (_n2 = n, dY(y)(_n2)) : (_n3 = n, dye(_n3)); | ||
}; | ||
@@ -106,0 +103,0 @@ }; |
{ | ||
"name": "@palett/fluo-vector", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "A colorant to string", | ||
@@ -19,8 +19,9 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@aryth/bound-vector": "^0.2.7", | ||
"@aryth/comparer": "^0.2.7", | ||
"@aryth/rank-vector": "^0.2.7", | ||
"@palett/presets": "^0.3.5", | ||
"@palett/projector": "^0.3.5", | ||
"@palett/util-fluo": "^0.3.5", | ||
"@aryth/bound-vector": "^0.2.9", | ||
"@aryth/comparer": "^0.2.9", | ||
"@aryth/rank-vector": "^0.2.9", | ||
"@ject/oneself": "^0.0.5", | ||
"@palett/presets": "^0.3.6", | ||
"@palett/projector": "^0.3.6", | ||
"@palett/util-fluo": "^0.3.6", | ||
"@typen/literal": "^0.1.5", | ||
@@ -49,3 +50,3 @@ "@typen/nullish": "^0.1.5", | ||
"homepage": "https://github.com/hoyeungw/palett/fluo-vector#readme", | ||
"gitHead": "c2ca58acdbfcc19e95d54134c815381cc2ffca4f" | ||
"gitHead": "965d1ba591a361fd8cb3997a613b32d485985cf7" | ||
} |
10758
11
193
+ Added@ject/oneself@^0.0.5
Updated@aryth/bound-vector@^0.2.9
Updated@aryth/comparer@^0.2.9
Updated@aryth/rank-vector@^0.2.9
Updated@palett/presets@^0.3.6
Updated@palett/projector@^0.3.6
Updated@palett/util-fluo@^0.3.6