You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
421 B
19 lines
421 B
const co = require('./lib/color'); |
|
|
|
exports = module.exports = co; |
|
|
|
function toxic() { |
|
// 在String原型上扩展 |
|
// 不建议在原型对象上扩展 |
|
var colors = exports.color; |
|
Object.keys(colors).forEach(function (key) { |
|
var fn = colors[key]; |
|
Object.defineProperty(String.prototype, key, { |
|
get: function () { |
|
return fn(this.valueOf()); |
|
} |
|
}); |
|
}); |
|
}; |
|
|
|
module.exports = toxic(); |