How to use the util.deprecate function in util

To help you get started, we’ve selected a few util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joshlobaptista / Barista-Fullstack / node_modules / mongoose / lib / query.js View on Github external
*     var stream = Thing.find().stream({ transform: JSON.stringify });
 *     stream.pipe(writeStream);
 *
 * @return {QueryStream}
 * @param {Object} [options]
 * @see QueryStream
 * @api public
 */

Query.prototype.stream = function stream(opts) {
  this._applyPaths();
  this._fields = this._castFields(this._fields);
  this._castConditions();
  return new QueryStream(this, opts);
};
Query.prototype.stream = util.deprecate(Query.prototype.stream, 'Mongoose: ' +
  'Query.prototype.stream() is deprecated in mongoose >= 4.5.0, ' +
  'use Query.prototype.cursor() instead');

/**
 * Returns a wrapper around a [mongodb driver cursor](http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html).
 * A QueryCursor exposes a [Streams3](https://strongloop.com/strongblog/whats-new-io-js-beta-streams3/)-compatible
 * interface, as well as a `.next()` function.
 *
 * The `.cursor()` function triggers pre find hooks, but **not** post find hooks.
 *
 * ####Example
 *
 *     // There are 2 ways to use a cursor. First, as a stream:
 *     Thing.
 *       find({ name: /^hello/ }).
 *       cursor().
github M0nica / React-Ladies / node_modules / webpack / lib / Compilation.js View on Github external
const chunk = chunks[indexChunk];
			if (chunks.indexOf(chunk) !== indexChunk) {
				throw new Error(
					`checkConstraints: duplicate chunk in compilation ${chunk.debugId}`
				);
			}
		}

		for (const chunkGroup of this.chunkGroups) {
			chunkGroup.checkConstraints();
		}
	}
}

// TODO remove in webpack 5
Compilation.prototype.applyPlugins = util.deprecate(function(name, ...args) {
	this.hooks[
		name.replace(/[- ]([a-z])/g, match => match[1].toUpperCase())
	].call(...args);
}, "Compilation.applyPlugins is deprecated. Use new API on `.hooks` instead");

// TODO remove in webpack 5
Object.defineProperty(Compilation.prototype, "moduleTemplate", {
	configurable: false,
	get: util.deprecate(function() {
		return this.moduleTemplates.javascript;
	}, "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead"),
	set: util.deprecate(function(value) {
		this.moduleTemplates.javascript = value;
	}, "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead.")
});
github twilio / twilio-node / lib / twiml / VoiceResponse.js View on Github external
*
 * @function ssmlSayAs
 * @memberof Say#
 * @deprecated - Use sayAs() instead.
 *
 * @param {object} attributes - TwiML attributes
 * @param {ssml_say_as.interpret_as} [attributes.interpret-
 *         as] - Specify the type of words are spoken
 * @param {ssml_say_as.role} [attributes.role] -
 *          Specify the format of the date when interpret-as is set to date
 * @param {string} words - Words to be interpreted
 *
 * @returns SsmlSayAs
 */
/* jshint ignore:end */
Say.prototype.ssmlSayAs = util.deprecate(function ssmlSayAs(attributes, words) {
  return this.sayAs(attributes, words);
}, 'ssmlSayAs() is deprecated. Use sayAs() instead.');

/* jshint ignore:start */
/**
 * Pronouncing Acronyms and Abbreviations in 
 *
 * @function sub
 * @memberof Say#
 *
 * @param {object} attributes - TwiML attributes
 * @param {string} [attributes.alias] -
 *          Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
 * @param {string} words - Words to be substituted
 *
 * @returns SsmlSub
github typegoose / typegoose / src / typegoose.ts View on Github external
constructor() {
    // tslint:disable-next-line:no-empty
    deprecate(() => { }, 'Typegoose Class is Deprecated!')();
  }
github jake-101 / bael-template / node_modules / webpack / lib / ContextModule.js View on Github external
configurable: false,
	get: util.deprecate(function() {
		return this.options.addon;
	}, "ContextModule.addon has been moved to ContextModule.options.addon"),
	set: util.deprecate(function(value) {
		this.options.addon = value;
	}, "ContextModule.addon has been moved to ContextModule.options.addon")
});

// TODO remove in webpack 5
Object.defineProperty(ContextModule.prototype, "async", {
	configurable: false,
	get: util.deprecate(function() {
		return this.options.mode;
	}, "ContextModule.async has been moved to ContextModule.options.mode"),
	set: util.deprecate(function(value) {
		this.options.mode = value;
	}, "ContextModule.async has been moved to ContextModule.options.mode")
});

// TODO remove in webpack 5
Object.defineProperty(ContextModule.prototype, "chunkName", {
	configurable: false,
	get: util.deprecate(function() {
		return this.options.chunkName;
	}, "ContextModule.chunkName has been moved to ContextModule.options.chunkName"),
	set: util.deprecate(function(value) {
		this.options.chunkName = value;
	}, "ContextModule.chunkName has been moved to ContextModule.options.chunkName")
});

module.exports = ContextModule;
github jake-101 / bael-template / node_modules / webpack / lib / Compilation.js View on Github external
chunkGroup.checkConstraints();
		}
	}
}

// TODO remove in webpack 5
Compilation.prototype.applyPlugins = util.deprecate(function(name, ...args) {
	this.hooks[
		name.replace(/[- ]([a-z])/g, match => match[1].toUpperCase())
	].call(...args);
}, "Compilation.applyPlugins is deprecated. Use new API on `.hooks` instead");

// TODO remove in webpack 5
Object.defineProperty(Compilation.prototype, "moduleTemplate", {
	configurable: false,
	get: util.deprecate(function() {
		return this.moduleTemplates.javascript;
	}, "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead"),
	set: util.deprecate(function(value) {
		this.moduleTemplates.javascript = value;
	}, "Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead.")
});

module.exports = Compilation;
github eschirtz / Computer-Science-Series / node_modules / webpack / lib / Compilation.js View on Github external
// TODO remove in webpack 5
Object.defineProperty(Compilation.prototype, "moduleTemplate", {
	configurable: false,
	get: util.deprecate(
		/**
		 * @deprecated
		 * @this {Compilation}
		 * @returns {TODO} module template
		 */
		function() {
			return this.moduleTemplates.javascript;
		},
		"Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead"
	),
	set: util.deprecate(
		/**
		 * @deprecated
		 * @param {ModuleTemplate} value Template value
		 * @this {Compilation}
		 * @returns {void}
		 */
		function(value) {
			this.moduleTemplates.javascript = value;
		},
		"Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead."
	)
});

module.exports = Compilation;
github OpenZeppelin / openzeppelin-test-helpers / src / expectEvent.js View on Github external
return 'events' in receipt && typeof receipt.events === 'object';
}

function isTruffleReceipt (receipt) {
  return 'logs' in receipt && typeof receipt.logs === 'object';
}

function isWeb3Contract (contract) {
  return 'options' in contract && typeof contract.options === 'object';
}

function isTruffleContract (contract) {
  return 'abi' in contract && typeof contract.abi === 'object';
}

expectEvent.inLogs = deprecate(inLogs, 'expectEvent.inLogs() is deprecated. Use expectEvent() instead.');
expectEvent.inConstruction = inConstruction;
expectEvent.inTransaction = inTransaction;
module.exports = expectEvent;
github OldSneerJaw / synctos / etc / validation-error-message-formatter.js View on Github external
exports.hashtableMinimumSizeViolation = deprecate(errorFormatter.hashtableMinimumSizeViolation, deprecationMessage);
exports.immutableDocViolation = deprecate(errorFormatter.immutableDocViolation, deprecationMessage);
exports.immutableItemViolation = deprecate(errorFormatter.immutableItemViolation, deprecationMessage);
exports.maximumAttachmentCountViolation = deprecate(errorFormatter.maximumAttachmentCountViolation, deprecationMessage);
exports.maximumIndividualAttachmentSizeViolation =
  deprecate(errorFormatter.maximumIndividualAttachmentSizeViolation, deprecationMessage);
exports.maximumLengthViolation = deprecate(errorFormatter.maximumLengthViolation, deprecationMessage);
exports.maximumSizeAttachmentViolation = deprecate(errorFormatter.maximumSizeAttachmentViolation, deprecationMessage);
exports.maximumTotalAttachmentSizeViolation = deprecate(errorFormatter.maximumTotalAttachmentSizeViolation, deprecationMessage);
exports.maximumValueViolation = deprecate(errorFormatter.maximumValueViolation, deprecationMessage);
exports.maximumValueExclusiveViolation = deprecate(errorFormatter.maximumValueExclusiveViolation, deprecationMessage);
exports.minimumLengthViolation = deprecate(errorFormatter.minimumLengthViolation, deprecationMessage);
exports.minimumValueViolation = deprecate(errorFormatter.minimumValueViolation, deprecationMessage);
exports.minimumValueExclusiveViolation = deprecate(errorFormatter.minimumValueExclusiveViolation, deprecationMessage);
exports.mustNotBeEmptyViolation = deprecate(errorFormatter.mustNotBeEmptyViolation, deprecationMessage);
exports.regexPatternHashtableKeyViolation = deprecate(errorFormatter.regexPatternHashtableKeyViolation, deprecationMessage);
exports.regexPatternItemViolation = deprecate(errorFormatter.regexPatternItemViolation, deprecationMessage);
exports.requireAttachmentReferencesViolation = deprecate(errorFormatter.requireAttachmentReferencesViolation, deprecationMessage);
exports.requiredValueViolation = deprecate(errorFormatter.requiredValueViolation, deprecationMessage);
exports.supportedContentTypesAttachmentReferenceViolation =
  deprecate(errorFormatter.supportedContentTypesAttachmentReferenceViolation, deprecationMessage);
exports.supportedContentTypesAttachmentViolation =
  deprecate(errorFormatter.supportedContentTypesAttachmentReferenceViolation, deprecationMessage);
exports.supportedContentTypesRawAttachmentViolation =
  deprecate(errorFormatter.supportedContentTypesRawAttachmentViolation, deprecationMessage);
exports.supportedExtensionsAttachmentReferenceViolation =
  deprecate(errorFormatter.supportedExtensionsAttachmentReferenceViolation, deprecationMessage);
exports.supportedExtensionsAttachmentViolation =
  deprecate(errorFormatter.supportedExtensionsAttachmentReferenceViolation, deprecationMessage);
exports.supportedExtensionsRawAttachmentViolation =
  deprecate(errorFormatter.supportedExtensionsRawAttachmentViolation, deprecationMessage);
exports.typeConstraintViolation = deprecate(errorFormatter.typeConstraintViolation, deprecationMessage);