mirror of
https://github.com/flynx/colors.js.git
synced 2025-11-01 12:30:14 +00:00
[fix] Removed Object.define property entirely
This commit is contained in:
parent
c0bc636d4d
commit
38db25ad14
13
colors.js
13
colors.js
@ -48,20 +48,9 @@ var addProperty = function (color, func) {
|
|||||||
exports[color] = function (str) {
|
exports[color] = function (str) {
|
||||||
return func.apply(str);
|
return func.apply(str);
|
||||||
};
|
};
|
||||||
|
String.prototype.__defineGetter__(color, func);
|
||||||
if (Object.defineProperty) {
|
|
||||||
Object.defineProperty(String.prototype, color, {
|
|
||||||
get : func,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
String.prototype.__defineGetter__(color, func);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function stylize(str, style) {
|
function stylize(str, style) {
|
||||||
|
|
||||||
var styles;
|
var styles;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user