Skip to content

Instantly share code, notes, and snippets.

@arunoda

arunoda/utils.js Secret

Created December 25, 2016 10:23
Show Gist options
  • Save arunoda/dfcc495a78cd907d008634ab4e67bb35 to your computer and use it in GitHub Desktop.
Save arunoda/dfcc495a78cd907d008634ab4e67bb35 to your computer and use it in GitHub Desktop.
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _assign = require('babel-runtime/core-js/object/assign');
var _assign2 = _interopRequireDefault(_assign);
exports.warn = warn;
exports.deprecated = deprecated;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function warn(message) {
if (process.env.NODE_ENV !== 'production') {
console.error(message);
}
}
function deprecated(fn, message) {
if (process.env.NODE_ENV === 'production') return fn;
var warned = false;
var newFn = function newFn() {
if (!warned) {
warned = true;
console.error(message);
}
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return fn.apply(this, args);
};
// copy all properties
(0, _assign2.default)(newFn, fn);
return newFn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment