Skip to content

Commit

Permalink
standardise native bold function too
Browse files Browse the repository at this point in the history
  • Loading branch information
pemrouz committed Jul 2, 2015
1 parent 13c7564 commit 32113b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions index.js
@@ -1,15 +1,18 @@
var client = require('client')
, colors = require('colors')
, colors = !client && require('colors')
, has = require('has')
, is = require('is')

module.exports = colorfill()

function colorfill(){
/* istanbul ignore next */
client && ['red', 'green', 'bold', 'grey', 'strip'].forEach(function(color) {
('')[color] !== '' && Object.defineProperty(String.prototype, color, {
get: function () {
['red', 'green', 'bold', 'grey', 'strip'].forEach(function(color) {
!is.str(String.prototype[color]) && Object.defineProperty(String.prototype, color, {
get: function() {
return String(this)
}
}
})
})
}

4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -18,6 +18,8 @@
},
"dependencies": {
"client": "git+https://github.com/utilise/client.git",
"colors": "^1.1.0"
"colors": "^1.1.0",
"has": "git+https://github.com/utilise/has.git",
"is": "git+https://github.com/utilise/is.git"
}
}
1 change: 0 additions & 1 deletion test.js
@@ -1,5 +1,4 @@
var expect = require('chai').expect
, client = require('client')
, colorfill = require('./')

describe('colorfill', function() {
Expand Down

0 comments on commit 32113b1

Please sign in to comment.