How to use the util.inherits 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 mgcrea / generator-angular-component / app / index.js View on Github external
global.d.apply(null, arguments);
  util.log((new Error()).stack);
  process.exit(1);
};

var Generator = module.exports = function Generator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.on('end', function () {
    this.installDependencies({ skipInstall: options['skip-install'] });
  });

  this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(Generator, yeoman.generators.Base);

Generator.prototype.askFor = function askFor() {
  var done = this.async();

  // Have Yeoman greet the user.
  console.log(this.yeoman);

  // var props = this.props = {
  //   ngVersion: '~1.2.10',
  //   locale: 'fr',
  //   ngModules: ['animate', 'cookies', 'route', 'sanitize'],
  //   components: ['bootstrap:~3.1.0', 'angular-strap:~2.0.0', 'font-awesome:~4.0.0'],
  //   cssPreprocessor: 'less',
  //   supportLegacy: 'yes',
  //   name: path.basename(process.env.PWD),
  //   license: 'MIT',
github alex-shpak / keemob / node_modules / cordova-android / bin / templates / cordova / lib / builders / GradleBuilder.js View on Github external
var GenericBuilder = require('./GenericBuilder');

var MARKER = 'YOUR CHANGES WILL BE ERASED!';
var SIGNING_PROPERTIES = '-signing.properties';
var TEMPLATE =
    '# This file is automatically generated.\n' +
    '# Do not modify this file -- ' + MARKER + '\n';

function GradleBuilder (projectRoot) {
    GenericBuilder.call(this, projectRoot);

    this.binDirs = { gradle: this.binDirs.gradle };
}

util.inherits(GradleBuilder, GenericBuilder);

GradleBuilder.prototype.getArgs = function (cmd, opts) {
    if (cmd === 'release') {
        cmd = 'cdvBuildRelease';
    } else if (cmd === 'debug') {
        cmd = 'cdvBuildDebug';
    }
    var args = [cmd, '-b', path.join(this.root, 'build.gradle')];
    if (opts.arch) {
        args.push('-PcdvBuildArch=' + opts.arch);
    }

    // 10 seconds -> 6 seconds
    args.push('-Dorg.gradle.daemon=true');
    // to allow dex in process
    args.push('-Dorg.gradle.jvmargs=-Xmx2048m');
github brave / ethereum-remote-client / old-ui / app / first-time / init-menu.js View on Github external
const inherits = require('util').inherits
const EventEmitter = require('events').EventEmitter
const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const Mascot = require('../components/mascot')
const actions = require('../../../ui/app/actions')
const Tooltip = require('../components/tooltip')
const getCaretCoordinates = require('textarea-caret')

module.exports = connect(mapStateToProps)(InitializeMenuScreen)

inherits(InitializeMenuScreen, Component)
function InitializeMenuScreen () {
  Component.call(this)
  this.animationEventEmitter = new EventEmitter()
}

function mapStateToProps (state) {
  return {
    // state from plugin
    currentView: state.appState.currentView,
    warning: state.appState.warning,
  }
}

InitializeMenuScreen.prototype.render = function () {
  var state = this.props
github SeydX / homebridge-fritz-platform / src / types / types.js View on Github external
};
    inherits(Characteristic.WifiTwo, Characteristic);
    Characteristic.WifiTwo.UUID = '0026e147-5d51-4f42-b157-6aca6050be8e';
    
    /// /////////////////////////////////////////////////////////////////////////
    // WifiFive Characteristic
    /// /////////////////////////////////////////////////////////////////////////
    Characteristic.WifiFive = function() {
      Characteristic.call(this, 'WIFI 5GHZ', 'a72aeeca-c6ce-45ce-b026-5d400aab5fc9');
      this.setProps({
        format: Characteristic.Formats.BOOL,
        perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
      });
      this.value = this.getDefaultValue();
    };
    inherits(Characteristic.WifiFive, Characteristic);
    Characteristic.WifiFive.UUID = 'a72aeeca-c6ce-45ce-b026-5d400aab5fc9';
    
    /// /////////////////////////////////////////////////////////////////////////
    // WifiGuest Characteristic
    /// /////////////////////////////////////////////////////////////////////////
    Characteristic.WifiGuest = function() {
      Characteristic.call(this, 'WIFI Guest', 'a87bbf2b-885c-4713-8169-22abdbf0b2a1');
      this.setProps({
        format: Characteristic.Formats.BOOL,
        perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
      });
      this.value = this.getDefaultValue();
    };
    inherits(Characteristic.WifiGuest, Characteristic);
    Characteristic.WifiGuest.UUID = 'a87bbf2b-885c-4713-8169-22abdbf0b2a1';
github adrai / node-eventstore / lib / eventstore.js View on Github external
/**
 * Eventstore constructor
 * @param {Object} options The options.
 * @param {Store}  store   The db implementation.
 * @constructor
 */
function Eventstore(options, store) {
  this.options = options || {};
  this.store = store;

  this.eventMappings = {};

  EventEmitter.call(this);
}

util.inherits(Eventstore, EventEmitter);

_.extend(Eventstore.prototype, {

  /**
   * Inject function for event publishing.
   * @param {Function} fn the function to be injected
   * @returns {Eventstore}  to be able to chain...
   */
  useEventPublisher: function (fn) {
    if (fn.length === 1) {
      fn = _.wrap(fn, function(func, evt, callback) {
        func(evt);
        callback(null);
      });
    }
github clehner / node-vim-netbeans / lib / vim-server.js View on Github external
var util = require('util'),
	net = require('net'),
	EventEmitter = require('events').EventEmitter,
	VimClient = require('./vim-client');

function VimServer(opt) {
	this.debug = opt && !!opt.debug;
	this.clients = [];
	this.server = net.createServer(this._onConnection.bind(this));
}
util.inherits(VimServer, EventEmitter);

VimServer.defaultPassword = 'changeme';
VimServer.defaultPort = 3219;

VimServer.prototype.listen = function listen(port/*, host, backlog, callback*/) {
	var args = Array.prototype.slice.call(listen.arguments);
	if (isNaN(port)) {
		args.unshift(VimServer.defaultPort);
	}
	this.server.listen.apply(this.server, args);
};

VimServer.prototype.handleHTTP = function (server) {
	this.httpServer = server;
};
github tmiw / postShuffle / Controller / User.js View on Github external
module.exports = (function() {
    /**
     * Creates new Controller object.
     * @param {Object} app Express app object.
     * @return {Object} The new object.
     */
    var User = function(app) {
        User.super_.call(this, app);
    };
    
    util.inherits(User, ControllerBase);
    
    /**
     * Links controller's routes to application.
     */
    User.prototype.link_routes = function() {        
        this.__app.get("/user/login", this.json(this.login));
        this.__app.post("/user/register", this.json(this.register));
        this.__app.post("/user/reset_password", this.json(this.reset_password));
        this.__app.post("/user/title", this.json(this.change_title));
        this.__app.post("/user/set_profile", this.json(this.set_profile));
        this.__app.get("/user/logout", this.logout);
        this.__app.get(/^\/user\/confirm\/([A-Fa-f0-9\-]+)$/, this.confirm_register);
    };
    
    /**
     * Confirms user registration.
github joyent / node-verror / lib / verror.js View on Github external
* only deal with one error.  Callers can extract the individual errors
 * contained in this object, but may also just treat it as a normal single
 * error, in which case a summary message will be printed.
 */
function MultiError(errors)
{
	mod_assertplus.array(errors, 'list of errors');
	mod_assertplus.ok(errors.length > 0, 'must be at least one error');
	this.ase_errors = errors;

	VError.call(this, {
	    'cause': errors[0]
	}, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's');
}

mod_util.inherits(MultiError, VError);
MultiError.prototype.name = 'MultiError';

MultiError.prototype.errors = function me_errors()
{
	return (this.ase_errors.slice(0));
};


/*
 * See README.md for reference details.
 */
function WError()
{
	var args, obj, parsed, options;

	args = Array.prototype.slice.call(arguments, 0);
github flatiron / union / examples / simple / middleware / gzip-encode.js View on Github external
* Accepts a writable stream, i.e. fs.WriteStream, and returns a StreamStack
 * whose 'write()' calls are transparently sent to a 'gzip' process before
 * being written to the target stream.
 */
var GzipEncode = module.exports = function GzipEncode(options) {
  ResponseStream.call(this, options);

  if (compression) {
    process.assert(compression >= 1 && compression <= 9);
    this.compression = compression;
  }

  this.on('pipe', this.encode);
}

util.inherits(GzipEncode, ResponseStream);

GzipEncode.prototype.encode = function (source) {
  this.source = source;
};

GzipEncode.prototype.pipe = function (dest) {
  if (!this.source) {
    throw new Error('GzipEncode is only pipeable once it has been piped to');
  }
  
  this.encoder = spawn('gzip', ['-'+this.compression]);
  this.encoder.stdout.pipe(dest);
  this.encoder.stdin.pipe(this.source);
};

inherits(GzipEncoderStack, StreamStack);
github FredrikNoren / ungit / components / graph / git-graph-actions.js View on Github external
}

GraphActions.Merge = function(graph, node) {
  var self = this;
  GraphActions.ActionBase.call(this, graph);
  this.node = node;
  this.mergeWith = ko.observable(this.node);
  this.visible = ko.computed(function() {
    if (self.performProgressBar.running()) return true;
    if (!self.graph.checkedOutRef() || !self.graph.checkedOutRef().node()) return false;
    return self.graph.currentActionContext() instanceof RefViewModel &&
      !self.graph.currentActionContext().current() &&
      self.graph.checkedOutRef().node() == self.node;
  });
}
inherits(GraphActions.Merge, GraphActions.ActionBase);
GraphActions.Merge.prototype.text = 'Merge';
GraphActions.Merge.prototype.style = 'merge';
GraphActions.Merge.prototype.createHoverGraphic = function() {
  var node = this.graph.currentActionContext();
  if (!node) return null;
  if (node instanceof RefViewModel) node = node.node();
  return new MergeViewModel(this.graph, this.node, node);
}
GraphActions.Merge.prototype.perform = function(callback) {
  this.server.post('/merge', { path: this.graph.repoPath, with: this.graph.currentActionContext().localRefName }, function(err) {
    callback();
    if (err && err.errorCode == 'merge-failed') return true;
  });
}

GraphActions.Push = function(graph, node) {