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

color-name-list

Package Overview
Dependencies
Maintainers
0
Versions
385
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-name-list - npm Package Compare versions

Comparing version 10.28.1 to 11.0.0

.husky/pre-commit

28

package.json
{
"name": "color-name-list",
"version": "10.28.1",
"version": "11.0.0",
"description": "long list of color names",
"main": "dist/colornames.json",
"browser": "dist/colornames.umd.js",
"module": "dist/colornames.esm.js",
"type": "module",
"exports": {
".": {
"import": "./dist/colornames.esm.js",
"require": "./dist/colornames.umd.js"
},
"./bestof": {
"import": "./dist/colornames.bestof.esm.js",
"require": "./dist/colornames.bestof.umd.js"
},
"./short": {
"import": "./dist/colornames.short.esm.js",
"require": "./dist/colornames.short.umd.js"
},
"./package.json": "./package.json"
},
"scripts": {

@@ -14,3 +31,4 @@ "commit": "git-cz",

"semantic-release": "semantic-release",
"build-history": "node scripts/tools/history.js > dist/history.json"
"build-history": "node scripts/tools/history.js > dist/history.json",
"prepare": "husky"
},

@@ -41,3 +59,3 @@ "repository": {

"eslint-config-google": "^0.10.0",
"ghooks": "^2.0.4",
"husky": "^9.1.6",
"seedrandom": "^3.0.5",

@@ -51,5 +69,2 @@ "semantic-release": "^19.0.2"

"config": {
"ghooks": {
"pre-commit": "npm run test && npm run build"
},
"commitizen": {

@@ -59,3 +74,2 @@ "path": "cz-conventional-changelog"

},
"dependencies": {},
"funding": [

@@ -62,0 +76,0 @@ {

@@ -138,8 +138,8 @@ <img align="left" height="119" width="119" src="https://meodai.github.io/color-names/logo/cockatoo-fill.svg">

```javascript
import { colorNameList } from 'color-name-list';
import { colornames } from 'color-name-list';
let someColor = colorNameList.find(color => color.hex === '#ffffff');
let someColor = colornames.find(color => color.hex === '#ffffff');
console.log(someColor.name); // => white
let someNamedColor = colorNameList.find(color => color.name === 'Eigengrau')
let someNamedColor = colornames.find(color => color.name === 'Eigengrau')
console.log(someColor.hex); // => #16161d

@@ -155,6 +155,6 @@ ```

import nearestColor from 'nearest-color';
import { colorNameList } from 'color-name-list';
import { colornames } from 'color-name-list';
// nearestColor need objects {name => hex} as input
const colors = colorNameList.reduce((o, { name, hex }) => Object.assign(o, { [name]: hex }), {});
const colors = colornames.reduce((o, { name, hex }) => Object.assign(o, { [name]: hex }), {});

@@ -161,0 +161,0 @@ const nearest = nearestColor.from(colors);

@@ -1,10 +0,8 @@

const fs = require('fs');
const path = require('path');
const lib = require('./lib.js');
const parseCSVString = lib.parseCSVString;
const findDuplicates = lib.findDuplicates;
const objArrToString = lib.objArrToString;
import fs from 'fs';
import path from 'path';
import { parseCSVString, findDuplicates, objArrToString } from './lib.js';
import { exec } from 'child_process';
const args = process.argv;
const isTestRun = !!args.find((arg) => (arg === '--testOnly'));
const exec = require('child_process').exec;

@@ -22,2 +20,3 @@ // only hex colors with 6 values

// setting
const __dirname = path.dirname(new URL(import.meta.url).pathname);
const baseFolder = __dirname + '/../';

@@ -24,0 +23,0 @@ const folderSrc = 'src/';

@@ -1,89 +0,94 @@

module.exports = {
/**
* takes a CSV string an parse it
* @param {String} csvString CSV file contents
* @param {String} csvDelimitor
* @param {String} csvNewLine
* @return {Object} Object with all entries, headers as Array,
* and entires per header as Array
*/
parseCSVString: (csvString, csvDelimitor = ',', csvNewLine = '\r\n') => {
const rows = csvString.split(csvNewLine);
// remove last empty row (if there is any)
if (!rows.slice(-1)[0]) {
rows.pop();
}
/**
* takes a CSV string an parse it
* @param {String} csvString CSV file contents
* @param {String} csvDelimitor
* @param {String} csvNewLine
* @return {Object} Object with all entries, headers as Array,
* and entires per header as Array
*/
export const parseCSVString = (
csvString, csvDelimitor = ',', csvNewLine = '\r\n'
) => {
const rows = csvString.split(csvNewLine);
// extracts all the CSV headers
const headers = rows.shift().split(csvDelimitor);
// remove last empty row (if there is any)
if (!rows.slice(-1)[0]) {
rows.pop();
}
// collection of values per row
const values = {};
// extracts all the CSV headers
const headers = rows.shift().split(csvDelimitor);
headers.forEach((header) => {
values[header] = [];
});
// collection of values per row
const values = {};
const entires = rows.map((row) => {
// decomposes each row into its single entries
const rowArr = row.split(csvDelimitor);
headers.forEach((header) => {
values[header] = [];
});
// creates an object for for each entry
const entry = {};
const entires = rows.map((row) => {
// decomposes each row into its single entries
const rowArr = row.split(csvDelimitor);
// populates the entries
headers.forEach((header, i) => {
const value = rowArr[i];
entry[header] = value;
// creates an object for for each entry
const entry = {};
// collects values
values[header].push(value);
});
// populates the entries
headers.forEach((header, i) => {
const value = rowArr[i];
entry[header] = value;
return entry;
// collects values
values[header].push(value);
});
return {headers, entires, values};
},
return entry;
});
/**
* finds duplicates in a simple array
* @param {array} arr array of items containing comparable items
* @return {array} array of second (or more) instance of duplicate items
*/
findDuplicates: (arr) => {
const lookUpObj={};
const dupes = [];
return {headers, entires, values};
};
arr.forEach((item) => {
if (lookUpObj.hasOwnProperty(item)) {
dupes.push(item);
}
lookUpObj[item]=0;
});
/**
* finds duplicates in a simple array
* @param {array} arr array of items containing comparable items
* @return {array} array of second (or more) instance of duplicate items
*/
export const findDuplicates = (arr) => {
const lookUpObj={};
const dupes = [];
return dupes;
},
arr.forEach((item) => {
if (lookUpObj.hasOwnProperty(item)) {
dupes.push(item);
}
lookUpObj[item]=0;
});
objArrToString: (arr, keys, options) => {
const settings = Object.assign({}, {
includeKeyPerItem: false,
beforeKey: '',
afterKey: '',
beforeValue: '',
afterValue: '',
keyValueSeparator: ':',
insertBefore: '',
insertAfter: '',
rowDelimitor: '\r\n',
itemDelimitor: ',',
}, options);
return dupes;
};
return settings.insertBefore + arr.map((item) => {
return keys.map((key) => {
return (settings.includeKeyPerItem ? settings.beforeKey + key + settings.afterKey + settings.keyValueSeparator : '') + settings.beforeValue + item[key] + settings.afterValue;
}).join(settings.itemDelimitor);
}).join(settings.rowDelimitor) + settings.insertAfter;
},
export const objArrToString = (arr, keys, options) => {
const settings = Object.assign({}, {
includeKeyPerItem: false,
beforeKey: '',
afterKey: '',
beforeValue: '',
afterValue: '',
keyValueSeparator: ':',
insertBefore: '',
insertAfter: '',
rowDelimitor: '\r\n',
itemDelimitor: ',',
}, options);
return settings.insertBefore + arr.map((item) => {
return keys.map((key) => {
return (
settings.includeKeyPerItem ?
settings.beforeKey + key +
settings.afterKey + settings.keyValueSeparator : ''
) + settings.beforeValue + item[key] + settings.afterValue;
}).join(settings.itemDelimitor);
}).join(settings.rowDelimitor) + settings.insertAfter;
};

@@ -1,6 +0,5 @@

const child_process = require("child_process");
const readline = require("readline");
import { execSync } from "child_process";
function cmd(c) {
const stdout = child_process.execSync(c);
const stdout = execSync(c);
return stdout.toString().trim();

@@ -7,0 +6,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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