Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / i / lib / native.js
1 module.exports = function (obj) {
2
3   var addProperty = function (method, func) {
4     String.prototype.__defineGetter__(method, func);
5   }
6
7   var stringPrototypeBlacklist = [
8     '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
9     'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
10     'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
11     'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'gsub'
12   ];
13
14   Object.keys(obj).forEach(function (key) {
15     if (key != 'inflect' && key != 'inflections') {
16       if (stringPrototypeBlacklist.indexOf(key) !== -1) {
17         console.log('warn: You should not override String.prototype.' + key);
18       } else {
19         addProperty(key, function () {
20           return obj[key](this);
21         });
22       }
23     }
24   });
25
26 }