Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@palett/presets

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@palett/presets - npm Package Compare versions

Comparing version 0.5.2 to 0.5.5

59

dist/index.cjs.js

@@ -168,3 +168,3 @@ 'use strict';

const brt = code => L + code + R;
const enclose = code => L + code + R;
/**

@@ -179,35 +179,26 @@ *

const assignEffects = function (effects) {
const conf = this;
for (let effect of effects) if (effect in Effects && (effect = Effects[effect])) conf.head += SC + effect[0], conf.tail += SC + effect[1];
return conf;
};
/**
*
* @param {string} tx
* @param {string} text
* @returns {string}
*/
function codedDyer(tx) {
function dye(text) {
const {
h,
t
head,
tail
} = this;
return brt(h) + tx + brt(t);
return head + text + tail;
}
const parseEffects = effects => {
let h = '',
t = '';
if (effects.length) {
let l, r;
for (let e of effects) if (e in Effects && ([l, r] = Effects[e])) h += SC + l, t += SC + r;
}
return {
h,
t
};
};
/***
*
* @param {number[]} rgb
* @param {...string} [effects]
* @param {string|number[]} color
* @returns {function(string):string}

@@ -217,7 +208,17 @@ */

const Dye = (rgb, ...effects) => {
const config = parseEffects(effects);
config.h += SC + rgbToAnsi(rgb), config.t += SC + CLR_FORE;
return codedDyer.bind(config);
};
function Dye(color) {
const config = this !== null && this !== void 0 ? this : {};
let {
ansi = rgbToAnsi,
head = '',
tail = '',
effects
} = config;
if (effects === null || effects === void 0 ? void 0 : effects.length) assignEffects.call(config, effects);
head = enclose(head + SC + ansi(color)), tail = enclose(tail + SC + CLR_FORE);
return dye.bind({
head,
tail
});
}

@@ -224,0 +225,0 @@ /**

@@ -164,3 +164,3 @@ import { Palett } from '@palett/cards';

const brt = code => L + code + R;
const enclose = code => L + code + R;
/**

@@ -175,35 +175,26 @@ *

const assignEffects = function (effects) {
const conf = this;
for (let effect of effects) if (effect in Effects && (effect = Effects[effect])) conf.head += SC + effect[0], conf.tail += SC + effect[1];
return conf;
};
/**
*
* @param {string} tx
* @param {string} text
* @returns {string}
*/
function codedDyer(tx) {
function dye(text) {
const {
h,
t
head,
tail
} = this;
return brt(h) + tx + brt(t);
return head + text + tail;
}
const parseEffects = effects => {
let h = '',
t = '';
if (effects.length) {
let l, r;
for (let e of effects) if (e in Effects && ([l, r] = Effects[e])) h += SC + l, t += SC + r;
}
return {
h,
t
};
};
/***
*
* @param {number[]} rgb
* @param {...string} [effects]
* @param {string|number[]} color
* @returns {function(string):string}

@@ -213,7 +204,17 @@ */

const Dye = (rgb, ...effects) => {
const config = parseEffects(effects);
config.h += SC + rgbToAnsi(rgb), config.t += SC + CLR_FORE;
return codedDyer.bind(config);
};
function Dye(color) {
const config = this !== null && this !== void 0 ? this : {};
let {
ansi = rgbToAnsi,
head = '',
tail = '',
effects
} = config;
if (effects === null || effects === void 0 ? void 0 : effects.length) assignEffects.call(config, effects);
head = enclose(head + SC + ansi(color)), tail = enclose(tail + SC + CLR_FORE);
return dye.bind({
head,
tail
});
}

@@ -220,0 +221,0 @@ /**

{
"name": "@palett/presets",
"version": "0.5.2",
"version": "0.5.5",
"description": "A color converter",

@@ -20,5 +20,5 @@ "main": "dist/index.cjs.js",

"@ject/oneself": "^0.0.6",
"@palett/cards": "^0.5.2",
"@palett/convert": "^0.5.2",
"@palett/toner-hsl": "^0.5.2"
"@palett/cards": "^0.5.5",
"@palett/convert": "^0.5.5",
"@palett/toner-hsl": "^0.5.5"
},

@@ -46,3 +46,3 @@ "repository": {

"homepage": "https://github.com/hoyeungw/palett/presets#readme",
"gitHead": "731886f4bc0fe1be384e492718f0aa493c8209e4"
"gitHead": "f5d829829b4c51ca298c3daa24010f244dc844e6"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc