!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/local/lib/node_modules/strapi/node_modules/captains-log/test/standalone/   drwxr-xr-x
Free 13.1 GB of 57.97 GB (22.6%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     bind-all-to.js (2.05 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/**
 * Module dependencies
 */

var _ = require('@sailshq/lodash');



/**
 * Bind the context (i.e. set the `this` value) of all function
 * properties of `obj` to `newCtx`. Note that this modifies `obj`
 * in-place, and the return value === `obj`.
 *
 * @param  {Object} obj
 * @param  {Object} newCtx
 * @return {undefined}
 *
 * ----------------------------------------------------------------
 * Note:
 *
 * e.g.
 *
 * ```
 * var _bindAllTo = require('bind-all-to');
 * var card = {
 *   spend: function (amt){
 *     this.bankAccount -= amt;
 *     return this.bankAccount;
 *   }
 * };
 *
 * // Let's say we give Mike the debit card.
 * var mike = {
 *   bankAccount: 15
 * };
 * mike.debitCard = card;
 *
 * // By default, JavaScript will assume `this` refers to
 * // the card itself. This is no good, because this isn't
 * // a card with a built-in balance-- it needs to be tied
 * // to a entity with a proper `bankAccount`.
 * mike.debitCard.spend(50)
 * // -> NaN === (undefined - 50) === (card.bankAccount - 50)
 *
 * // So next, we might try using underscore's `_.bindAll`,
 * // and attaching the `spend` method to mike directly.
 * // This will make JavaScript think the `this` in the spend
 * // method refers to him.
 * mike.spend = mike.debitCard.spend;
 * mike = _.bindAll(mike);
 * mike.spend(50)
 *
 * // But unfortunately, he doesn't have any money:
 * // -> -35 === (15 - 50) === (mike.bankAccount - 50)
 *
 *
 * // Anyway, it was awkward to give him the `spend` method directly-
 * // plus, if we want to have any luck actually spending money, we'll
 * // need to connect the card to the company bank account.
 * var balderdash = { bankAccount: 100000 };
 *
 * // To do this, we need `bind-all-to`:
 * _bindAllTo(mike.card, balderdash);
 *
 * // Now when we spend from the card, the amount is subtracted
 * // from the `bankAccount` property of `balderdash`:
 * mike.card.spend(50)
 * // -> 99950
 * ```
 *
 */
module.exports = function _bindAllTo(obj, newCtx) {

  _(obj).functions().each(function(key) {
    obj[key] = _.bind(obj[key], newCtx);
  });

  return obj;
};

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0051 ]--