[Pkg-javascript-commits] [node-ansi-styles] 01/10: Imported Upstream version 2.2.1

Mathias Behrle mbehrle at moszumanska.debian.org
Sat Jul 23 13:41:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

mbehrle pushed a commit to branch master
in repository node-ansi-styles.

commit 43d896f50ce08d26c8e9f7084d05943879a55002
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Jul 18 14:28:06 2016 +0200

    Imported Upstream version 2.2.1
---
 .editorconfig |   3 +-
 .jshintrc     |   4 ---
 index.js      | 111 +++++++++++++++++++++++++++++++---------------------------
 package.json  |  10 +++---
 readme.md     |   6 ++--
 test.js       |   7 ++++
 6 files changed, 76 insertions(+), 65 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index 8311fe1..8f9d77e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,4 +1,3 @@
-# editorconfig.org
 root = true
 
 [*]
@@ -8,7 +7,7 @@ charset = utf-8
 trim_trailing_whitespace = true
 insert_final_newline = true
 
-[package.json]
+[{package.json,*.yml}]
 indent_style = space
 indent_size = 2
 
diff --git a/.jshintrc b/.jshintrc
index c511975..9fe1be2 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -2,14 +2,10 @@
 	"node": true,
 	"esnext": true,
 	"bitwise": true,
-	"camelcase": true,
 	"curly": true,
-	"eqeqeq": true,
 	"immed": true,
-	"indent": 4,
 	"newcap": true,
 	"noarg": true,
-	"quotmark": "single",
 	"undef": true,
 	"unused": "vars",
 	"strict": true
diff --git a/index.js b/index.js
index caf9e11..7894527 100644
--- a/index.js
+++ b/index.js
@@ -1,56 +1,65 @@
 'use strict';
 
-var styles = module.exports = {
-	modifiers: {
-		reset: [0, 0],
-		bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
-		dim: [2, 22],
-		italic: [3, 23],
-		underline: [4, 24],
-		inverse: [7, 27],
-		hidden: [8, 28],
-		strikethrough: [9, 29]
-	},
-	colors: {
-		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]
-	},
-	bgColors: {
-		bgBlack: [40, 49],
-		bgRed: [41, 49],
-		bgGreen: [42, 49],
-		bgYellow: [43, 49],
-		bgBlue: [44, 49],
-		bgMagenta: [45, 49],
-		bgCyan: [46, 49],
-		bgWhite: [47, 49]
-	}
-};
-
-// fix humans
-styles.colors.grey = styles.colors.gray;
-
-Object.keys(styles).forEach(function (groupName) {
-	var group = styles[groupName];
-
-	Object.keys(group).forEach(function (styleName) {
-		var style = group[styleName];
-
-		styles[styleName] = group[styleName] = {
-			open: '\u001b[' + style[0] + 'm',
-			close: '\u001b[' + style[1] + 'm'
-		};
-	});
+function assembleStyles () {
+	var styles = {
+		modifiers: {
+			reset: [0, 0],
+			bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
+			dim: [2, 22],
+			italic: [3, 23],
+			underline: [4, 24],
+			inverse: [7, 27],
+			hidden: [8, 28],
+			strikethrough: [9, 29]
+		},
+		colors: {
+			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]
+		},
+		bgColors: {
+			bgBlack: [40, 49],
+			bgRed: [41, 49],
+			bgGreen: [42, 49],
+			bgYellow: [43, 49],
+			bgBlue: [44, 49],
+			bgMagenta: [45, 49],
+			bgCyan: [46, 49],
+			bgWhite: [47, 49]
+		}
+	};
+
+	// fix humans
+	styles.colors.grey = styles.colors.gray;
+
+	Object.keys(styles).forEach(function (groupName) {
+		var group = styles[groupName];
+
+		Object.keys(group).forEach(function (styleName) {
+			var style = group[styleName];
 
-	Object.defineProperty(styles, groupName, {
-		value: group,
-		enumerable: false
+			styles[styleName] = group[styleName] = {
+				open: '\u001b[' + style[0] + 'm',
+				close: '\u001b[' + style[1] + 'm'
+			};
+		});
+
+		Object.defineProperty(styles, groupName, {
+			value: group,
+			enumerable: false
+		});
 	});
+
+	return styles;
+}
+
+Object.defineProperty(module, 'exports', {
+	enumerable: true,
+	get: assembleStyles
 });
diff --git a/package.json b/package.json
index 5014fd5..78c535f 100644
--- a/package.json
+++ b/package.json
@@ -1,17 +1,17 @@
 {
   "name": "ansi-styles",
-  "version": "2.0.1",
+  "version": "2.2.1",
   "description": "ANSI escape codes for styling strings in the terminal",
   "license": "MIT",
-  "repository": "sindresorhus/ansi-styles",
+  "repository": "chalk/ansi-styles",
   "author": {
     "name": "Sindre Sorhus",
     "email": "sindresorhus at gmail.com",
-    "url": "http://sindresorhus.com"
+    "url": "sindresorhus.com"
   },
   "maintainers": [
-    "Sindre Sorhus <sindresorhus at gmail.com> (http://sindresorhus.com)",
-    "Joshua Appelman <jappelman at xebia.com> (http://jbnicolai.com)"
+    "Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)",
+    "Joshua Appelman <jappelman at xebia.com> (jbnicolai.com)"
   ],
   "engines": {
     "node": ">=0.10.0"
diff --git a/readme.md b/readme.md
index 89ec6a7..3f933f6 100644
--- a/readme.md
+++ b/readme.md
@@ -1,15 +1,15 @@
-# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles)
+# 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
 
-You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.
+You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
 
 ![](screenshot.png)
 
 
 ## Install
 
-```sh
+```
 $ npm install --save ansi-styles
 ```
 
diff --git a/test.js b/test.js
index 185a8cc..5e17462 100644
--- a/test.js
+++ b/test.js
@@ -33,3 +33,10 @@ it('should group related codes into categories', function () {
 it('groups should not be enumerable', function () {
 	assert.equal(Object.keys(ansi).indexOf('modifiers'), -1);
 });
+
+it('should not pollute other objects', function () {
+	var obj1 = require('./');
+	var obj2 = require('./');
+	obj1.foo = true;
+	assert.notEqual(obj1.foo, obj2.foo);
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ansi-styles.git



More information about the Pkg-javascript-commits mailing list