tools: update ESLint to 7.23.0

PR-URL: https://github.com/nodejs/node/pull/37979
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Luigi Pinca 2021-03-30 08:24:00 +02:00 committed by Myles Borins
parent 6ad0b6f0f5
commit 6d28a24f1c
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946
394 changed files with 13149 additions and 10609 deletions

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "bail",
"version": "1.0.5",
"description": "Throw a given error",
"license": "MIT",
"keywords": [
"fail",
"bail",
"throw",
"callback",
"error"
],
"repository": "wooorm/bail",
"bugs": "https://github.com/wooorm/bail/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/bail/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Throw a given error",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,28 +34,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/bail#readme",
"keywords": [
"fail",
"bail",
"throw",
"callback",
"error"
],
"license": "MIT",
"name": "bail",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.js -s bail -o bail.js",
"build-mangle": "browserify index.js -s bail -p tinyify -o bail.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,30 +51,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/bail.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js -s bail -o bail.js",
"build-mangle": "browserify index.js -s bail -p tinyify -o bail.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.5",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"bail.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
}
}
}

View File

@ -1,23 +1,32 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "character-entities-legacy",
"version": "1.1.4",
"description": "HTML legacy character entity information",
"license": "MIT",
"keywords": [
"html",
"entity",
"entities",
"character",
"reference",
"name",
"replacement"
],
"repository": "wooorm/character-entities-legacy",
"bugs": "https://github.com/wooorm/character-entities-legacy/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/character-entities-legacy/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"main": "index.json",
"files": [
"index.json"
],
"dependencies": {},
"deprecated": false,
"description": "HTML legacy character entity information",
"devDependencies": {
"bail": "^1.0.0",
"browserify": "^16.0.0",
@ -29,26 +38,15 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.json"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"generate": "node build",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.json -s characterEntitiesLegacy -o character-entities-legacy.js",
"build-mangle": "browserify index.json -s characterEntitiesLegacy -p tinyify -o character-entities-legacy.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test": "npm run generate && npm run format && npm run build && npm run test-api"
},
"homepage": "https://github.com/wooorm/character-entities-legacy#readme",
"keywords": [
"html",
"entity",
"entities",
"character",
"reference",
"name",
"replacement"
],
"license": "MIT",
"main": "index.json",
"name": "character-entities-legacy",
"prettier": {
"tabWidth": 2,
"useTabs": false,
@ -57,30 +55,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/character-entities-legacy.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.json -s characterEntitiesLegacy -o character-entities-legacy.js",
"build-mangle": "browserify index.json -s characterEntitiesLegacy -p tinyify -o character-entities-legacy.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"generate": "node build",
"test": "npm run generate && npm run format && npm run build && npm run test-api",
"test-api": "node test"
},
"version": "1.1.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"character-entities-legacy.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,32 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "character-entities",
"version": "1.2.4",
"description": "HTML character entity information",
"license": "MIT",
"keywords": [
"html",
"entity",
"entities",
"character",
"reference",
"name",
"replacement"
],
"repository": "wooorm/character-entities",
"bugs": "https://github.com/wooorm/character-entities/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/character-entities/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"main": "index.json",
"files": [
"index.json"
],
"dependencies": {},
"deprecated": false,
"description": "HTML character entity information",
"devDependencies": {
"bail": "^1.0.0",
"browserify": "^16.0.0",
@ -29,26 +38,16 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.json"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"generate": "node build",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.json -s characterEntities -o character-entities.js",
"build-mangle": "browserify index.json -s characterEntities -p tinyify -o character-entities.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"lint": "xo",
"test-api": "node test",
"test": "npm run generate && npm run format && npm run build && npm run test-api"
},
"homepage": "https://github.com/wooorm/character-entities#readme",
"keywords": [
"html",
"entity",
"entities",
"character",
"reference",
"name",
"replacement"
],
"license": "MIT",
"main": "index.json",
"name": "character-entities",
"prettier": {
"tabWidth": 2,
"useTabs": false,
@ -57,31 +56,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/character-entities.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.json -s characterEntities -o character-entities.js",
"build-mangle": "browserify index.json -s characterEntities -p tinyify -o character-entities.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"generate": "node build",
"lint": "xo",
"test": "npm run generate && npm run format && npm run build && npm run test-api",
"test-api": "node test"
},
"version": "1.2.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"character-entities.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,33 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "character-reference-invalid",
"version": "1.1.4",
"description": "HTML invalid numeric character reference information",
"license": "MIT",
"keywords": [
"html",
"entity",
"numeric",
"character",
"reference",
"replacement",
"invalid",
"name"
],
"repository": "wooorm/character-reference-invalid",
"bugs": "https://github.com/wooorm/character-reference-invalid/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/character-reference-invalid/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"main": "index.json",
"files": [
"index.json"
],
"dependencies": {},
"deprecated": false,
"description": "HTML invalid numeric character reference information",
"devDependencies": {
"bail": "^1.0.0",
"browserify": "^16.0.0",
@ -32,27 +42,15 @@
"unified": "^8.0.0",
"xo": "^0.25.0"
},
"files": [
"index.json"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"generate": "node build",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.json -s characterReferenceInvalid -o character-reference-invalid.js",
"build-mangle": "browserify index.json -s characterReferenceInvalid -p tinyify -o character-reference-invalid.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test": "npm run generate && npm run format && npm run build && npm run test-api"
},
"homepage": "https://github.com/wooorm/character-reference-invalid#readme",
"keywords": [
"html",
"entity",
"numeric",
"character",
"reference",
"replacement",
"invalid",
"name"
],
"license": "MIT",
"main": "index.json",
"name": "character-reference-invalid",
"prettier": {
"tabWidth": 2,
"useTabs": false,
@ -61,30 +59,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/character-reference-invalid.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.json -s characterReferenceInvalid -o character-reference-invalid.js",
"build-mangle": "browserify index.json -s characterReferenceInvalid -p tinyify -o character-reference-invalid.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"generate": "node build",
"test": "npm run generate && npm run format && npm run build && npm run test-api",
"test-api": "node test"
},
"version": "1.1.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"character-reference-invalid.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,27 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "collapse-white-space",
"version": "1.0.6",
"description": "Replace multiple white-space characters with a single space",
"license": "MIT",
"keywords": [
"collapse",
"white",
"space"
],
"repository": "wooorm/collapse-white-space",
"bugs": "https://github.com/wooorm/collapse-white-space/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/collapse-white-space/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Replace multiple white-space characters with a single space",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,26 +32,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/collapse-white-space#readme",
"keywords": [
"collapse",
"white",
"space"
],
"license": "MIT",
"name": "collapse-white-space",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s collapseWhiteSpace -o collapse-white-space.js",
"build-mangle": "browserify . -s collapseWhiteSpace -p tinyify -o collapse-white-space.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -57,30 +49,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/collapse-white-space.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s collapseWhiteSpace -o collapse-white-space.js",
"build-mangle": "browserify . -s collapseWhiteSpace -p tinyify -o collapse-white-space.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.6",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"collapse-white-space.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
}
}
}

View File

@ -1,52 +1,42 @@
{
"author": {
"name": "Stefan Thomas",
"email": "justmoon@members.fsf.org",
"url": "http://www.justmoon.net"
},
"bugs": {
"url": "https://github.com/justmoon/node-extend/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jordan Harband",
"url": "https://github.com/ljharb"
}
],
"dependencies": {},
"deprecated": false,
"description": "Port of jQuery.extend for node.js and the browser",
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0",
"eslint": "^4.19.1",
"jscs": "^3.0.7",
"tape": "^4.9.1"
},
"homepage": "https://github.com/justmoon/node-extend#readme",
"keywords": [
"extend",
"clone",
"merge"
],
"license": "MIT",
"main": "index",
"name": "extend",
"repository": {
"type": "git",
"url": "git+https://github.com/justmoon/node-extend.git"
},
"scripts": {
"coverage": "covert test/index.js",
"coverage-quiet": "covert test/index.js --quiet",
"eslint": "eslint *.js */*.js",
"jscs": "jscs *.js */*.js",
"lint": "npm run jscs && npm run eslint",
"posttest": "npm run coverage-quiet",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "node test"
},
"version": "3.0.2"
}
"name": "extend",
"author": "Stefan Thomas <justmoon@members.fsf.org> (http://www.justmoon.net)",
"version": "3.0.2",
"description": "Port of jQuery.extend for node.js and the browser",
"main": "index",
"scripts": {
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npm run coverage-quiet",
"tests-only": "node test",
"coverage": "covert test/index.js",
"coverage-quiet": "covert test/index.js --quiet",
"lint": "npm run jscs && npm run eslint",
"jscs": "jscs *.js */*.js",
"eslint": "eslint *.js */*.js"
},
"contributors": [
{
"name": "Jordan Harband",
"url": "https://github.com/ljharb"
}
],
"keywords": [
"extend",
"clone",
"merge"
],
"repository": {
"type": "git",
"url": "https://github.com/justmoon/node-extend.git"
},
"dependencies": {},
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0",
"eslint": "^4.19.1",
"jscs": "^3.0.7",
"tape": "^4.9.1"
},
"license": "MIT"
}

View File

@ -1,19 +1,7 @@
{
"browser": "./inherits_browser.js",
"bugs": {
"url": "https://github.com/isaacs/inherits/issues"
},
"bundleDependencies": false,
"deprecated": false,
"name": "inherits",
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
"devDependencies": {
"tap": "^14.2.4"
},
"files": [
"inherits.js",
"inherits_browser.js"
],
"homepage": "https://github.com/isaacs/inherits#readme",
"version": "2.0.4",
"keywords": [
"inheritance",
"class",
@ -24,15 +12,18 @@
"browser",
"browserify"
],
"license": "ISC",
"main": "./inherits.js",
"name": "inherits",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/inherits.git"
},
"browser": "./inherits_browser.js",
"repository": "git://github.com/isaacs/inherits",
"license": "ISC",
"scripts": {
"test": "tap"
},
"version": "2.0.4"
}
"devDependencies": {
"tap": "^14.2.4"
},
"files": [
"inherits.js",
"inherits_browser.js"
]
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-alphabetical",
"version": "1.0.4",
"description": "Check if a character is alphabetical",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"alphabetical"
],
"repository": "wooorm/is-alphabetical",
"bugs": "https://github.com/wooorm/is-alphabetical/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-alphabetical/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Check if a character is alphabetical",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,28 +34,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-alphabetical#readme",
"keywords": [
"string",
"character",
"char",
"code",
"alphabetical"
],
"license": "MIT",
"name": "is-alphabetical",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify -s isAlphabetical -o is-alphabetical.js",
"build-mangle": "browserify -s isAlphabetical -p tinyify -o is-alphabetical.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,25 +51,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-alphabetical.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify -s isAlphabetical -o is-alphabetical.js",
"build-mangle": "browserify -s isAlphabetical -p tinyify -o is-alphabetical.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
@ -87,5 +60,16 @@
"ignores": [
"is-alphabetical.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,26 +1,34 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-alphanumerical",
"version": "1.0.4",
"description": "Check if a character is alphanumerical",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"alphabetical",
"numerical",
"alphanumerical"
],
"repository": "wooorm/is-alphanumerical",
"bugs": "https://github.com/wooorm/is-alphanumerical/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-alphanumerical/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0"
},
"deprecated": false,
"description": "Check if a character is alphanumerical",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -31,30 +39,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-alphanumerical#readme",
"keywords": [
"string",
"character",
"char",
"code",
"alphabetical",
"numerical",
"alphanumerical"
],
"license": "MIT",
"name": "is-alphanumerical",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s isAlphanumerical -o is-alphanumerical.js",
"build-mangle": "browserify . -s isAlphanumerical -p tinyify -o is-alphanumerical.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -64,30 +56,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-alphanumerical.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s isAlphanumerical -o is-alphanumerical.js",
"build-mangle": "browserify . -s isAlphanumerical -p tinyify -o is-alphanumerical.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"is-alphanumerical.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,4 +1,7 @@
{
"name": "is-buffer",
"description": "Determine if an object is a Buffer",
"version": "1.1.6",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
@ -7,16 +10,12 @@
"bugs": {
"url": "https://github.com/feross/is-buffer/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Determine if an object is a Buffer",
"devDependencies": {
"standard": "*",
"tape": "^4.0.0",
"zuul": "^3.0.0"
},
"homepage": "https://github.com/feross/is-buffer#readme",
"keywords": [
"buffer",
"buffers",
@ -36,7 +35,6 @@
],
"license": "MIT",
"main": "index.js",
"name": "is-buffer",
"repository": {
"type": "git",
"url": "git://github.com/feross/is-buffer.git"
@ -49,6 +47,5 @@
},
"testling": {
"files": "test/*.js"
},
"version": "1.1.6"
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-decimal",
"version": "1.0.4",
"description": "Check if a character is decimal",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"decimal"
],
"repository": "wooorm/is-decimal",
"bugs": "https://github.com/wooorm/is-decimal/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-decimal/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Check if a character is decimal",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,28 +34,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-decimal#readme",
"keywords": [
"string",
"character",
"char",
"code",
"decimal"
],
"license": "MIT",
"name": "is-decimal",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s isDecimal -o is-decimal.js",
"build-mangle": "browserify . -s isDecimal -p tinyify -o is-decimal.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,30 +51,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-decimal.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s isDecimal -o is-decimal.js",
"build-mangle": "browserify . -s isDecimal -p tinyify -o is-decimal.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"is-decimal.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-hexadecimal",
"version": "1.0.4",
"description": "Check if a character is hexadecimal",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"hexadecimal"
],
"repository": "wooorm/is-hexadecimal",
"bugs": "https://github.com/wooorm/is-hexadecimal/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-hexadecimal/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Check if a character is hexadecimal",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,28 +34,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-hexadecimal#readme",
"keywords": [
"string",
"character",
"char",
"code",
"hexadecimal"
],
"license": "MIT",
"name": "is-hexadecimal",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s isHexadecimal -o is-hexadecimal.js",
"build-mangle": "browserify . -s isHexadecimal -p tinyify -o is-hexadecimal.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,30 +51,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-hexadecimal.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s isHexadecimal -o is-hexadecimal.js",
"build-mangle": "browserify . -s isHexadecimal -p tinyify -o is-hexadecimal.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"is-hexadecimal.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,25 +1,23 @@
{
"name": "is-plain-obj",
"version": "1.1.0",
"description": "Check if a value is a plain object",
"license": "MIT",
"repository": "sindresorhus/is-plain-obj",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/is-plain-obj/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Check if a value is a plain object",
"devDependencies": {
"ava": "0.0.4"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/is-plain-obj#readme",
"keywords": [
"obj",
"object",
@ -32,14 +30,7 @@
"pure",
"simple"
],
"license": "MIT",
"name": "is-plain-obj",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/is-plain-obj.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.1.0"
}
"devDependencies": {
"ava": "0.0.4"
}
}

View File

@ -1,23 +1,31 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-whitespace-character",
"version": "1.0.4",
"description": "Check if a character is a whitespace character",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"whitespace",
"white",
"space"
],
"repository": "wooorm/is-whitespace-character",
"bugs": "https://github.com/wooorm/is-whitespace-character/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-whitespace-character/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Check if a character is a whitespace character",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,30 +36,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-whitespace-character#readme",
"keywords": [
"string",
"character",
"char",
"code",
"whitespace",
"white",
"space"
],
"license": "MIT",
"name": "is-whitespace-character",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s isWhitespaceCharacter -o is-whitespace-character.js",
"build-mangle": "browserify . -s isWhitespaceCharacter -p tinyify -o is-whitespace-character.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -61,30 +53,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-whitespace-character.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s isWhitespaceCharacter -o is-whitespace-character.js",
"build-mangle": "browserify . -s isWhitespaceCharacter -p tinyify -o is-whitespace-character.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"is-whitespace-character.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "is-word-character",
"version": "1.0.4",
"description": "Check if a character is a word character",
"license": "MIT",
"keywords": [
"string",
"character",
"char",
"code",
"word"
],
"repository": "wooorm/is-word-character",
"bugs": "https://github.com/wooorm/is-word-character/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/is-word-character/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Check if a character is a word character",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,28 +34,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/is-word-character#readme",
"keywords": [
"string",
"character",
"char",
"code",
"word"
],
"license": "MIT",
"name": "is-word-character",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s isWordCharacter -o is-word-character.js",
"build-mangle": "browserify . -s isWordCharacter -p tinyify -o is-word-character.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,30 +51,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/is-word-character.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s isWordCharacter -o is-word-character.js",
"build-mangle": "browserify . -s isWordCharacter -p tinyify -o is-word-character.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"is-word-character.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "markdown-escapes",
"version": "1.0.4",
"description": "List of escapable characters in markdown",
"license": "MIT",
"keywords": [
"markdown",
"escape",
"pedantic",
"gfm",
"commonmark"
],
"repository": "wooorm/markdown-escapes",
"bugs": "https://github.com/wooorm/markdown-escapes/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/markdown-escapes/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "List of escapable characters in markdown",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
@ -28,28 +34,19 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s markdownEscapes -o markdown-escapes.js",
"build-mangle": "browserify . -s markdownEscapes -p tinyify -o markdown-escapes.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"homepage": "https://github.com/wooorm/markdown-escapes#readme",
"keywords": [
"markdown",
"escape",
"pedantic",
"gfm",
"commonmark"
],
"license": "MIT",
"name": "markdown-escapes",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"prettier": {
"tabWidth": 2,
@ -59,30 +56,17 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/markdown-escapes.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s markdownEscapes -o markdown-escapes.js",
"build-mangle": "browserify . -s markdownEscapes -p tinyify -o markdown-escapes.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"markdown-escapes.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
}
}
}

View File

@ -1,22 +1,32 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"name": "parse-entities",
"version": "1.2.2",
"description": "Parse HTML character references: fast, spec-compliant, positional information",
"license": "MIT",
"keywords": [
"parse",
"html",
"character",
"reference",
"entity",
"entities"
],
"repository": "wooorm/parse-entities",
"bugs": "https://github.com/wooorm/parse-entities/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"browser": {
"./decode-entity.js": "./decode-entity.browser.js"
},
"bugs": {
"url": "https://github.com/wooorm/parse-entities/issues"
"react-native": {
"./decode-entity.js": "./decode-entity.js"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"files": [
"index.js",
"decode-entity.js",
"decode-entity.browser.js"
],
"dependencies": {
"character-entities": "^1.0.0",
@ -26,8 +36,6 @@
"is-decimal": "^1.0.0",
"is-hexadecimal": "^1.0.0"
},
"deprecated": false,
"description": "Parse HTML character references: fast, spec-compliant, positional information",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
@ -39,22 +47,16 @@
"tinyify": "^2.4.3",
"xo": "^0.24.0"
},
"files": [
"index.js",
"decode-entity.js",
"decode-entity.browser.js"
],
"homepage": "https://github.com/wooorm/parse-entities#readme",
"keywords": [
"parse",
"html",
"character",
"reference",
"entity",
"entities"
],
"license": "MIT",
"name": "parse-entities",
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s parseEntities > parse-entities.js",
"build-mangle": "browserify . -s parseEntities -p tinyify > parse-entities.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test-browser": "browserify test.js | tape-run",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-browser"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -69,29 +71,6 @@
"semi": false,
"trailingComma": "none"
},
"react-native": {
"./decode-entity.js": "./decode-entity.js"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/parse-entities.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s parseEntities > parse-entities.js",
"build-mangle": "browserify . -s parseEntities -p tinyify > parse-entities.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-browser",
"test-api": "node test",
"test-browser": "browserify test.js | tape-run",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.2.2",
"xo": {
"prettier": true,
"esnext": false,
@ -103,5 +82,10 @@
"ignores": [
"parse-entities.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,27 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
"bugs": {
"url": "https://github.com/remarkjs/remark/issues"
},
"bundleDependencies": false,
"name": "remark-parse",
"version": "5.0.0",
"description": "Markdown parser for remark",
"license": "MIT",
"keywords": [
"markdown",
"abstract",
"syntax",
"tree",
"ast",
"parse"
],
"homepage": "http://remark.js.org",
"repository": "https://github.com/remarkjs/remark/tree/master/packages/remark-parse",
"bugs": "https://github.com/remarkjs/remark/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
{
"name": "Eugene Sharygin",
"email": "eush77@gmail.com"
}
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"Eugene Sharygin <eush77@gmail.com>"
],
"files": [
"index.js",
"lib"
],
"dependencies": {
"collapse-white-space": "^1.0.2",
@ -36,27 +40,5 @@
"vfile-location": "^2.0.0",
"xtend": "^4.0.1"
},
"deprecated": false,
"description": "Markdown parser for remark",
"files": [
"index.js",
"lib"
],
"homepage": "http://remark.js.org",
"keywords": [
"markdown",
"abstract",
"syntax",
"tree",
"ast",
"parse"
],
"license": "MIT",
"name": "remark-parse",
"repository": {
"type": "git",
"url": "https://github.com/remarkjs/remark/tree/master/packages/remark-parse"
},
"version": "5.0.0",
"xo": false
}
}

View File

@ -1,41 +1,31 @@
{
"author": {
"name": "Jon Schlinkert",
"url": "http://github.com/jonschlinkert"
},
"name": "repeat-string",
"description": "Repeat the given string n times. Fastest implementation for repeating a string.",
"version": "1.6.1",
"homepage": "https://github.com/jonschlinkert/repeat-string",
"author": "Jon Schlinkert (http://github.com/jonschlinkert)",
"contributors": [
"Brian Woodward <brian.woodward@gmail.com> (https://github.com/doowb)",
"Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)",
"Linus Unnebäck <linus@folkdatorn.se> (http://linus.unnebäck.se)",
"Thijs Busser <tbusser@gmail.com> (http://tbusser.net)",
"Titus <tituswormer@gmail.com> (wooorm.com)"
],
"repository": "jonschlinkert/repeat-string",
"bugs": {
"url": "https://github.com/jonschlinkert/repeat-string/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Brian Woodward",
"email": "brian.woodward@gmail.com",
"url": "https://github.com/doowb"
},
{
"name": "Jon Schlinkert",
"email": "jon.schlinkert@sellside.com",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Linus Unnebäck",
"email": "linus@folkdatorn.se",
"url": "http://linus.unnebäck.se"
},
{
"name": "Thijs Busser",
"email": "tbusser@gmail.com",
"url": "http://tbusser.net"
},
{
"name": "Titus",
"email": "tituswormer@gmail.com",
"url": "wooorm.com"
}
"license": "MIT",
"files": [
"index.js"
],
"deprecated": false,
"description": "Repeat the given string n times. Fastest implementation for repeating a string.",
"main": "index.js",
"engines": {
"node": ">=0.10"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"ansi-cyan": "^0.1.1",
"benchmarked": "^0.2.5",
@ -46,13 +36,6 @@
"text-table": "^0.2.0",
"yargs-parser": "^4.0.2"
},
"engines": {
"node": ">=0.10"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/repeat-string",
"keywords": [
"fast",
"fastest",
@ -70,16 +53,6 @@
"string",
"times"
],
"license": "MIT",
"main": "index.js",
"name": "repeat-string",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/repeat-string.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": false,
"layout": "default",
@ -100,6 +73,5 @@
"reflinks": [
"verb"
]
},
"version": "1.6.1"
}
}
}

View File

@ -1,26 +1,30 @@
{
"author": {
"name": "Gulp Team",
"email": "team@gulpjs.com",
"url": "http://gulpjs.com/"
},
"bugs": {
"url": "https://github.com/gulpjs/replace-ext/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Eric Schoffstall",
"email": "yo@contra.io"
},
{
"name": "Blaine Bublitz",
"email": "blaine.bublitz@gmail.com"
}
],
"dependencies": {},
"deprecated": false,
"name": "replace-ext",
"version": "1.0.0",
"description": "Replaces a file extension with another one",
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
"contributors": [
"Eric Schoffstall <yo@contra.io>",
"Blaine Bublitz <blaine.bublitz@gmail.com>"
],
"repository": "gulpjs/replace-ext",
"license": "MIT",
"engines": {
"node": ">= 0.10"
},
"main": "index.js",
"files": [
"LICENSE",
"index.js"
],
"scripts": {
"lint": "eslint . && jscs index.js test/",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {},
"devDependencies": {
"eslint": "^1.10.3",
"eslint-config-gulp": "^2.0.0",
@ -31,33 +35,10 @@
"jscs-preset-gulp": "^1.0.0",
"mocha": "^2.4.5"
},
"engines": {
"node": ">= 0.10"
},
"files": [
"LICENSE",
"index.js"
],
"homepage": "https://github.com/gulpjs/replace-ext#readme",
"keywords": [
"gulp",
"extensions",
"filepath",
"basename"
],
"license": "MIT",
"main": "index.js",
"name": "replace-ext",
"repository": {
"type": "git",
"url": "git+https://github.com/gulpjs/replace-ext.git"
},
"scripts": {
"cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls",
"lint": "eslint . && jscs index.js test/",
"pretest": "npm run lint",
"test": "mocha --async-only"
},
"version": "1.0.0"
}
]
}

View File

@ -1,23 +1,27 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "state-toggle",
"version": "1.0.3",
"description": "Enter/exit a state",
"license": "MIT",
"keywords": [
"enter",
"exit",
"state"
],
"repository": "wooorm/state-toggle",
"bugs": "https://github.com/wooorm/state-toggle/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/state-toggle/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Enter/exit a state",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,26 +32,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/state-toggle#readme",
"keywords": [
"enter",
"exit",
"state"
],
"license": "MIT",
"name": "state-toggle",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s stateToggle -o state-toggle.js",
"build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -57,30 +49,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/state-toggle.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s stateToggle -o state-toggle.js",
"build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.3",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"state-toggle.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "trim-trailing-lines",
"version": "1.1.4",
"description": "Remove final line feeds from a string",
"license": "MIT",
"keywords": [
"trim",
"final",
"line",
"newline",
"characters"
],
"repository": "wooorm/trim-trailing-lines",
"bugs": "https://github.com/wooorm/trim-trailing-lines/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/trim-trailing-lines/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Remove final line feeds from a string",
"devDependencies": {
"browserify": "^17.0.0",
"nyc": "^15.0.0",
@ -28,23 +34,15 @@
"tinyify": "^3.0.0",
"xo": "^0.34.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js",
"build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"homepage": "https://github.com/wooorm/trim-trailing-lines#readme",
"keywords": [
"trim",
"final",
"line",
"newline",
"characters"
],
"license": "MIT",
"name": "trim-trailing-lines",
"nyc": {
"check-coverage": true,
"lines": 100,
@ -59,30 +57,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/trim-trailing-lines.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js",
"build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.1.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"trim-trailing-lines.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,26 +1,18 @@
{
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"bundleDependencies": false,
"component": {
"scripts": {
"trim/index.js": "index.js"
}
},
"dependencies": {},
"deprecated": false,
"name": "trim",
"version": "0.0.1",
"description": "Trim string whitespace",
"keywords": ["string", "trim"],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"dependencies": {},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"keywords": [
"string",
"trim"
],
"main": "index",
"name": "trim",
"version": "0.0.1"
}
"component": {
"scripts": {
"trim/index.js": "index.js"
}
}
}

View File

@ -1,23 +1,27 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "trough",
"version": "1.0.5",
"description": "Middleware: a channel used to convey a liquid",
"license": "MIT",
"keywords": [
"middleware",
"ware"
],
"repository": "wooorm/trough",
"bugs": "https://github.com/wooorm/trough/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/trough/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js",
"wrap.js"
],
"dependencies": {},
"deprecated": false,
"description": "Middleware: a channel used to convey a liquid",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -28,26 +32,14 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js",
"wrap.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"homepage": "https://github.com/wooorm/trough#readme",
"keywords": [
"middleware",
"ware"
],
"license": "MIT",
"name": "trough",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.js -s trough > trough.js",
"build-mangle": "browserify index.js -s trough -p tinyify > trough.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -57,25 +49,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/trough.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js -s trough > trough.js",
"build-mangle": "browserify index.js -s trough -p tinyify > trough.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.5",
"xo": {
"prettier": true,
"esnext": false,
@ -87,5 +60,16 @@
"ignores": [
"trough.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
}
}
}

View File

@ -1,26 +1,31 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "unherit",
"version": "1.1.3",
"description": "Clone a constructor without affecting the super-class",
"license": "MIT",
"keywords": [
"clone",
"super",
"class",
"constructor"
],
"repository": "wooorm/unherit",
"bugs": "https://github.com/wooorm/unherit/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"bugs": {
"url": "https://github.com/wooorm/unherit/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {
"inherits": "^2.0.0",
"xtend": "^4.0.0"
},
"deprecated": false,
"description": "Clone a constructor without affecting the super-class",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
@ -31,22 +36,15 @@
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s unherit -o unherit.js",
"build-mangle": "browserify . -s unherit -p tinyify -o unherit.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"homepage": "https://github.com/wooorm/unherit#readme",
"keywords": [
"clone",
"super",
"class",
"constructor"
],
"license": "MIT",
"name": "unherit",
"prettier": {
"tabWidth": 2,
"useTabs": false,
@ -55,25 +53,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/wooorm/unherit.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s unherit -o unherit.js",
"build-mangle": "browserify . -s unherit -p tinyify -o unherit.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.1.3",
"xo": {
"prettier": true,
"esnext": false,
@ -84,5 +63,10 @@
"ignores": [
"unherit.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,45 +1,8 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
"bugs": {
"url": "https://github.com/unifiedjs/unified/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
}
],
"dependencies": {
"bail": "^1.0.0",
"extend": "^3.0.0",
"is-plain-obj": "^1.1.0",
"trough": "^1.0.0",
"vfile": "^2.0.0",
"x-is-string": "^0.1.0"
},
"deprecated": false,
"name": "unified",
"version": "6.2.0",
"description": "Pluggable text processing interface",
"devDependencies": {
"browserify": "^16.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"prettier": "^1.12.1",
"remark-cli": "^5.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.4.0",
"xo": "^0.20.0"
},
"files": [
"index.js",
"lib"
],
"homepage": "https://github.com/unifiedjs/unified#readme",
"license": "MIT",
"keywords": [
"process",
"parse",
@ -50,8 +13,43 @@
"retext",
"remark"
],
"license": "MIT",
"name": "unified",
"repository": "unifiedjs/unified",
"bugs": "https://github.com/unifiedjs/unified/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
],
"files": [
"index.js",
"lib"
],
"dependencies": {
"bail": "^1.0.0",
"extend": "^3.0.0",
"is-plain-obj": "^1.1.0",
"trough": "^1.0.0",
"vfile": "^2.0.0",
"x-is-string": "^0.1.0"
},
"devDependencies": {
"browserify": "^16.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"prettier": "^1.12.1",
"remark-cli": "^5.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.4.0",
"xo": "^0.20.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"build-bundle": "browserify index.js -s unified > unified.js",
"build-mangle": "esmangle unified.js > unified.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test",
"test": "npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -66,25 +64,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/unifiedjs/unified.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js -s unified > unified.js",
"build-mangle": "esmangle unified.js > unified.min.js",
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test"
},
"version": "6.2.0",
"xo": {
"prettier": true,
"esnext": false,
@ -98,5 +77,10 @@
"ignores": [
"unified.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,38 +1,8 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-is/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
],
"dependencies": {},
"deprecated": false,
"name": "unist-util-is",
"version": "3.0.0",
"description": "Utility to check if a node passes a test",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"files": [
"index.js",
"convert.js"
],
"homepage": "https://github.com/syntax-tree/unist-util-is#readme",
"license": "MIT",
"keywords": [
"unist",
"node",
@ -43,13 +13,35 @@
"util",
"utility"
],
"license": "MIT",
"name": "unist-util-is",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"repository": "syntax-tree/unist-util-is",
"bugs": "https://github.com/syntax-tree/unist-util-is/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js",
"convert.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s unistUtilIs > unist-util-is.js",
"build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -59,25 +51,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-is.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s unistUtilIs > unist-util-is.js",
"build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "3.0.0",
"xo": {
"prettier": true,
"esnext": false,
@ -87,5 +60,16 @@
"ignore": [
"unist-util-is.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,25 +1,31 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "unist-util-remove-position",
"version": "1.1.4",
"description": "Remove `position`s from a unist tree",
"license": "MIT",
"keywords": [
"unist",
"utility",
"remove",
"position",
"location"
],
"repository": "syntax-tree/unist-util-remove-position",
"bugs": "https://github.com/syntax-tree/unist-util-remove-position/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-remove-position/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {
"unist-util-visit": "^1.1.0"
},
"deprecated": false,
"description": "Remove `position`s from a unist tree",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
@ -32,28 +38,14 @@
"unist-builder": "^2.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"homepage": "https://github.com/syntax-tree/unist-util-remove-position#readme",
"keywords": [
"unist",
"utility",
"remove",
"position",
"location"
],
"license": "MIT",
"name": "unist-util-remove-position",
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s unistUtilRemovePosition > unist-util-remove-position.js",
"build-mangle": "browserify . -s unistUtilRemovePosition -p tinyify > unist-util-remove-position.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
@ -63,30 +55,22 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-remove-position.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s unistUtilRemovePosition > unist-util-remove-position.js",
"build-mangle": "browserify . -s unistUtilRemovePosition -p tinyify > unist-util-remove-position.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.1.4",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"unist-util-remove-position.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,37 +1,8 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-stringify-position/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
}
],
"dependencies": {},
"deprecated": false,
"name": "unist-util-stringify-position",
"version": "1.1.2",
"description": "Stringify a Unist node, position, or point",
"devDependencies": {
"browserify": "^16.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"prettier": "^1.12.1",
"remark-cli": "^5.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.5.1",
"xo": "^0.20.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/syntax-tree/unist-util-stringify-position#readme",
"license": "MIT",
"keywords": [
"unist",
"position",
@ -43,8 +14,35 @@
"util",
"utility"
],
"license": "MIT",
"name": "unist-util-stringify-position",
"repository": "syntax-tree/unist-util-stringify-position",
"bugs": "https://github.com/syntax-tree/unist-util-stringify-position/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^16.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"prettier": "^1.12.1",
"remark-cli": "^5.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.5.1",
"xo": "^0.20.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"build-bundle": "browserify index.js --no-builtins -s unistUtilStringifyPosition > unist-util-stringify-position.js",
"build-mangle": "esmangle unist-util-stringify-position.js > unist-util-stringify-position.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -59,25 +57,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-stringify-position.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --no-builtins -s unistUtilStringifyPosition > unist-util-stringify-position.js",
"build-mangle": "esmangle unist-util-stringify-position.js > unist-util-stringify-position.min.js",
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.1.2",
"xo": {
"prettier": true,
"esnext": false,
@ -89,5 +68,10 @@
"ignores": [
"unist-util-stringify-position.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,25 +1,26 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-visit-parents/issues"
},
"bundleDependencies": false,
"name": "unist-util-visit-parents",
"version": "2.1.2",
"description": "Recursively walk over unist nodes, with ancestral information",
"license": "MIT",
"keywords": [
"unist",
"walk",
"util",
"utility"
],
"repository": "syntax-tree/unist-util-visit-parents",
"bugs": "https://github.com/syntax-tree/unist-util-visit-parents/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {
"unist-util-is": "^3.0.0"
},
"deprecated": false,
"description": "Recursively walk over unist nodes, with ancestral information",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
@ -31,18 +32,15 @@
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme",
"keywords": [
"unist",
"walk",
"util",
"utility"
],
"license": "MIT",
"name": "unist-util-visit-parents",
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js",
"build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -57,30 +55,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js",
"build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "2.1.2",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"unist-util-visit-parents.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,48 +1,8 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/unist-util-visit/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
{
"name": "Eugene Sharygin",
"email": "eush77@gmail.com"
},
{
"name": "Richard Gibson",
"email": "richard.gibson@gmail.com"
}
],
"dependencies": {
"unist-util-visit-parents": "^2.0.0"
},
"deprecated": false,
"name": "unist-util-visit",
"version": "1.4.1",
"description": "Recursively walk over unist nodes",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark": "^10.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/syntax-tree/unist-util-visit#readme",
"license": "MIT",
"keywords": [
"unist",
"remark",
@ -56,8 +16,40 @@
"util",
"utility"
],
"license": "MIT",
"name": "unist-util-visit",
"repository": "syntax-tree/unist-util-visit",
"bugs": "https://github.com/syntax-tree/unist-util-visit/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"Eugene Sharygin <eush77@gmail.com>",
"Richard Gibson <richard.gibson@gmail.com>"
],
"files": [
"index.js"
],
"dependencies": {
"unist-util-visit-parents": "^2.0.0"
},
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark": "^10.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js",
"build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -72,30 +64,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/syntax-tree/unist-util-visit.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js",
"build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.4.1",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"unist-util-visit.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,23 +1,29 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
"name": "vfile-location",
"version": "2.0.6",
"description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file",
"license": "MIT",
"keywords": [
"remark",
"comment",
"message",
"marker",
"control"
],
"repository": "vfile/vfile-location",
"bugs": "https://github.com/vfile/vfile-location/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"bugs": {
"url": "https://github.com/vfile/vfile-location/issues"
},
"bundleDependencies": false,
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"deprecated": false,
"description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
@ -29,23 +35,15 @@
"vfile": "^4.0.0",
"xo": "^0.25.0"
},
"files": [
"index.js"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s vfileLocation > vfile-location.js",
"build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"homepage": "https://github.com/vfile/vfile-location#readme",
"keywords": [
"remark",
"comment",
"message",
"marker",
"control"
],
"license": "MIT",
"name": "vfile-location",
"nyc": {
"check-coverage": true,
"lines": 100,
@ -60,30 +58,16 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vfile/vfile-location.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s vfileLocation > vfile-location.js",
"build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "2.0.6",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"vfile-location.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,25 +1,25 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/vfile/vfile-message/issues"
},
"bundleDependencies": false,
"name": "vfile-message",
"version": "1.1.1",
"description": "Create a virtual message",
"license": "MIT",
"keywords": [
"vfile",
"virtual",
"message"
],
"repository": "vfile/vfile-message",
"bugs": "https://github.com/vfile/vfile-message/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {
"unist-util-stringify-position": "^1.1.1"
},
"deprecated": false,
"description": "Create a virtual message",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^13.0.0",
@ -30,17 +30,15 @@
"tinyify": "^2.4.3",
"xo": "^0.23.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/vfile/vfile-message#readme",
"keywords": [
"vfile",
"virtual",
"message"
],
"license": "MIT",
"name": "vfile-message",
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"build-bundle": "browserify . -s vfileMessage > vfile-message.js",
"build-mangle": "browserify . -s vfileMessage -p tinyify > vfile-message.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
@ -55,25 +53,6 @@
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vfile/vfile-message.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s vfileMessage > vfile-message.js",
"build-mangle": "browserify . -s vfileMessage -p tinyify > vfile-message.min.js",
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.1.1",
"xo": {
"prettier": true,
"esnext": false,
@ -85,5 +64,10 @@
"ignores": [
"vfile-message.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,62 +1,8 @@
{
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
"bugs": {
"url": "https://github.com/vfile/vfile/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "http://wooorm.com"
},
{
"name": "Brendan Abbott",
"email": "brendan.abbott@temando.com"
},
{
"name": "Denys Dovhan",
"email": "email@denysdovhan.com"
},
{
"name": "Kyle Mathews",
"email": "mathews.kyle@gmail.com"
},
{
"name": "Shinnosuke Watanabe",
"email": "snnskwtnb@gmail.com"
},
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com"
}
],
"dependencies": {
"is-buffer": "^1.1.4",
"replace-ext": "1.0.0",
"unist-util-stringify-position": "^1.0.0",
"vfile-message": "^1.0.0"
},
"deprecated": false,
"name": "vfile",
"version": "2.3.0",
"description": "Virtual file format for text processing",
"devDependencies": {
"browserify": "^14.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"remark-cli": "^4.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.4.0",
"xo": "^0.18.0"
},
"files": [
"core.js",
"index.js"
],
"homepage": "https://github.com/vfile/vfile#readme",
"license": "MIT",
"keywords": [
"virtual",
"file",
@ -68,34 +14,52 @@
"remark",
"retext"
],
"license": "MIT",
"name": "vfile",
"repository": "vfile/vfile",
"bugs": "https://github.com/vfile/vfile/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"Brendan Abbott <brendan.abbott@temando.com>",
"Denys Dovhan <email@denysdovhan.com>",
"Kyle Mathews <mathews.kyle@gmail.com>",
"Shinnosuke Watanabe <snnskwtnb@gmail.com>",
"Sindre Sorhus <sindresorhus@gmail.com>"
],
"files": [
"core.js",
"index.js"
],
"dependencies": {
"is-buffer": "^1.1.4",
"replace-ext": "1.0.0",
"unist-util-stringify-position": "^1.0.0",
"vfile-message": "^1.0.0"
},
"devDependencies": {
"browserify": "^14.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"remark-cli": "^4.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.4.0",
"xo": "^0.18.0"
},
"scripts": {
"build-md": "remark . -qfo",
"build-bundle": "browserify index.js -s VFile > vfile.js",
"build-mangle": "esmangle vfile.js > vfile.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run build && npm run lint && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vfile/vfile.git"
},
"scripts": {
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js -s VFile > vfile.js",
"build-mangle": "esmangle vfile.js > vfile.min.js",
"build-md": "remark . -qfo",
"lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "2.3.0",
"xo": {
"space": true,
"esnext": false,
@ -105,5 +69,10 @@
"ignores": [
"vfile.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
}

View File

@ -1,47 +1,40 @@
{
"author": {
"name": "Matt-Esch",
"email": "matt@mattesch.info"
},
"bugs": {
"url": "https://github.com/Matt-Esch/x-is-string/issues",
"email": "matt@mattesch.info"
},
"bundleDependencies": false,
"name": "x-is-string",
"version": "0.1.0",
"description": "Simple string test",
"keywords": [],
"author": "Matt-Esch <matt@mattesch.info>",
"repository": "git://github.com/Matt-Esch/x-is-string.git",
"main": "index",
"homepage": "https://github.com/Matt-Esch/x-is-string",
"contributors": [
{
"name": "Matt-Esch"
}
],
"bugs": {
"url": "https://github.com/Matt-Esch/x-is-string/issues",
"email": "matt@mattesch.info"
},
"dependencies": {},
"deprecated": false,
"description": "Simple string test",
"devDependencies": {
"tape": "^2.12.2"
},
"homepage": "https://github.com/Matt-Esch/x-is-string",
"keywords": [],
"licenses": [
{
"type": "MIT",
"url": "http://github.com/Matt-Esch/x-is-string/raw/master/LICENSE"
}
],
"main": "index",
"name": "x-is-string",
"repository": {
"type": "git",
"url": "git://github.com/Matt-Esch/x-is-string.git"
},
"scripts": {
"cover": "istanbul cover --report none --print detail ./test/index.js",
"start": "node ./index.js",
"test": "node ./test/index.js",
"test-browser": "testem-browser ./test/browser/index.js",
"testem": "testem-both -b=./test/browser/index.js",
"start": "node ./index.js",
"watch": "nodemon -w ./index.js index.js",
"travis-test": "istanbul cover ./test/index.js && ((cat coverage/lcov.info | coveralls) || exit 0)",
"cover": "istanbul cover --report none --print detail ./test/index.js",
"view-cover": "istanbul report html && google-chrome ./coverage/index.html",
"watch": "nodemon -w ./index.js index.js"
"test-browser": "testem-browser ./test/browser/index.js",
"testem": "testem-both -b=./test/browser/index.js"
},
"testling": {
"files": "test/index.js",
@ -58,6 +51,5 @@
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "0.1.0"
}
}
}

View File

@ -1,31 +1,7 @@
{
"author": {
"name": "Raynos",
"email": "raynos2@gmail.com"
},
"bugs": {
"url": "https://github.com/Raynos/xtend/issues",
"email": "raynos2@gmail.com"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jake Verbaten"
},
{
"name": "Matt Esch"
}
],
"dependencies": {},
"deprecated": false,
"name": "xtend",
"version": "4.0.2",
"description": "extend like a boss",
"devDependencies": {
"tape": "~1.1.0"
},
"engines": {
"node": ">=0.4"
},
"homepage": "https://github.com/Raynos/xtend",
"keywords": [
"extend",
"merge",
@ -34,16 +10,30 @@
"object",
"array"
],
"license": "MIT",
"author": "Raynos <raynos2@gmail.com>",
"repository": "git://github.com/Raynos/xtend.git",
"main": "immutable",
"name": "xtend",
"repository": {
"type": "git",
"url": "git://github.com/Raynos/xtend.git"
},
"scripts": {
"test": "node test"
},
"dependencies": {},
"devDependencies": {
"tape": "~1.1.0"
},
"homepage": "https://github.com/Raynos/xtend",
"contributors": [
{
"name": "Jake Verbaten"
},
{
"name": "Matt Esch"
}
],
"bugs": {
"url": "https://github.com/Raynos/xtend/issues",
"email": "raynos2@gmail.com"
},
"license": "MIT",
"testling": {
"files": "test.js",
"browsers": [
@ -59,5 +49,7 @@
"iphone/6.0..latest"
]
},
"version": "4.0.2"
}
"engines": {
"node": ">=0.4"
}
}

View File

@ -1,18 +1,41 @@
{
"name": "eslint-plugin-markdown",
"version": "2.0.0",
"description": "An ESLint plugin to lint JavaScript in Markdown code fences.",
"license": "MIT",
"author": {
"name": "Brandon Mills",
"url": "https://github.com/btmills"
},
"repository": "eslint/eslint-plugin-markdown",
"bugs": {
"url": "https://github.com/eslint/eslint-plugin-markdown/issues"
},
"bundleDependencies": false,
"dependencies": {
"remark-parse": "^5.0.0",
"unified": "^6.1.2"
"homepage": "https://github.com/eslint/eslint-plugin-markdown#readme",
"keywords": [
"eslint",
"eslintplugin",
"markdown",
"lint",
"linter"
],
"scripts": {
"lint": "eslint --ext js,md .",
"prepare": "node ./npm-prepare.js",
"test": "npm run lint && npm run test-cov",
"test-cov": "nyc _mocha -- -c tests/{examples,lib}/**/*.js",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"publish-release": "eslint-publish-release"
},
"deprecated": false,
"description": "An ESLint plugin to lint JavaScript in Markdown code fences.",
"main": "index.js",
"files": [
"index.js",
"lib/index.js",
"lib/processor.js"
],
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^6.8.0",
@ -23,42 +46,14 @@
"mocha": "^6.2.2",
"nyc": "^14.1.1"
},
"engines": {
"node": "^8.10.0 || ^10.12.0 || >= 12.0.0"
"dependencies": {
"remark-parse": "^5.0.0",
"unified": "^6.1.2"
},
"files": [
"index.js",
"lib/index.js",
"lib/processor.js"
],
"homepage": "https://github.com/eslint/eslint-plugin-markdown#readme",
"keywords": [
"eslint",
"eslintplugin",
"markdown",
"lint",
"linter"
],
"license": "MIT",
"main": "index.js",
"name": "eslint-plugin-markdown",
"peerDependencies": {
"eslint": ">=6.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/eslint-plugin-markdown.git"
},
"scripts": {
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"generate-release": "eslint-generate-release",
"lint": "eslint --ext js,md .",
"prepare": "node ./npm-prepare.js",
"publish-release": "eslint-publish-release",
"test": "npm run lint && npm run test-cov",
"test-cov": "nyc _mocha -- -c tests/{examples,lib}/**/*.js"
},
"version": "2.0.0"
}
"engines": {
"node": "^8.10.0 || ^10.12.0 || >= 12.0.0"
}
}

View File

@ -281,7 +281,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
<!--sponsorsstart-->
<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a> <a href="https://aka.ms/microsoftfossfund"><img src="https://avatars.githubusercontent.com/u/67931232?u=7fddc652a464d7151b97e8f108392af7d54fa3e8&v=4" alt="Microsoft FOSS Fund Sponsorships" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://opensource.microsoft.com"><img src="https://avatars.githubusercontent.com/u/6154722?v=4" alt="Microsoft" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://retool.com/"><img src="https://images.opencollective.com/retool/98ea68e/logo.png" alt="Retool" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p>
<!--sponsorsend-->

13
tools/node_modules/eslint/lib/cli.js generated vendored
View File

@ -32,6 +32,7 @@ const debug = require("debug")("eslint:cli");
/** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */
/** @typedef {import("./eslint/eslint").LintMessage} LintMessage */
/** @typedef {import("./eslint/eslint").LintResult} LintResult */
/** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */
//------------------------------------------------------------------------------
// Helpers
@ -54,7 +55,7 @@ function quietFixPredicate(message) {
/**
* Translates the CLI options into the options expected by the CLIEngine.
* @param {Object} cliOptions The CLI options to translate.
* @param {ParsedCLIOptions} cliOptions The CLI options to translate.
* @returns {ESLintOptions} The options object for the CLIEngine.
* @private
*/
@ -221,6 +222,8 @@ const cli = {
if (Array.isArray(args)) {
debug("CLI args: %o", args.slice(2));
}
/** @type {ParsedCLIOptions} */
let options;
try {
@ -301,12 +304,16 @@ const cli = {
await ESLint.outputFixes(results);
}
let resultsToPrint = results;
if (options.quiet) {
debug("Quiet mode enabled - filtering out warnings");
results = ESLint.getErrorResults(results);
resultsToPrint = ESLint.getErrorResults(resultsToPrint);
}
if (await printResults(engine, results, options.format, options.outputFile)) {
if (await printResults(engine, resultsToPrint, options.format, options.outputFile)) {
// Errors and warnings from the original unfiltered results should determine the exit code
const { errorCount, warningCount } = countErrors(results);
const tooManyWarnings =
options.maxWarnings >= 0 && warningCount > options.maxWarnings;

View File

@ -11,6 +11,53 @@
const optionator = require("optionator");
//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
/**
* The options object parsed by Optionator.
* @typedef {Object} ParsedCLIOptions
* @property {boolean} cache Only check changed files
* @property {string} cacheFile Path to the cache file. Deprecated: use --cache-location
* @property {string} [cacheLocation] Path to the cache file or directory
* @property {"metadata" | "content"} cacheStrategy Strategy to use for detecting changed files in the cache
* @property {boolean} [color] Force enabling/disabling of color
* @property {string} [config] Use this configuration, overriding .eslintrc.* config options if present
* @property {boolean} debug Output debugging information
* @property {string[]} [env] Specify environments
* @property {boolean} envInfo Output execution environment information
* @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched
* @property {boolean} eslintrc Disable use of configuration from .eslintrc.*
* @property {string[]} [ext] Specify JavaScript file extensions
* @property {boolean} fix Automatically fix problems
* @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system
* @property {("problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (problem, suggestion, layout)
* @property {string} format Use a specific output format
* @property {string[]} [global] Define global variables
* @property {boolean} [help] Show help
* @property {boolean} ignore Disable use of ignore files and patterns
* @property {string} [ignorePath] Specify path of ignore file
* @property {string[]} [ignorePattern] Pattern of files to ignore (in addition to those in .eslintignore)
* @property {boolean} init Run config initialization wizard
* @property {boolean} inlineConfig Prevent comments from changing config or rules
* @property {number} maxWarnings Number of warnings to trigger nonzero exit code
* @property {string} [outputFile] Specify file to write report to
* @property {string} [parser] Specify the parser to be used
* @property {Object} [parserOptions] Specify parser options
* @property {string[]} [plugin] Specify plugins
* @property {string} [printConfig] Print the configuration for the given file
* @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable directives
* @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default
* @property {Object} [rule] Specify rules
* @property {string[]} [rulesdir] Use additional rules from this directory
* @property {boolean} stdin Lint code provided on <STDIN>
* @property {string} [stdinFilename] Specify filename to process STDIN as
* @property {boolean} quiet Report errors only
* @property {boolean} [version] Output the version number
* @property {string[]} _ Positional filenames or patterns
*/
//------------------------------------------------------------------------------
// Initialization and Public Interface
//------------------------------------------------------------------------------

View File

@ -161,17 +161,6 @@ module.exports = {
);
}
/**
* Checks whether the operator of a given node is mixed with a
* conditional expression.
* @param {ASTNode} node A node to check. This is a conditional
* expression node
* @returns {boolean} `true` if the node was mixed.
*/
function isMixedWithConditionalParent(node) {
return !astUtils.isParenthesised(sourceCode, node) && !astUtils.isParenthesised(sourceCode, node.test);
}
/**
* Gets the operator token of a given node.
* @param {ASTNode} node A node to check. This is a BinaryExpression
@ -220,19 +209,13 @@ module.exports = {
* @returns {void}
*/
function check(node) {
if (TARGET_NODE_TYPE.test(node.parent.type)) {
if (node.parent.type === "ConditionalExpression" && !shouldIgnore(node) && isMixedWithConditionalParent(node.parent)) {
reportBothOperators(node);
} else {
if (TARGET_NODE_TYPE.test(node.parent.type) &&
isMixedWithParent(node) &&
!shouldIgnore(node)
) {
reportBothOperators(node);
}
}
if (
TARGET_NODE_TYPE.test(node.parent.type) &&
isMixedWithParent(node) &&
!shouldIgnore(node)
) {
reportBothOperators(node);
}
}
return {

View File

@ -11,6 +11,14 @@
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const DEFAULT_OPTIONS = {
allowInParentheses: true
};
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@ -26,7 +34,15 @@ module.exports = {
url: "https://eslint.org/docs/rules/no-sequences"
},
schema: [],
schema: [{
properties: {
allowInParentheses: {
type: "boolean",
default: true
}
},
additionalProperties: false
}],
messages: {
unexpectedCommaExpression: "Unexpected use of comma operator."
@ -34,6 +50,7 @@ module.exports = {
},
create(context) {
const options = Object.assign({}, DEFAULT_OPTIONS, context.options[0]);
const sourceCode = context.getSourceCode();
/**
@ -99,13 +116,15 @@ module.exports = {
}
// Wrapping a sequence in extra parens indicates intent
if (requiresExtraParens(node)) {
if (isParenthesisedTwice(node)) {
return;
}
} else {
if (isParenthesised(node)) {
return;
if (options.allowInParentheses) {
if (requiresExtraParens(node)) {
if (isParenthesisedTwice(node)) {
return;
}
} else {
if (isParenthesised(node)) {
return;
}
}
}

View File

@ -134,7 +134,7 @@ module.exports = {
type: "layout",
docs: {
description: "enforce consistent line breaks inside braces",
description: "enforce consistent line breaks after opening and before closing braces",
category: "Stylistic Issues",
recommended: false,
url: "https://eslint.org/docs/rules/object-curly-newline"

View File

@ -11,6 +11,7 @@
const path = require("path");
const spawn = require("cross-spawn");
const os = require("os");
const log = require("../shared/logging");
const packageJson = require("../../package.json");
@ -140,7 +141,8 @@ function environment() {
`Node version: ${getBinVersion("node")}`,
`npm version: ${getBinVersion("npm")}`,
`Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`,
`Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`
`Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`,
`Operating System: ${os.platform()} ${os.release()}`
].join("\n");
}

View File

@ -1,33 +1,25 @@
{
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/highlight": "^7.10.4"
},
"deprecated": false,
"name": "@babel/code-frame",
"version": "7.12.11",
"description": "Generate errors that contain a code frame that point to source locations.",
"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/code-frame",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-code-frame"
},
"version": "7.12.11"
"main": "lib/index.js",
"dependencies": {
"@babel/highlight": "^7.10.4"
},
"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
}
}

View File

@ -1,26 +1,20 @@
{
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Validate identifier/keywords name",
"devDependencies": {
"charcodes": "^0.2.0",
"unicode-13.0.0": "^0.8.0"
},
"exports": "./lib/index.js",
"homepage": "https://github.com/babel/babel#readme",
"license": "MIT",
"main": "./lib/index.js",
"name": "@babel/helper-validator-identifier",
"version": "7.12.11",
"description": "Validate identifier/keywords name",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-validator-identifier"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-helper-validator-identifier"
},
"version": "7.12.11"
"main": "./lib/index.js",
"exports": "./lib/index.js",
"devDependencies": {
"charcodes": "^0.2.0",
"unicode-13.0.0": "^0.8.0"
}
}

View File

@ -0,0 +1,165 @@
'use strict';
const colorConvert = require('color-convert');
const wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert, arguments);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
// Bright color
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Fix humans
styles.color.grey = styles.color.gray;
for (const groupName of Object.keys(styles)) {
const group = styles[groupName];
for (const styleName of Object.keys(group)) {
const style = group[styleName];
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
}
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
for (let key of Object.keys(colorConvert)) {
if (typeof colorConvert[key] !== 'object') {
continue;
}
const suite = colorConvert[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
}
if ('ansi256' in suite) {
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
}
if ('rgb' in suite) {
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
}
}
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

View File

@ -0,0 +1,56 @@
{
"name": "ansi-styles",
"version": "3.2.1",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava",
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
},
"files": [
"index.js"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"color-convert": "^1.9.0"
},
"devDependencies": {
"ava": "*",
"babel-polyfill": "^6.23.0",
"svg-term-cli": "^2.1.1",
"xo": "*"
},
"ava": {
"require": "babel-polyfill"
}
}

View File

@ -1,10 +1,11 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
<img src="screenshot.svg" width="900">
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
## Install
@ -12,6 +13,7 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) modul
$ npm install ansi-styles
```
## Usage
```js
@ -27,13 +29,14 @@ console.log(`${style.green.open}Hello world!${style.green.close}`);
// original color.
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
@ -57,7 +60,7 @@ Each style has an `open` and `close` property.
- `magenta`
- `cyan`
- `white`
- `blackBright` (alias: `gray`, `grey`)
- `gray` ("bright black")
- `redBright`
- `greenBright`
- `yellowBright`
@ -76,7 +79,7 @@ Each style has an `open` and `close` property.
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgBlackBright`
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
@ -85,6 +88,7 @@ Each style has an `open` and `close` property.
- `bgCyanBright`
- `bgWhiteBright`
## Advanced usage
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
@ -108,21 +112,11 @@ console.log(style.codes.get(36));
//=> 39
```
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
The following color spaces from `color-convert` are supported:
- `rgb`
- `hex`
- `keyword`
- `hsl`
- `hsv`
- `hwb`
- `ansi`
- `ansi256`
To use these, call the associated conversion function with the intended output, for example:
```js
@ -136,17 +130,18 @@ style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
```
## Related
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## For enterprise
Available as part of the Tidelift Subscription.
## License
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
MIT

View File

@ -1,80 +1,71 @@
{
"bugs": {
"url": "https://github.com/chalk/chalk/issues"
},
"bundleDependencies": false,
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"deprecated": false,
"description": "Terminal string styling done right",
"devDependencies": {
"ava": "*",
"coveralls": "^3.0.0",
"execa": "^0.9.0",
"flow-bin": "^0.68.0",
"import-fresh": "^2.0.0",
"matcha": "^0.7.0",
"nyc": "^11.0.2",
"resolve-from": "^4.0.0",
"typescript": "^2.5.3",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js",
"templates.js",
"types/index.d.ts",
"index.js.flow"
],
"homepage": "https://github.com/chalk/chalk#readme",
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"str",
"ansi",
"style",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"name": "chalk",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/chalk.git"
},
"scripts": {
"bench": "matcha benchmark.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava"
},
"types": "types/index.d.ts",
"version": "2.4.2",
"xo": {
"envs": [
"node",
"mocha"
],
"ignores": [
"test/_flow.js"
]
}
}
"name": "chalk",
"version": "2.4.2",
"description": "Terminal string styling done right",
"license": "MIT",
"repository": "chalk/chalk",
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
"bench": "matcha benchmark.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
},
"files": [
"index.js",
"templates.js",
"types/index.d.ts",
"index.js.flow"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"str",
"ansi",
"style",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"devDependencies": {
"ava": "*",
"coveralls": "^3.0.0",
"execa": "^0.9.0",
"flow-bin": "^0.68.0",
"import-fresh": "^2.0.0",
"matcha": "^0.7.0",
"nyc": "^11.0.2",
"resolve-from": "^4.0.0",
"typescript": "^2.5.3",
"xo": "*"
},
"types": "types/index.d.ts",
"xo": {
"envs": [
"node",
"mocha"
],
"ignores": [
"test/_flow.js"
]
}
}

View File

@ -1,17 +1,18 @@
/* MIT license */
/* eslint-disable no-mixed-operators */
const cssKeywords = require('color-name');
var cssKeywords = require('color-name');
// NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
const reverseKeywords = {};
for (const key of Object.keys(cssKeywords)) {
reverseKeywords[cssKeywords[key]] = key;
var reverseKeywords = {};
for (var key in cssKeywords) {
if (cssKeywords.hasOwnProperty(key)) {
reverseKeywords[cssKeywords[key]] = key;
}
}
const convert = {
var convert = module.exports = {
rgb: {channels: 3, labels: 'rgb'},
hsl: {channels: 3, labels: 'hsl'},
hsv: {channels: 3, labels: 'hsv'},
@ -29,38 +30,40 @@ const convert = {
gray: {channels: 1, labels: ['gray']}
};
module.exports = convert;
// hide .channels and .labels properties
for (var model in convert) {
if (convert.hasOwnProperty(model)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
}
// Hide .channels and .labels properties
for (const model of Object.keys(convert)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
var channels = convert[model].channels;
var labels = convert[model].labels;
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {value: channels});
Object.defineProperty(convert[model], 'labels', {value: labels});
}
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
const {channels, labels} = convert[model];
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {value: channels});
Object.defineProperty(convert[model], 'labels', {value: labels});
}
convert.rgb.hsl = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
let h;
let s;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
var h;
var s;
var l;
if (max === min) {
h = 0;
@ -78,7 +81,7 @@ convert.rgb.hsl = function (rgb) {
h += 360;
}
const l = (min + max) / 2;
l = (min + max) / 2;
if (max === min) {
s = 0;
@ -92,24 +95,23 @@ convert.rgb.hsl = function (rgb) {
};
convert.rgb.hsv = function (rgb) {
let rdif;
let gdif;
let bdif;
let h;
let s;
var rdif;
var gdif;
var bdif;
var h;
var s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const v = Math.max(r, g, b);
const diff = v - Math.min(r, g, b);
const diffc = function (c) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var v = Math.max(r, g, b);
var diff = v - Math.min(r, g, b);
var diffc = function (c) {
return (v - c) / 6 / diff + 1 / 2;
};
if (diff === 0) {
h = 0;
s = 0;
h = s = 0;
} else {
s = diff / v;
rdif = diffc(r);
@ -123,7 +125,6 @@ convert.rgb.hsv = function (rgb) {
} else if (b === v) {
h = (2 / 3) + gdif - rdif;
}
if (h < 0) {
h += 1;
} else if (h > 1) {
@ -139,11 +140,11 @@ convert.rgb.hsv = function (rgb) {
};
convert.rgb.hwb = function (rgb) {
const r = rgb[0];
const g = rgb[1];
let b = rgb[2];
const h = convert.rgb.hsl(rgb)[0];
const w = 1 / 255 * Math.min(r, Math.min(g, b));
var r = rgb[0];
var g = rgb[1];
var b = rgb[2];
var h = convert.rgb.hsl(rgb)[0];
var w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
@ -151,48 +152,54 @@ convert.rgb.hwb = function (rgb) {
};
convert.rgb.cmyk = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var c;
var m;
var y;
var k;
const k = Math.min(1 - r, 1 - g, 1 - b);
const c = (1 - r - k) / (1 - k) || 0;
const m = (1 - g - k) / (1 - k) || 0;
const y = (1 - b - k) / (1 - k) || 0;
k = Math.min(1 - r, 1 - g, 1 - b);
c = (1 - r - k) / (1 - k) || 0;
m = (1 - g - k) / (1 - k) || 0;
y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};
/**
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
* */
function comparativeDistance(x, y) {
/*
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
*/
return (
((x[0] - y[0]) ** 2) +
((x[1] - y[1]) ** 2) +
((x[2] - y[2]) ** 2)
Math.pow(x[0] - y[0], 2) +
Math.pow(x[1] - y[1], 2) +
Math.pow(x[2] - y[2], 2)
);
}
convert.rgb.keyword = function (rgb) {
const reversed = reverseKeywords[rgb];
var reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
let currentClosestDistance = Infinity;
let currentClosestKeyword;
var currentClosestDistance = Infinity;
var currentClosestKeyword;
for (const keyword of Object.keys(cssKeywords)) {
const value = cssKeywords[keyword];
for (var keyword in cssKeywords) {
if (cssKeywords.hasOwnProperty(keyword)) {
var value = cssKeywords[keyword];
// Compute comparative distance
const distance = comparativeDistance(rgb, value);
// Compute comparative distance
var distance = comparativeDistance(rgb, value);
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
}
@ -204,50 +211,55 @@ convert.keyword.rgb = function (keyword) {
};
convert.rgb.xyz = function (rgb) {
let r = rgb[0] / 255;
let g = rgb[1] / 255;
let b = rgb[2] / 255;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
// Assume sRGB
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
// assume sRGB
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
return [x * 100, y * 100, z * 100];
};
convert.rgb.lab = function (rgb) {
const xyz = convert.rgb.xyz(rgb);
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
var xyz = convert.rgb.xyz(rgb);
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
const l = (116 * y) - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.hsl.rgb = function (hsl) {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
let t2;
let t3;
let val;
var h = hsl[0] / 360;
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var t1;
var t2;
var t3;
var rgb;
var val;
if (s === 0) {
val = l * 255;
@ -260,15 +272,14 @@ convert.hsl.rgb = function (hsl) {
t2 = l + s - l * s;
}
const t1 = 2 * l - t2;
t1 = 2 * l - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
@ -290,31 +301,33 @@ convert.hsl.rgb = function (hsl) {
};
convert.hsl.hsv = function (hsl) {
const h = hsl[0];
let s = hsl[1] / 100;
let l = hsl[2] / 100;
let smin = s;
const lmin = Math.max(l, 0.01);
var h = hsl[0];
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var smin = s;
var lmin = Math.max(l, 0.01);
var sv;
var v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
const v = (l + s) / 2;
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
v = (l + s) / 2;
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
return [h, sv * 100, v * 100];
};
convert.hsv.rgb = function (hsv) {
const h = hsv[0] / 60;
const s = hsv[1] / 100;
let v = hsv[2] / 100;
const hi = Math.floor(h) % 6;
var h = hsv[0] / 60;
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var hi = Math.floor(h) % 6;
const f = h - Math.floor(h);
const p = 255 * v * (1 - s);
const q = 255 * v * (1 - (s * f));
const t = 255 * v * (1 - (s * (1 - f)));
var f = h - Math.floor(h);
var p = 255 * v * (1 - s);
var q = 255 * v * (1 - (s * f));
var t = 255 * v * (1 - (s * (1 - f)));
v *= 255;
switch (hi) {
@ -334,15 +347,16 @@ convert.hsv.rgb = function (hsv) {
};
convert.hsv.hsl = function (hsv) {
const h = hsv[0];
const s = hsv[1] / 100;
const v = hsv[2] / 100;
const vmin = Math.max(v, 0.01);
let sl;
let l;
var h = hsv[0];
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var vmin = Math.max(v, 0.01);
var lmin;
var sl;
var l;
l = (2 - s) * v;
const lmin = (2 - s) * vmin;
lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= (lmin <= 1) ? lmin : 2 - lmin;
sl = sl || 0;
@ -353,83 +367,87 @@ convert.hsv.hsl = function (hsv) {
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
convert.hwb.rgb = function (hwb) {
const h = hwb[0] / 360;
let wh = hwb[1] / 100;
let bl = hwb[2] / 100;
const ratio = wh + bl;
let f;
var h = hwb[0] / 360;
var wh = hwb[1] / 100;
var bl = hwb[2] / 100;
var ratio = wh + bl;
var i;
var v;
var f;
var n;
// Wh + bl cant be > 1
// wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
const i = Math.floor(6 * h);
const v = 1 - bl;
i = Math.floor(6 * h);
v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) {
f = 1 - f;
}
const n = wh + f * (v - wh); // Linear interpolation
n = wh + f * (v - wh); // linear interpolation
let r;
let g;
let b;
/* eslint-disable max-statements-per-line,no-multi-spaces */
var r;
var g;
var b;
switch (i) {
default:
case 6:
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
}
/* eslint-enable max-statements-per-line,no-multi-spaces */
return [r * 255, g * 255, b * 255];
};
convert.cmyk.rgb = function (cmyk) {
const c = cmyk[0] / 100;
const m = cmyk[1] / 100;
const y = cmyk[2] / 100;
const k = cmyk[3] / 100;
var c = cmyk[0] / 100;
var m = cmyk[1] / 100;
var y = cmyk[2] / 100;
var k = cmyk[3] / 100;
var r;
var g;
var b;
const r = 1 - Math.min(1, c * (1 - k) + k);
const g = 1 - Math.min(1, m * (1 - k) + k);
const b = 1 - Math.min(1, y * (1 - k) + k);
r = 1 - Math.min(1, c * (1 - k) + k);
g = 1 - Math.min(1, m * (1 - k) + k);
b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
};
convert.xyz.rgb = function (xyz) {
const x = xyz[0] / 100;
const y = xyz[1] / 100;
const z = xyz[2] / 100;
let r;
let g;
let b;
var x = xyz[0] / 100;
var y = xyz[1] / 100;
var z = xyz[2] / 100;
var r;
var g;
var b;
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
// Assume sRGB
// assume sRGB
r = r > 0.0031308
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
: r * 12.92;
g = g > 0.0031308
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
: g * 12.92;
b = b > 0.0031308
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
: b * 12.92;
r = Math.min(Math.max(0, r), 1);
@ -440,40 +458,43 @@ convert.xyz.rgb = function (xyz) {
};
convert.xyz.lab = function (xyz) {
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
const l = (116 * y) - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.lab.xyz = function (lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let x;
let y;
let z;
var l = lab[0];
var a = lab[1];
var b = lab[2];
var x;
var y;
var z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
const y2 = y ** 3;
const x2 = x ** 3;
const z2 = z ** 3;
var y2 = Math.pow(y, 3);
var x2 = Math.pow(x, 3);
var z2 = Math.pow(z, 3);
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
@ -486,38 +507,45 @@ convert.lab.xyz = function (lab) {
};
convert.lab.lch = function (lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let h;
var l = lab[0];
var a = lab[1];
var b = lab[2];
var hr;
var h;
var c;
const hr = Math.atan2(b, a);
hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
const c = Math.sqrt(a * a + b * b);
c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
convert.lch.lab = function (lch) {
const l = lch[0];
const c = lch[1];
const h = lch[2];
var l = lch[0];
var c = lch[1];
var h = lch[2];
var a;
var b;
var hr;
const hr = h / 360 * 2 * Math.PI;
const a = c * Math.cos(hr);
const b = c * Math.sin(hr);
hr = h / 360 * 2 * Math.PI;
a = c * Math.cos(hr);
b = c * Math.sin(hr);
return [l, a, b];
};
convert.rgb.ansi16 = function (args, saturation = null) {
const [r, g, b] = args;
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
convert.rgb.ansi16 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
value = Math.round(value / 50);
@ -525,7 +553,7 @@ convert.rgb.ansi16 = function (args, saturation = null) {
return 30;
}
let ansi = 30
var ansi = 30
+ ((Math.round(b / 255) << 2)
| (Math.round(g / 255) << 1)
| Math.round(r / 255));
@ -538,17 +566,17 @@ convert.rgb.ansi16 = function (args, saturation = null) {
};
convert.hsv.ansi16 = function (args) {
// Optimization here; we already know the value and don't need to get
// optimization here; we already know the value and don't need to get
// it converted for us.
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function (args) {
const r = args[0];
const g = args[1];
const b = args[2];
var r = args[0];
var g = args[1];
var b = args[2];
// We use the extended greyscale palette here, with the exception of
// we use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r === g && g === b) {
if (r < 8) {
@ -562,7 +590,7 @@ convert.rgb.ansi256 = function (args) {
return Math.round(((r - 8) / 247) * 24) + 232;
}
const ansi = 16
var ansi = 16
+ (36 * Math.round(r / 255 * 5))
+ (6 * Math.round(g / 255 * 5))
+ Math.round(b / 255 * 5);
@ -571,9 +599,9 @@ convert.rgb.ansi256 = function (args) {
};
convert.ansi16.rgb = function (args) {
let color = args % 10;
var color = args % 10;
// Handle greyscale
// handle greyscale
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
@ -584,71 +612,71 @@ convert.ansi16.rgb = function (args) {
return [color, color, color];
}
const mult = (~~(args > 50) + 1) * 0.5;
const r = ((color & 1) * mult) * 255;
const g = (((color >> 1) & 1) * mult) * 255;
const b = (((color >> 2) & 1) * mult) * 255;
var mult = (~~(args > 50) + 1) * 0.5;
var r = ((color & 1) * mult) * 255;
var g = (((color >> 1) & 1) * mult) * 255;
var b = (((color >> 2) & 1) * mult) * 255;
return [r, g, b];
};
convert.ansi256.rgb = function (args) {
// Handle greyscale
// handle greyscale
if (args >= 232) {
const c = (args - 232) * 10 + 8;
var c = (args - 232) * 10 + 8;
return [c, c, c];
}
args -= 16;
let rem;
const r = Math.floor(args / 36) / 5 * 255;
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
const b = (rem % 6) / 5 * 255;
var rem;
var r = Math.floor(args / 36) / 5 * 255;
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
var b = (rem % 6) / 5 * 255;
return [r, g, b];
};
convert.rgb.hex = function (args) {
const integer = ((Math.round(args[0]) & 0xFF) << 16)
var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ ((Math.round(args[1]) & 0xFF) << 8)
+ (Math.round(args[2]) & 0xFF);
const string = integer.toString(16).toUpperCase();
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.hex.rgb = function (args) {
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
let colorString = match[0];
var colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split('').map(char => {
colorString = colorString.split('').map(function (char) {
return char + char;
}).join('');
}
const integer = parseInt(colorString, 16);
const r = (integer >> 16) & 0xFF;
const g = (integer >> 8) & 0xFF;
const b = integer & 0xFF;
var integer = parseInt(colorString, 16);
var r = (integer >> 16) & 0xFF;
var g = (integer >> 8) & 0xFF;
var b = integer & 0xFF;
return [r, g, b];
};
convert.rgb.hcg = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const max = Math.max(Math.max(r, g), b);
const min = Math.min(Math.min(r, g), b);
const chroma = (max - min);
let grayscale;
let hue;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var max = Math.max(Math.max(r, g), b);
var min = Math.min(Math.min(r, g), b);
var chroma = (max - min);
var grayscale;
var hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
@ -665,7 +693,7 @@ convert.rgb.hcg = function (rgb) {
if (max === g) {
hue = 2 + (b - r) / chroma;
} else {
hue = 4 + (r - g) / chroma;
hue = 4 + (r - g) / chroma + 4;
}
hue /= 6;
@ -675,12 +703,17 @@ convert.rgb.hcg = function (rgb) {
};
convert.hsl.hcg = function (hsl) {
const s = hsl[1] / 100;
const l = hsl[2] / 100;
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var c = 1;
var f = 0;
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
if (l < 0.5) {
c = 2.0 * s * l;
} else {
c = 2.0 * s * (1.0 - l);
}
let f = 0;
if (c < 1.0) {
f = (l - 0.5 * c) / (1.0 - c);
}
@ -689,11 +722,11 @@ convert.hsl.hcg = function (hsl) {
};
convert.hsv.hcg = function (hsv) {
const s = hsv[1] / 100;
const v = hsv[2] / 100;
var s = hsv[1] / 100;
var v = hsv[2] / 100;
const c = s * v;
let f = 0;
var c = s * v;
var f = 0;
if (c < 1.0) {
f = (v - c) / (1 - c);
@ -703,21 +736,20 @@ convert.hsv.hcg = function (hsv) {
};
convert.hcg.rgb = function (hcg) {
const h = hcg[0] / 360;
const c = hcg[1] / 100;
const g = hcg[2] / 100;
var h = hcg[0] / 360;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
if (c === 0.0) {
return [g * 255, g * 255, g * 255];
}
const pure = [0, 0, 0];
const hi = (h % 1) * 6;
const v = hi % 1;
const w = 1 - v;
let mg = 0;
var pure = [0, 0, 0];
var hi = (h % 1) * 6;
var v = hi % 1;
var w = 1 - v;
var mg = 0;
/* eslint-disable max-statements-per-line */
switch (Math.floor(hi)) {
case 0:
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
@ -732,7 +764,6 @@ convert.hcg.rgb = function (hcg) {
default:
pure[0] = 1; pure[1] = 0; pure[2] = w;
}
/* eslint-enable max-statements-per-line */
mg = (1.0 - c) * g;
@ -744,11 +775,11 @@ convert.hcg.rgb = function (hcg) {
};
convert.hcg.hsv = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
const v = c + g * (1.0 - c);
let f = 0;
var v = c + g * (1.0 - c);
var f = 0;
if (v > 0.0) {
f = c / v;
@ -758,11 +789,11 @@ convert.hcg.hsv = function (hcg) {
};
convert.hcg.hsl = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
const l = g * (1.0 - c) + 0.5 * c;
let s = 0;
var l = g * (1.0 - c) + 0.5 * c;
var s = 0;
if (l > 0.0 && l < 0.5) {
s = c / (2 * l);
@ -775,18 +806,18 @@ convert.hcg.hsl = function (hcg) {
};
convert.hcg.hwb = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
const v = c + g * (1.0 - c);
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
return [hcg[0], (v - c) * 100, (1 - v) * 100];
};
convert.hwb.hcg = function (hwb) {
const w = hwb[1] / 100;
const b = hwb[2] / 100;
const v = 1 - b;
const c = v - w;
let g = 0;
var w = hwb[1] / 100;
var b = hwb[2] / 100;
var v = 1 - b;
var c = v - w;
var g = 0;
if (c < 1) {
g = (v - c) / (1 - c);
@ -807,12 +838,10 @@ convert.gray.rgb = function (args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = function (args) {
convert.gray.hsl = convert.gray.hsv = function (args) {
return [0, 0, args[0]];
};
convert.gray.hsv = convert.gray.hsl;
convert.gray.hwb = function (gray) {
return [0, 100, gray[0]];
};
@ -826,14 +855,14 @@ convert.gray.lab = function (gray) {
};
convert.gray.hex = function (gray) {
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
const integer = (val << 16) + (val << 8) + val;
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
var integer = (val << 16) + (val << 8) + val;
const string = integer.toString(16).toUpperCase();
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.rgb.gray = function (rgb) {
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};

View File

@ -0,0 +1,78 @@
var conversions = require('./conversions');
var route = require('./route');
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args);
// we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(function (fromModel) {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
var routes = route(fromModel);
var routeModels = Object.keys(routes);
routeModels.forEach(function (toModel) {
var fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module.exports = convert;

View File

@ -1,30 +1,14 @@
{
"author": {
"name": "Heather Arthur",
"email": "fayearthur@gmail.com"
},
"bugs": {
"url": "https://github.com/Qix-/color-convert/issues"
},
"bundleDependencies": false,
"dependencies": {
"color-name": "~1.1.4"
},
"deprecated": false,
"name": "color-convert",
"description": "Plain color conversion functions",
"devDependencies": {
"chalk": "^2.4.2",
"xo": "^0.24.0"
"version": "1.9.3",
"author": "Heather Arthur <fayearthur@gmail.com>",
"license": "MIT",
"repository": "Qix-/color-convert",
"scripts": {
"pretest": "xo",
"test": "node test/basic.js"
},
"engines": {
"node": ">=7.0.0"
},
"files": [
"index.js",
"conversions.js",
"route.js"
],
"homepage": "https://github.com/Qix-/color-convert#readme",
"keywords": [
"color",
"colour",
@ -39,22 +23,24 @@
"ansi",
"ansi16"
],
"license": "MIT",
"name": "color-convert",
"repository": {
"type": "git",
"url": "git+https://github.com/Qix-/color-convert.git"
},
"scripts": {
"pretest": "xo",
"test": "node test/basic.js"
},
"version": "2.0.1",
"files": [
"index.js",
"conversions.js",
"css-keywords.js",
"route.js"
],
"xo": {
"rules": {
"default-case": 0,
"no-inline-comments": 0,
"operator-linebreak": 0
}
},
"devDependencies": {
"chalk": "1.1.1",
"xo": "0.11.2"
},
"dependencies": {
"color-name": "1.1.3"
}
}
}

View File

@ -1,7 +1,7 @@
const conversions = require('./conversions');
var conversions = require('./conversions');
/*
This function routes a model to all other models.
this function routes a model to all other models.
all functions that are routed have a property `.conversion` attached
to the returned synthetic function. This property is an array
@ -12,11 +12,11 @@ const conversions = require('./conversions');
*/
function buildGraph() {
const graph = {};
var graph = {};
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
const models = Object.keys(conversions);
var models = Object.keys(conversions);
for (let len = models.length, i = 0; i < len; i++) {
for (var len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
@ -30,18 +30,18 @@ function buildGraph() {
// https://en.wikipedia.org/wiki/Breadth-first_search
function deriveBFS(fromModel) {
const graph = buildGraph();
const queue = [fromModel]; // Unshift -> queue -> pop
var graph = buildGraph();
var queue = [fromModel]; // unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
const current = queue.pop();
const adjacents = Object.keys(conversions[current]);
var current = queue.pop();
var adjacents = Object.keys(conversions[current]);
for (let len = adjacents.length, i = 0; i < len; i++) {
const adjacent = adjacents[i];
const node = graph[adjacent];
for (var len = adjacents.length, i = 0; i < len; i++) {
var adjacent = adjacents[i];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
@ -61,10 +61,10 @@ function link(from, to) {
}
function wrapConversion(toModel, graph) {
const path = [graph[toModel].parent, toModel];
let fn = conversions[graph[toModel].parent][toModel];
var path = [graph[toModel].parent, toModel];
var fn = conversions[graph[toModel].parent][toModel];
let cur = graph[toModel].parent;
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
@ -76,16 +76,16 @@ function wrapConversion(toModel, graph) {
}
module.exports = function (fromModel) {
const graph = deriveBFS(fromModel);
const conversion = {};
var graph = deriveBFS(fromModel);
var conversion = {};
const models = Object.keys(graph);
for (let len = models.length, i = 0; i < len; i++) {
const toModel = models[i];
const node = graph[toModel];
var models = Object.keys(graph);
for (var len = models.length, i = 0; i < len; i++) {
var toModel = models[i];
var node = graph[toModel];
if (node.parent === null) {
// No possible conversion, or this node is the source model.
// no possible conversion, or this node is the source model.
continue;
}

View File

@ -0,0 +1,25 @@
{
"name": "color-name",
"version": "1.1.3",
"description": "A list of color names and its values",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git@github.com:dfcreative/color-name.git"
},
"keywords": [
"color-name",
"color",
"color-keyword",
"keyword"
],
"author": "DY <dfcreative@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/dfcreative/color-name/issues"
},
"homepage": "https://github.com/dfcreative/color-name"
}

View File

@ -0,0 +1,8 @@
'use strict';
module.exports = (flag, argv) => {
argv = argv || process.argv;
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const pos = argv.indexOf(prefix + flag);
const terminatorPos = argv.indexOf('--');
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};

View File

@ -1,28 +1,23 @@
{
"name": "has-flag",
"version": "3.0.0",
"description": "Check if argv has a specific flag",
"license": "MIT",
"repository": "sindresorhus/has-flag",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/has-flag/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Check if argv has a specific flag",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"index.d.ts"
"index.js"
],
"homepage": "https://github.com/sindresorhus/has-flag#readme",
"keywords": [
"has",
"check",
@ -42,14 +37,8 @@
"minimist",
"optimist"
],
"license": "MIT",
"name": "has-flag",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/has-flag.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "4.0.0"
}
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@ -4,20 +4,6 @@
Correctly stops looking after an `--` argument terminator.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
@ -79,11 +65,6 @@ Default: `process.argv`
CLI arguments.
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -1,31 +1,22 @@
'use strict';
const os = require('os');
const tty = require('tty');
const hasFlag = require('has-flag');
const {env} = process;
const env = process.env;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false') ||
hasFlag('color=never')) {
forceColor = 0;
hasFlag('color=false')) {
forceColor = false;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = 1;
forceColor = true;
}
if ('FORCE_COLOR' in env) {
if (env.FORCE_COLOR === 'true') {
forceColor = 1;
} else if (env.FORCE_COLOR === 'false') {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
}
function translateLevel(level) {
@ -41,8 +32,8 @@ function translateLevel(level) {
};
}
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {
function supportsColor(stream) {
if (forceColor === false) {
return 0;
}
@ -56,21 +47,22 @@ function supportsColor(haveStream, streamIsTTY) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === undefined) {
if (stream && !stream.isTTY && forceColor !== true) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === 'dumb') {
return min;
}
const min = forceColor ? 1 : 0;
if (process.platform === 'win32') {
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
// Node.js 7.5.0 is the first version of Node.js to include a patch to
// libuv that enables 256 color output on Windows. Anything earlier and it
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
// release that supports 256 colors. Windows 10 build 14931 is the first release
// that supports 16m/TrueColor.
const osRelease = os.release().split('.');
if (
Number(process.versions.node.split('.')[0]) >= 8 &&
Number(osRelease[0]) >= 10 &&
Number(osRelease[2]) >= 10586
) {
@ -81,7 +73,7 @@ function supportsColor(haveStream, streamIsTTY) {
}
if ('CI' in env) {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;
}
@ -120,16 +112,20 @@ function supportsColor(haveStream, streamIsTTY) {
return 1;
}
if (env.TERM === 'dumb') {
return min;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream, stream && stream.isTTY);
const level = supportsColor(stream);
return translateLevel(level);
}
module.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
stdout: getSupportLevel(process.stdout),
stderr: getSupportLevel(process.stderr)
};

View File

@ -0,0 +1,53 @@
{
"name": "supports-color",
"version": "5.5.0",
"description": "Detect whether a terminal supports color",
"license": "MIT",
"repository": "chalk/supports-color",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"browser.js"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"ansi",
"styles",
"tty",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"support",
"supports",
"capability",
"detect",
"truecolor",
"16m"
],
"dependencies": {
"has-flag": "^3.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"import-fresh": "^2.0.0",
"xo": "^0.20.0"
},
"browser": "browser.js"
}

View File

@ -44,7 +44,7 @@ The `stdout`/`stderr` objects specifies a level of support for color through a `
It obeys the `--color` and `--no-color` CLI flags.
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
@ -61,16 +61,6 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
- [Josh Junon](https://github.com/qix-)
---
## License
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
MIT

View File

@ -1,34 +1,26 @@
{
"author": {
"name": "suchipi",
"email": "me@suchipi.com"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-validator-identifier": "^7.12.11",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"deprecated": false,
"name": "@babel/highlight",
"version": "7.13.10",
"description": "Syntax highlight JavaScript strings for output in terminals.",
"devDependencies": {
"@types/chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"author": "suchipi <me@suchipi.com>",
"homepage": "https://babel.dev/docs/en/next/babel-highlight",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/highlight",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-highlight"
},
"version": "7.13.10"
"main": "lib/index.js",
"dependencies": {
"@babel/helper-validator-identifier": "^7.12.11",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"devDependencies": {
"@types/chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
}
}

View File

@ -1,61 +1,52 @@
{
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/globals/issues"
},
"bundleDependencies": false,
"dependencies": {
"type-fest": "^0.8.1"
},
"deprecated": false,
"description": "Global identifiers from different JavaScript environments",
"devDependencies": {
"ava": "^2.2.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts",
"globals.json"
],
"funding": "https://github.com/sponsors/sindresorhus",
"homepage": "https://github.com/sindresorhus/globals#readme",
"keywords": [
"globals",
"global",
"identifiers",
"variables",
"vars",
"jshint",
"eslint",
"environments"
],
"license": "MIT",
"name": "globals",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/globals.git"
},
"scripts": {
"test": "xo && ava"
},
"tsd": {
"compilerOptions": {
"resolveJsonModule": true
}
},
"version": "12.4.0",
"xo": {
"ignores": [
"get-browser-globals.js"
]
}
}
"name": "globals",
"version": "12.4.0",
"description": "Global identifiers from different JavaScript environments",
"license": "MIT",
"repository": "sindresorhus/globals",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"index.d.ts",
"globals.json"
],
"keywords": [
"globals",
"global",
"identifiers",
"variables",
"vars",
"jshint",
"eslint",
"environments"
],
"dependencies": {
"type-fest": "^0.8.1"
},
"devDependencies": {
"ava": "^2.2.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
},
"xo": {
"ignores": [
"get-browser-globals.js"
]
},
"tsd": {
"compilerOptions": {
"resolveJsonModule": true
}
}
}

View File

@ -0,0 +1,51 @@
{
"name": "type-fest",
"version": "0.8.1",
"description": "A collection of essential TypeScript types",
"license": "(MIT OR CC0-1.0)",
"repository": "sindresorhus/type-fest",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && tsd"
},
"files": [
"index.d.ts",
"source"
],
"keywords": [
"typescript",
"ts",
"types",
"utility",
"util",
"utilities",
"omit",
"merge",
"json"
],
"devDependencies": {
"@sindresorhus/tsconfig": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^2.2.0",
"@typescript-eslint/parser": "^2.2.0",
"eslint-config-xo-typescript": "^0.18.0",
"tsd": "^0.7.3",
"xo": "^0.24.0"
},
"xo": {
"extends": "xo-typescript",
"extensions": [
"ts"
],
"rules": {
"import/no-unresolved": "off",
"@typescript-eslint/indent": "off"
}
}
}

View File

@ -11,7 +11,8 @@
<br>
<br>
[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)
[![Build Status](https://travis-ci.com/sindresorhus/type-fest.svg?branch=master)](https://travis-ci.com/sindresorhus/type-fest)
[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4)
<!-- Commented out until they actually show anything
[![npm dependents](https://badgen.net/npm/dependents/type-fest)](https://www.npmjs.com/package/type-fest?activeTab=dependents) [![npm downloads](https://badgen.net/npm/dt/type-fest)](https://www.npmjs.com/package/type-fest)
-->
@ -22,13 +23,15 @@ Either add this package as a dependency or copy-paste the needed types. No credi
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
## Install
```
$ npm install type-fest
```
*Requires TypeScript >=3.4*
*Requires TypeScript >=3.2*
## Usage
@ -44,6 +47,7 @@ type FooWithoutRainbow = Except<Foo, 'rainbow'>;
//=> {unicorn: string}
```
## API
Click the type names for complete docs.
@ -65,7 +69,7 @@ Click the type names for complete docs.
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
- [`RequireExactlyOne`](source/require-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep.
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep.
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
@ -73,35 +77,11 @@ Click the type names for complete docs.
- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.
- [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`.
- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.
- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
### Template literal types
*Note:* These require [TypeScript 4.1 or newer](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types).
- [`CamelCase`](ts41/camel-case.d.ts) Convert a string literal to camel-case (`fooBar`).
- [`KebabCase`](ts41/kebab-case.d.ts) Convert a string literal to kebab-case (`foo-bar`).
- [`PascalCase`](ts41/pascal-case.d.ts) Converts a string literal to pascal-case (`FooBar`)
- [`SnakeCase`](ts41/snake-case.d.ts) Convert a string literal to snake-case (`foo_bar`).
- [`DelimiterCase`](ts41/delimiter-case.d.ts) Convert a string literal to a custom string delimiter casing.
### Miscellaneous
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
## Declined types
@ -109,8 +89,7 @@ Click the type names for complete docs.
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
- [`SubType`](https://github.com/sindresorhus/type-fest/issues/22) - The type is powerful, but lacks good use-cases and is prone to misuse.
- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.
## Tips
@ -124,7 +103,7 @@ There are many advanced types most users don't know about.
Example
</summary>
[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)
[Playground](https://typescript-play.js.org/?target=6#code/KYOwrgtgBAMg9gcxsAbsANlA3gKClAeQDMiAaPKAEWACMwFz8BRAJxbhcagDEBDAF17ocAXxw4AliH7AWRXgGNgUAHJwAJsADCcEEQkJsFXgAcTK3hGAAuKAGd+LKQgDcFEx363wEGrLf46IjIaOi28EioGG5iOArovHZ2qhrAAIJmAEJgEuiaLEb4Jk4oAsoKuvoIYCwCErq2apo6egZQALyF+FCm5pY2UABETelmg1xFnrYAzAAM8xNQQZGh4cFR6AB0xEQUIm4UFa0IABRHVbYACrws-BJCADwjLVUAfACUXfhEHFBnug4oABrYAATygcCIhBoACtgAp+JsQaC7P9ju9Prhut0joCwCZ1GUAGpCMDKTrnAwAbWRPWSyMhKWalQMAF0Dtj8BIoSd8YSZCT0GSOu1OmAQJp9CBgOpPkc7uBgBzOfwABYSOybSnVWp3XQ0sF04FgxnPFkIVkdKB84mkpUUfCxbEsYD8GogKBqjUBKBiWIAen9UGut3u6CeqReBlePXQQQA7skwMl+HAoMU4CgJJoISB0ODeOmbvwIVC1cAcIGmdpzVApDI5IpgJscNL49WMiZsrl8id3lrzScsD0zBYrLZBgAVOCUOCdwa+95uIA)
```ts
interface NodeConfig {
@ -138,10 +117,6 @@ There are many advanced types most users don't know about.
port: 3000
};
private updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {
this.configuration[key] = value;
}
config(config: Partial<NodeConfig>) {
type NodeConfigKey = keyof NodeConfig;
@ -152,7 +127,7 @@ There are many advanced types most users don't know about.
continue;
}
this.updateConfig(key, updateValue);
this.configuration[key] = updateValue;
}
return this;
@ -634,17 +609,19 @@ There are many advanced types most users don't know about.
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Jarek Radosz](https://github.com/CvX)
- [Dimitri Benin](https://github.com/BendingBender)
- [Pelle Wessman](https://github.com/voxpelli)
## License
(MIT OR CC0-1.0)
---
<div align="center">

View File

@ -1,24 +1,37 @@
{
"author": {
"name": "Nicholas C. Zakas"
"name": "@eslint/eslintrc",
"version": "0.4.0",
"description": "The legacy ESLintRC config file format for ESLint",
"main": "lib/index.js",
"files": [
"lib",
"conf",
"LICENSE"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint .",
"test": "mocha -R progress -c 'tests/lib/**/*.js'",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"publish-release": "eslint-publish-release"
},
"repository": "eslint/eslintrc",
"keywords": [
"ESLint",
"ESLintRC",
"Configuration"
],
"author": "Nicholas C. Zakas",
"license": "MIT",
"bugs": {
"url": "https://github.com/eslint/eslintrc/issues"
},
"bundleDependencies": false,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
"globals": "^12.1.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
},
"deprecated": false,
"description": "The legacy ESLintRC config file format for ESLint",
"homepage": "https://github.com/eslint/eslintrc#readme",
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^7.7.0",
@ -32,38 +45,18 @@
"sinon": "^9.2.0",
"temp-dir": "^2.0.0"
},
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
"globals": "^12.1.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
},
"files": [
"lib",
"conf",
"LICENSE"
],
"homepage": "https://github.com/eslint/eslintrc#readme",
"keywords": [
"ESLint",
"ESLintRC",
"Configuration"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@eslint/eslintrc",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/eslintrc.git"
},
"scripts": {
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"generate-release": "eslint-generate-release",
"lint": "eslint .",
"publish-release": "eslint-publish-release",
"test": "mocha -R progress -c 'tests/lib/**/*.js'"
},
"version": "0.4.0"
}
}
}

View File

@ -1,32 +1,27 @@
{
"bugs": {
"url": "https://github.com/acornjs/acorn-jsx/issues"
},
"bundleDependencies": false,
"deprecated": false,
"name": "acorn-jsx",
"description": "Modern, fast React.js JSX parser",
"devDependencies": {
"acorn": "^8.0.1"
},
"homepage": "https://github.com/acornjs/acorn-jsx",
"license": "MIT",
"version": "5.3.1",
"maintainers": [
{
"name": "Ingvar Stepanyan",
"email": "me@rreverser.com",
"url": "http://rreverser.com/"
"web": "http://rreverser.com/"
}
],
"name": "acorn-jsx",
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/acornjs/acorn-jsx.git"
"url": "https://github.com/acornjs/acorn-jsx"
},
"license": "MIT",
"scripts": {
"test": "node test/run.js"
},
"version": "5.3.1"
}
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"devDependencies": {
"acorn": "^8.0.1"
}
}

View File

@ -1,44 +1,35 @@
{
"bin": {
"acorn": "bin/acorn"
},
"bugs": {
"url": "https://github.com/acornjs/acorn/issues"
},
"bundleDependencies": false,
"deprecated": false,
"name": "acorn",
"description": "ECMAScript parser",
"engines": {
"node": ">=0.4.0"
},
"homepage": "https://github.com/acornjs/acorn",
"license": "MIT",
"main": "dist/acorn.js",
"types": "dist/acorn.d.ts",
"module": "dist/acorn.mjs",
"version": "7.4.1",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
"name": "Marijn Haverbeke",
"email": "marijnh@gmail.com",
"url": "https://marijnhaverbeke.nl"
"web": "https://marijnhaverbeke.nl"
},
{
"name": "Ingvar Stepanyan",
"email": "me@rreverser.com",
"url": "https://rreverser.com/"
"web": "https://rreverser.com/"
},
{
"name": "Adrian Heine",
"url": "http://adrianheine.de"
"web": "http://adrianheine.de"
}
],
"module": "dist/acorn.mjs",
"name": "acorn",
"repository": {
"type": "git",
"url": "git+https://github.com/acornjs/acorn.git"
"url": "https://github.com/acornjs/acorn.git"
},
"license": "MIT",
"scripts": {
"prepare": "cd ..; npm run build:main && npm run build:bin"
},
"types": "dist/acorn.d.ts",
"version": "7.4.1"
}
"bin": {"acorn": "./bin/acorn"}
}

View File

@ -1,23 +1,72 @@
{
"author": {
"name": "Evgeny Poberezkin"
"name": "ajv",
"version": "6.12.6",
"description": "Another JSON Schema Validator",
"main": "lib/ajv.js",
"typings": "lib/ajv.d.ts",
"files": [
"lib/",
"dist/",
"scripts/",
"LICENSE",
".tonic_example.js"
],
"scripts": {
"eslint": "eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite",
"jshint": "jshint lib/{compile/,}*.js",
"lint": "npm run jshint && npm run eslint",
"test-spec": "mocha spec/{**/,}*.spec.js -R spec",
"test-fast": "AJV_FAST_TEST=true npm run test-spec",
"test-debug": "npm run test-spec -- --inspect-brk",
"test-cov": "nyc npm run test-spec",
"test-ts": "tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts",
"bundle": "del-cli dist && node ./scripts/bundle.js . Ajv pure_getters",
"bundle-beautify": "node ./scripts/bundle.js js-beautify",
"build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js",
"test-karma": "karma start",
"test-browser": "del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma",
"test-all": "npm run test-cov && if-node-version 10 npm run test-browser",
"test": "npm run lint && npm run build && npm run test-all",
"prepublish": "npm run build && npm run bundle",
"watch": "watch \"npm run build\" ./lib/dot"
},
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
},
"repository": {
"type": "git",
"url": "https://github.com/ajv-validator/ajv.git"
},
"keywords": [
"JSON",
"schema",
"validator",
"validation",
"jsonschema",
"json-schema",
"json-schema-validator",
"json-schema-validation"
],
"author": "Evgeny Poberezkin",
"license": "MIT",
"bugs": {
"url": "https://github.com/ajv-validator/ajv/issues"
},
"bundleDependencies": false,
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/ajv"
},
"homepage": "https://github.com/ajv-validator/ajv",
"tonicExampleFilename": ".tonic_example.js",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"deprecated": false,
"description": "Another JSON Schema Validator",
"devDependencies": {
"ajv-async": "^1.0.0",
"bluebird": "^3.5.3",
@ -46,65 +95,12 @@
"uglify-js": "^3.6.9",
"watch": "^1.0.0"
},
"files": [
"lib/",
"dist/",
"scripts/",
"LICENSE",
".tonic_example.js"
],
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/ajv"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
},
"homepage": "https://github.com/ajv-validator/ajv",
"keywords": [
"JSON",
"schema",
"validator",
"validation",
"jsonschema",
"json-schema",
"json-schema-validator",
"json-schema-validation"
],
"license": "MIT",
"main": "lib/ajv.js",
"name": "ajv",
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/ajv-validator/ajv.git"
},
"scripts": {
"build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js",
"bundle": "del-cli dist && node ./scripts/bundle.js . Ajv pure_getters",
"bundle-beautify": "node ./scripts/bundle.js js-beautify",
"eslint": "eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite",
"jshint": "jshint lib/{compile/,}*.js",
"lint": "npm run jshint && npm run eslint",
"prepublish": "npm run build && npm run bundle",
"test": "npm run lint && npm run build && npm run test-all",
"test-all": "npm run test-cov && if-node-version 10 npm run test-browser",
"test-browser": "del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma",
"test-cov": "nyc npm run test-spec",
"test-debug": "npm run test-spec -- --inspect-brk",
"test-fast": "AJV_FAST_TEST=true npm run test-spec",
"test-karma": "karma start",
"test-spec": "mocha spec/{**/,}*.spec.js -R spec",
"test-ts": "tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts",
"watch": "watch \"npm run build\" ./lib/dot"
},
"tonicExampleFilename": ".tonic_example.js",
"typings": "lib/ajv.d.ts",
"version": "6.12.6"
}
}
}

View File

@ -1,32 +1,33 @@
{
"author": {
"name": "Brian Woodward",
"url": "https://github.com/doowb"
},
"name": "ansi-colors",
"description": "Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).",
"version": "4.1.1",
"homepage": "https://github.com/doowb/ansi-colors",
"author": "Brian Woodward (https://github.com/doowb)",
"contributors": [
"Brian Woodward (https://twitter.com/doowb)",
"Jason Schilling (https://sourecode.de)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
"Jordan (https://github.com/Silic0nS0ldier)"
],
"repository": "doowb/ansi-colors",
"bugs": {
"url": "https://github.com/doowb/ansi-colors/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Brian Woodward",
"url": "https://twitter.com/doowb"
},
{
"name": "Jason Schilling",
"url": "https://sourecode.de"
},
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Jordan",
"url": "https://github.com/Silic0nS0ldier"
}
"license": "MIT",
"files": [
"index.js",
"symbols.js",
"types/index.d.ts"
],
"deprecated": false,
"description": "Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).",
"main": "index.js",
"types": "./types/index.d.ts",
"engines": {
"node": ">=6"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"decache": "^4.5.1",
"gulp-format-md": "^2.0.0",
@ -34,15 +35,6 @@
"mocha": "^6.1.4",
"text-table": "^0.2.0"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js",
"symbols.js",
"types/index.d.ts"
],
"homepage": "https://github.com/doowb/ansi-colors",
"keywords": [
"ansi",
"bgblack",
@ -83,17 +75,6 @@
"white",
"yellow"
],
"license": "MIT",
"main": "index.js",
"name": "ansi-colors",
"repository": {
"type": "git",
"url": "git+https://github.com/doowb/ansi-colors.git"
},
"scripts": {
"test": "mocha"
},
"types": "./types/index.d.ts",
"verb": {
"toc": false,
"layout": "default",
@ -124,6 +105,5 @@
"colors",
"kleur"
]
},
"version": "4.1.1"
}
}
}

View File

@ -1,64 +1,55 @@
{
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"name": "ansi-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava && tsd",
"view-supported": "node fixtures/view-codes.js"
},
"version": "5.0.0"
}
"name": "ansi-regex",
"version": "5.0.0",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
"view-supported": "node fixtures/view-codes.js"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
}
}

View File

@ -1,21 +1,63 @@
'use strict';
const colorConvert = require('color-convert');
const wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert, arguments);
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
const setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === undefined) {
colorConvert = require('color-convert');
}
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) {
styles[name] = wrap(identity, offset);
} else if (typeof suite === 'object') {
styles[name] = wrap(suite[targetSpace], offset);
}
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
@ -39,9 +81,9 @@ function assembleStyles() {
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
@ -72,15 +114,14 @@ function assembleStyles() {
}
};
// Fix humans
styles.color.grey = styles.color.gray;
for (const groupName of Object.keys(styles)) {
const group = styles[groupName];
for (const styleName of Object.keys(group)) {
const style = group[styleName];
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
@ -95,65 +136,22 @@ function assembleStyles() {
value: group,
enumerable: false
});
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
}
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
for (let key of Object.keys(colorConvert)) {
if (typeof colorConvert[key] !== 'object') {
continue;
}
const suite = colorConvert[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
}
if ('ansi256' in suite) {
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
}
if ('rgb' in suite) {
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
}
}
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
return styles;
}

View File

@ -1,65 +1,56 @@
{
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"ava": {
"require": "babel-polyfill"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"bundleDependencies": false,
"dependencies": {
"color-convert": "^1.9.0"
},
"deprecated": false,
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"ava": "*",
"babel-polyfill": "^6.23.0",
"svg-term-cli": "^2.1.1",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"name": "ansi-styles",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
"test": "xo && ava"
},
"version": "3.2.1"
}
"name": "ansi-styles",
"version": "4.3.0",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"color-convert": "^2.0.1"
},
"devDependencies": {
"@types/color-convert": "^1.9.0",
"ava": "^2.3.0",
"svg-term-cli": "^2.1.1",
"tsd": "^0.11.0",
"xo": "^0.25.3"
}
}

View File

@ -1,11 +1,10 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
<img src="screenshot.svg" width="900">
## Install
@ -13,7 +12,6 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) modul
$ npm install ansi-styles
```
## Usage
```js
@ -29,14 +27,13 @@ console.log(`${style.green.open}Hello world!${style.green.close}`);
// original color.
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
@ -60,7 +57,7 @@ Each style has an `open` and `close` property.
- `magenta`
- `cyan`
- `white`
- `gray` ("bright black")
- `blackBright` (alias: `gray`, `grey`)
- `redBright`
- `greenBright`
- `yellowBright`
@ -79,7 +76,7 @@ Each style has an `open` and `close` property.
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
@ -88,7 +85,6 @@ Each style has an `open` and `close` property.
- `bgCyanBright`
- `bgWhiteBright`
## Advanced usage
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
@ -112,11 +108,21 @@ console.log(style.codes.get(36));
//=> 39
```
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
The following color spaces from `color-convert` are supported:
- `rgb`
- `hex`
- `keyword`
- `hsl`
- `hsv`
- `hwb`
- `ansi`
- `ansi256`
To use these, call the associated conversion function with the intended output, for example:
```js
@ -130,18 +136,17 @@ style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
```
## Related
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## For enterprise
## License
Available as part of the Tidelift Subscription.
MIT
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

View File

@ -1,32 +1,7 @@
{
"bugs": {
"url": "https://github.com/nodeca/argparse/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Eugene Shkuropat"
},
{
"name": "Paul Jacobson"
}
],
"dependencies": {
"sprintf-js": "~1.0.2"
},
"deprecated": false,
"name": "argparse",
"description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
"devDependencies": {
"eslint": "^2.13.1",
"istanbul": "^0.4.5",
"mocha": "^3.1.0",
"ndoc": "^5.0.1"
},
"files": [
"index.js",
"lib/"
],
"homepage": "https://github.com/nodeca/argparse#readme",
"version": "1.0.10",
"keywords": [
"cli",
"parser",
@ -34,14 +9,26 @@
"option",
"args"
],
"contributors": [
"Eugene Shkuropat",
"Paul Jacobson"
],
"files": [
"index.js",
"lib/"
],
"license": "MIT",
"name": "argparse",
"repository": {
"type": "git",
"url": "git+https://github.com/nodeca/argparse.git"
},
"repository": "nodeca/argparse",
"scripts": {
"test": "make test"
},
"version": "1.0.10"
}
"dependencies": {
"sprintf-js": "~1.0.2"
},
"devDependencies": {
"eslint": "^2.13.1",
"istanbul": "^0.4.5",
"mocha": "^3.1.0",
"ndoc": "^5.0.1"
}
}

View File

@ -1,42 +1,33 @@
{
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"bugs": {
"url": "https://github.com/kevva/astral-regex/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Regular expression for matching astral symbols",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/kevva/astral-regex#readme",
"keywords": [
"astral",
"emoji",
"regex",
"surrogate"
],
"license": "MIT",
"name": "astral-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/kevva/astral-regex.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "2.0.0"
}
"name": "astral-regex",
"version": "2.0.0",
"description": "Regular expression for matching astral symbols",
"license": "MIT",
"repository": "kevva/astral-regex",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"astral",
"emoji",
"regex",
"surrogate"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

View File

@ -1,21 +1,22 @@
{
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"bugs": {
"url": "https://github.com/juliangruber/balanced-match/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"name": "balanced-match",
"description": "Match balanced character pairs, like \"{\" and \"}\"",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/balanced-match.git"
},
"homepage": "https://github.com/juliangruber/balanced-match",
"main": "index.js",
"scripts": {
"test": "make test",
"bench": "make bench"
},
"dependencies": {},
"devDependencies": {
"matcha": "^0.7.0",
"tape": "^4.6.0"
},
"homepage": "https://github.com/juliangruber/balanced-match",
"keywords": [
"match",
"regexp",
@ -23,17 +24,12 @@
"balanced",
"parse"
],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT",
"main": "index.js",
"name": "balanced-match",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/balanced-match.git"
},
"scripts": {
"bench": "make bench",
"test": "make test"
},
"testling": {
"files": "test/*.js",
"browsers": [
@ -49,6 +45,5 @@
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "1.0.0"
}
}
}

View File

@ -1,37 +1,33 @@
{
"name": "brace-expansion",
"description": "Brace expansion as known from sh/bash",
"version": "1.1.11",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/brace-expansion.git"
},
"homepage": "https://github.com/juliangruber/brace-expansion",
"main": "index.js",
"scripts": {
"test": "tape test/*.js",
"gentest": "bash test/generate.sh",
"bench": "matcha test/perf/bench.js"
},
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
},
"devDependencies": {
"matcha": "^0.7.0",
"tape": "^4.6.0"
},
"keywords": [],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"bugs": {
"url": "https://github.com/juliangruber/brace-expansion/issues"
},
"bundleDependencies": false,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
},
"deprecated": false,
"description": "Brace expansion as known from sh/bash",
"devDependencies": {
"matcha": "^0.7.0",
"tape": "^4.6.0"
},
"homepage": "https://github.com/juliangruber/brace-expansion",
"keywords": [],
"license": "MIT",
"main": "index.js",
"name": "brace-expansion",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/brace-expansion.git"
},
"scripts": {
"bench": "matcha test/perf/bench.js",
"gentest": "bash test/generate.sh",
"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
@ -47,6 +43,5 @@
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "1.1.11"
}
}
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,2 @@
# call-bind
Robustly `.call.bind()` a function.

View File

@ -0,0 +1,15 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var callBind = require('./');
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};

View File

@ -0,0 +1,47 @@
'use strict';
var bind = require('function-bind');
var GetIntrinsic = require('get-intrinsic');
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $max = GetIntrinsic('%Math.max%');
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
module.exports = function callBind(originalFunction) {
var func = $reflectApply(bind, $call, arguments);
if ($gOPD && $defineProperty) {
var desc = $gOPD(func, 'length');
if (desc.configurable) {
// original length, plus the receiver, minus any additional arguments (after the receiver)
$defineProperty(
func,
'length',
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
);
}
}
return func;
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}

View File

@ -0,0 +1,80 @@
{
"name": "call-bind",
"version": "1.0.2",
"description": "Robustly `.call.bind()` a function",
"main": "index.js",
"exports": {
".": [
{
"default": "./index.js"
},
"./index.js"
],
"./callBound": [
{
"default": "./callBound.js"
},
"./callBound.js"
],
"./package.json": "./package.json"
},
"scripts": {
"prepublish": "safe-publish-latest",
"lint": "eslint --ext=.js,.mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/*'",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/call-bind.git"
},
"keywords": [
"javascript",
"ecmascript",
"es",
"js",
"callbind",
"callbound",
"call",
"bind",
"bound",
"call-bind",
"call-bound",
"function",
"es-abstract"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/call-bind/issues"
},
"homepage": "https://github.com/ljharb/call-bind#readme",
"devDependencies": {
"@ljharb/eslint-config": "^17.3.0",
"aud": "^1.1.3",
"auto-changelog": "^2.2.1",
"eslint": "^7.17.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^1.1.4",
"tape": "^5.1.1"
},
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
}
}

View File

@ -1,48 +1,39 @@
{
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/callsites/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Get callsites from the V8 stack trace API",
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/callsites#readme",
"keywords": [
"stacktrace",
"v8",
"callsite",
"callsites",
"stack",
"trace",
"function",
"file",
"line",
"debug"
],
"license": "MIT",
"name": "callsites",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/callsites.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "3.1.0"
}
"name": "callsites",
"version": "3.1.0",
"description": "Get callsites from the V8 stack trace API",
"license": "MIT",
"repository": "sindresorhus/callsites",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"stacktrace",
"v8",
"callsite",
"callsites",
"stack",
"trace",
"function",
"file",
"line",
"debug"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

View File

@ -1,163 +0,0 @@
'use strict';
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
const setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === undefined) {
colorConvert = require('color-convert');
}
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) {
styles[name] = wrap(identity, offset);
} else if (typeof suite === 'object') {
styles[name] = wrap(suite[targetSpace], offset);
}
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

View File

@ -1,65 +0,0 @@
{
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"bundleDependencies": false,
"dependencies": {
"color-convert": "^2.0.1"
},
"deprecated": false,
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"@types/color-convert": "^1.9.0",
"ava": "^2.3.0",
"svg-term-cli": "^2.1.1",
"tsd": "^0.11.0",
"xo": "^0.25.3"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts"
],
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"name": "ansi-styles",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
"test": "xo && ava && tsd"
},
"version": "4.3.0"
}

View File

@ -1,152 +0,0 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
<img src="screenshot.svg" width="900">
## Install
```
$ npm install ansi-styles
```
## Usage
```js
const style = require('ansi-styles');
console.log(`${style.green.open}Hello world!${style.green.close}`);
// Color conversion between 16/256/truecolor
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
// may be degraded to fit that color palette. This means terminals
// that do not support 16 million colors will best-match the
// original color.
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(Not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(Not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `blackBright` (alias: `gray`, `grey`)
- `redBright`
- `greenBright`
- `yellowBright`
- `blueBright`
- `magentaBright`
- `cyanBright`
- `whiteBright`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
- `bgBlueBright`
- `bgMagentaBright`
- `bgCyanBright`
- `bgWhiteBright`
## Advanced usage
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
- `style.modifier`
- `style.color`
- `style.bgColor`
###### Example
```js
console.log(style.color.green.open);
```
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
###### Example
```js
console.log(style.codes.get(36));
//=> 39
```
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
The following color spaces from `color-convert` are supported:
- `rgb`
- `hex`
- `keyword`
- `hsl`
- `hsv`
- `hwb`
- `ansi`
- `ansi256`
To use these, call the associated conversion function with the intended output, for example:
```js
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
```
## Related
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## For enterprise
Available as part of the Tidelift Subscription.
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

View File

@ -1,839 +0,0 @@
/* MIT license */
/* eslint-disable no-mixed-operators */
const cssKeywords = require('color-name');
// NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
const reverseKeywords = {};
for (const key of Object.keys(cssKeywords)) {
reverseKeywords[cssKeywords[key]] = key;
}
const convert = {
rgb: {channels: 3, labels: 'rgb'},
hsl: {channels: 3, labels: 'hsl'},
hsv: {channels: 3, labels: 'hsv'},
hwb: {channels: 3, labels: 'hwb'},
cmyk: {channels: 4, labels: 'cmyk'},
xyz: {channels: 3, labels: 'xyz'},
lab: {channels: 3, labels: 'lab'},
lch: {channels: 3, labels: 'lch'},
hex: {channels: 1, labels: ['hex']},
keyword: {channels: 1, labels: ['keyword']},
ansi16: {channels: 1, labels: ['ansi16']},
ansi256: {channels: 1, labels: ['ansi256']},
hcg: {channels: 3, labels: ['h', 'c', 'g']},
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
gray: {channels: 1, labels: ['gray']}
};
module.exports = convert;
// Hide .channels and .labels properties
for (const model of Object.keys(convert)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
}
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
const {channels, labels} = convert[model];
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {value: channels});
Object.defineProperty(convert[model], 'labels', {value: labels});
}
convert.rgb.hsl = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
let h;
let s;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
const l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
return [h, s * 100, l * 100];
};
convert.rgb.hsv = function (rgb) {
let rdif;
let gdif;
let bdif;
let h;
let s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const v = Math.max(r, g, b);
const diff = v - Math.min(r, g, b);
const diffc = function (c) {
return (v - c) / 6 / diff + 1 / 2;
};
if (diff === 0) {
h = 0;
s = 0;
} else {
s = diff / v;
rdif = diffc(r);
gdif = diffc(g);
bdif = diffc(b);
if (r === v) {
h = bdif - gdif;
} else if (g === v) {
h = (1 / 3) + rdif - bdif;
} else if (b === v) {
h = (2 / 3) + gdif - rdif;
}
if (h < 0) {
h += 1;
} else if (h > 1) {
h -= 1;
}
}
return [
h * 360,
s * 100,
v * 100
];
};
convert.rgb.hwb = function (rgb) {
const r = rgb[0];
const g = rgb[1];
let b = rgb[2];
const h = convert.rgb.hsl(rgb)[0];
const w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
return [h, w * 100, b * 100];
};
convert.rgb.cmyk = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const k = Math.min(1 - r, 1 - g, 1 - b);
const c = (1 - r - k) / (1 - k) || 0;
const m = (1 - g - k) / (1 - k) || 0;
const y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};
function comparativeDistance(x, y) {
/*
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
*/
return (
((x[0] - y[0]) ** 2) +
((x[1] - y[1]) ** 2) +
((x[2] - y[2]) ** 2)
);
}
convert.rgb.keyword = function (rgb) {
const reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
let currentClosestDistance = Infinity;
let currentClosestKeyword;
for (const keyword of Object.keys(cssKeywords)) {
const value = cssKeywords[keyword];
// Compute comparative distance
const distance = comparativeDistance(rgb, value);
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function (keyword) {
return cssKeywords[keyword];
};
convert.rgb.xyz = function (rgb) {
let r = rgb[0] / 255;
let g = rgb[1] / 255;
let b = rgb[2] / 255;
// Assume sRGB
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
return [x * 100, y * 100, z * 100];
};
convert.rgb.lab = function (rgb) {
const xyz = convert.rgb.xyz(rgb);
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
const l = (116 * y) - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
return [l, a, b];
};
convert.hsl.rgb = function (hsl) {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
let t2;
let t3;
let val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
const t1 = 2 * l - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
};
convert.hsl.hsv = function (hsl) {
const h = hsl[0];
let s = hsl[1] / 100;
let l = hsl[2] / 100;
let smin = s;
const lmin = Math.max(l, 0.01);
l *= 2;
s *= (l <= 1) ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
const v = (l + s) / 2;
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
return [h, sv * 100, v * 100];
};
convert.hsv.rgb = function (hsv) {
const h = hsv[0] / 60;
const s = hsv[1] / 100;
let v = hsv[2] / 100;
const hi = Math.floor(h) % 6;
const f = h - Math.floor(h);
const p = 255 * v * (1 - s);
const q = 255 * v * (1 - (s * f));
const t = 255 * v * (1 - (s * (1 - f)));
v *= 255;
switch (hi) {
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
};
convert.hsv.hsl = function (hsv) {
const h = hsv[0];
const s = hsv[1] / 100;
const v = hsv[2] / 100;
const vmin = Math.max(v, 0.01);
let sl;
let l;
l = (2 - s) * v;
const lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= (lmin <= 1) ? lmin : 2 - lmin;
sl = sl || 0;
l /= 2;
return [h, sl * 100, l * 100];
};
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
convert.hwb.rgb = function (hwb) {
const h = hwb[0] / 360;
let wh = hwb[1] / 100;
let bl = hwb[2] / 100;
const ratio = wh + bl;
let f;
// Wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
const i = Math.floor(6 * h);
const v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) {
f = 1 - f;
}
const n = wh + f * (v - wh); // Linear interpolation
let r;
let g;
let b;
/* eslint-disable max-statements-per-line,no-multi-spaces */
switch (i) {
default:
case 6:
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
}
/* eslint-enable max-statements-per-line,no-multi-spaces */
return [r * 255, g * 255, b * 255];
};
convert.cmyk.rgb = function (cmyk) {
const c = cmyk[0] / 100;
const m = cmyk[1] / 100;
const y = cmyk[2] / 100;
const k = cmyk[3] / 100;
const r = 1 - Math.min(1, c * (1 - k) + k);
const g = 1 - Math.min(1, m * (1 - k) + k);
const b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
};
convert.xyz.rgb = function (xyz) {
const x = xyz[0] / 100;
const y = xyz[1] / 100;
const z = xyz[2] / 100;
let r;
let g;
let b;
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
// Assume sRGB
r = r > 0.0031308
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
: r * 12.92;
g = g > 0.0031308
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
: g * 12.92;
b = b > 0.0031308
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
: b * 12.92;
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [r * 255, g * 255, b * 255];
};
convert.xyz.lab = function (xyz) {
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
const l = (116 * y) - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
return [l, a, b];
};
convert.lab.xyz = function (lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let x;
let y;
let z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
const y2 = y ** 3;
const x2 = x ** 3;
const z2 = z ** 3;
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
x *= 95.047;
y *= 100;
z *= 108.883;
return [x, y, z];
};
convert.lab.lch = function (lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let h;
const hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
const c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
convert.lch.lab = function (lch) {
const l = lch[0];
const c = lch[1];
const h = lch[2];
const hr = h / 360 * 2 * Math.PI;
const a = c * Math.cos(hr);
const b = c * Math.sin(hr);
return [l, a, b];
};
convert.rgb.ansi16 = function (args, saturation = null) {
const [r, g, b] = args;
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
value = Math.round(value / 50);
if (value === 0) {
return 30;
}
let ansi = 30
+ ((Math.round(b / 255) << 2)
| (Math.round(g / 255) << 1)
| Math.round(r / 255));
if (value === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function (args) {
// Optimization here; we already know the value and don't need to get
// it converted for us.
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function (args) {
const r = args[0];
const g = args[1];
const b = args[2];
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r === g && g === b) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
const ansi = 16
+ (36 * Math.round(r / 255 * 5))
+ (6 * Math.round(g / 255 * 5))
+ Math.round(b / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function (args) {
let color = args % 10;
// Handle greyscale
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
}
color = color / 10.5 * 255;
return [color, color, color];
}
const mult = (~~(args > 50) + 1) * 0.5;
const r = ((color & 1) * mult) * 255;
const g = (((color >> 1) & 1) * mult) * 255;
const b = (((color >> 2) & 1) * mult) * 255;
return [r, g, b];
};
convert.ansi256.rgb = function (args) {
// Handle greyscale
if (args >= 232) {
const c = (args - 232) * 10 + 8;
return [c, c, c];
}
args -= 16;
let rem;
const r = Math.floor(args / 36) / 5 * 255;
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
const b = (rem % 6) / 5 * 255;
return [r, g, b];
};
convert.rgb.hex = function (args) {
const integer = ((Math.round(args[0]) & 0xFF) << 16)
+ ((Math.round(args[1]) & 0xFF) << 8)
+ (Math.round(args[2]) & 0xFF);
const string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.hex.rgb = function (args) {
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
let colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split('').map(char => {
return char + char;
}).join('');
}
const integer = parseInt(colorString, 16);
const r = (integer >> 16) & 0xFF;
const g = (integer >> 8) & 0xFF;
const b = integer & 0xFF;
return [r, g, b];
};
convert.rgb.hcg = function (rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const max = Math.max(Math.max(r, g), b);
const min = Math.min(Math.min(r, g), b);
const chroma = (max - min);
let grayscale;
let hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else
if (max === r) {
hue = ((g - b) / chroma) % 6;
} else
if (max === g) {
hue = 2 + (b - r) / chroma;
} else {
hue = 4 + (r - g) / chroma;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function (hsl) {
const s = hsl[1] / 100;
const l = hsl[2] / 100;
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
let f = 0;
if (c < 1.0) {
f = (l - 0.5 * c) / (1.0 - c);
}
return [hsl[0], c * 100, f * 100];
};
convert.hsv.hcg = function (hsv) {
const s = hsv[1] / 100;
const v = hsv[2] / 100;
const c = s * v;
let f = 0;
if (c < 1.0) {
f = (v - c) / (1 - c);
}
return [hsv[0], c * 100, f * 100];
};
convert.hcg.rgb = function (hcg) {
const h = hcg[0] / 360;
const c = hcg[1] / 100;
const g = hcg[2] / 100;
if (c === 0.0) {
return [g * 255, g * 255, g * 255];
}
const pure = [0, 0, 0];
const hi = (h % 1) * 6;
const v = hi % 1;
const w = 1 - v;
let mg = 0;
/* eslint-disable max-statements-per-line */
switch (Math.floor(hi)) {
case 0:
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
case 1:
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
case 2:
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
case 3:
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
case 4:
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
default:
pure[0] = 1; pure[1] = 0; pure[2] = w;
}
/* eslint-enable max-statements-per-line */
mg = (1.0 - c) * g;
return [
(c * pure[0] + mg) * 255,
(c * pure[1] + mg) * 255,
(c * pure[2] + mg) * 255
];
};
convert.hcg.hsv = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
const v = c + g * (1.0 - c);
let f = 0;
if (v > 0.0) {
f = c / v;
}
return [hcg[0], f * 100, v * 100];
};
convert.hcg.hsl = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
const l = g * (1.0 - c) + 0.5 * c;
let s = 0;
if (l > 0.0 && l < 0.5) {
s = c / (2 * l);
} else
if (l >= 0.5 && l < 1.0) {
s = c / (2 * (1 - l));
}
return [hcg[0], s * 100, l * 100];
};
convert.hcg.hwb = function (hcg) {
const c = hcg[1] / 100;
const g = hcg[2] / 100;
const v = c + g * (1.0 - c);
return [hcg[0], (v - c) * 100, (1 - v) * 100];
};
convert.hwb.hcg = function (hwb) {
const w = hwb[1] / 100;
const b = hwb[2] / 100;
const v = 1 - b;
const c = v - w;
let g = 0;
if (c < 1) {
g = (v - c) / (1 - c);
}
return [hwb[0], c * 100, g * 100];
};
convert.apple.rgb = function (apple) {
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
};
convert.rgb.apple = function (rgb) {
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
};
convert.gray.rgb = function (args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = function (args) {
return [0, 0, args[0]];
};
convert.gray.hsv = convert.gray.hsl;
convert.gray.hwb = function (gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function (gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function (gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function (gray) {
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
const integer = (val << 16) + (val << 8) + val;
const string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.rgb.gray = function (rgb) {
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};

View File

@ -1,81 +0,0 @@
const conversions = require('./conversions');
const route = require('./route');
const convert = {};
const models = Object.keys(conversions);
function wrapRaw(fn) {
const wrappedFn = function (...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
};
// Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
const wrappedFn = function (...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args);
// We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
// Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(fromModel => {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
const routes = route(fromModel);
const routeModels = Object.keys(routes);
routeModels.forEach(toModel => {
const fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module.exports = convert;

View File

@ -1,97 +0,0 @@
const conversions = require('./conversions');
/*
This function routes a model to all other models.
all functions that are routed have a property `.conversion` attached
to the returned synthetic function. This property is an array
of strings, each with the steps in between the 'from' and 'to'
color models (inclusive).
conversions that are not possible simply are not included.
*/
function buildGraph() {
const graph = {};
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
const models = Object.keys(conversions);
for (let len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
}
// https://en.wikipedia.org/wiki/Breadth-first_search
function deriveBFS(fromModel) {
const graph = buildGraph();
const queue = [fromModel]; // Unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
const current = queue.pop();
const adjacents = Object.keys(conversions[current]);
for (let len = adjacents.length, i = 0; i < len; i++) {
const adjacent = adjacents[i];
const node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function (args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
const path = [graph[toModel].parent, toModel];
let fn = conversions[graph[toModel].parent][toModel];
let cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
module.exports = function (fromModel) {
const graph = deriveBFS(fromModel);
const conversion = {};
const models = Object.keys(graph);
for (let len = models.length, i = 0; i < len; i++) {
const toModel = models[i];
const node = graph[toModel];
if (node.parent === null) {
// No possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};

Some files were not shown because too many files have changed in this diff Show More