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

braft-utils

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

braft-utils - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

41

dist/color.js

@@ -150,28 +150,29 @@ "use strict";

exports.default = {
var getHexColor = function getHexColor(color) {
namedColors: namedColors,
color = color.replace('color:', '').replace(';', '').replace(' ', '');
getHexColor: function getHexColor(color) {
if (/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(color)) {
return color;
} else if (namedColors[color]) {
return namedColors[color];
} else if (color.indexOf('rgb') === 0) {
color = color.replace('color:', '').replace(';', '').replace(' ', '');
var rgbArray = color.split(',');
var convertedColor = rgbArray.length < 3 ? null : '#' + [rgbArray[0], rgbArray[1], rgbArray[2]].map(function (x) {
var hex = parseInt(x.replace(/\D/g, ''), 10).toString(16);
return hex.length === 1 ? '0' + hex : hex;
}).join('');
if (/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(color)) {
return color;
} else if (namedColors[color]) {
return namedColors[color];
} else if (color.indexOf('rgb') === 0) {
return (/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(convertedColor) ? convertedColor : null
);
} else {
return null;
}
};
var rgbArray = color.split(',');
var convertedColor = rgbArray.length < 3 ? null : '#' + [rgbArray[0], rgbArray[1], rgbArray[2]].map(function (x) {
var hex = parseInt(x.replace(/\D/g, ''), 10).toString(16);
return hex.length === 1 ? '0' + hex : hex;
}).join('');
exports.default = {
return (/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(convertedColor) ? convertedColor : null
);
} else {
return null;
}
},
namedColors: namedColors, getHexColor: getHexColor,
detectColorsFromHTMLString: function detectColorsFromHTMLString(html) {

@@ -178,0 +179,0 @@ return typeof html !== 'string' ? [] : (html.match(/color:[^;]{3,24};/g) || []).map(getHexColor).filter(function (color) {

{
"name": "braft-utils",
"version": "0.0.8",
"version": "0.0.9",
"description": "Utils for Braft Editor",

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

Sorry, the diff of this file is not supported yet

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