code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
// { dg-require-namedlocale "ja_JP.eucjp" } // { dg-require-namedlocale "de_DE" } // { dg-require-namedlocale "en_HK" } // 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> // Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. // 22.2.4.1.1 collate members #include <testsuite_hooks.h> #define main discard_main_1 #include "1.cc" #undef main #define main discard_main_2 #include "2.cc" #undef main #define main discard_main_3 #include "3.cc" #undef main int main() { using namespace __gnu_test; func_callback two; two.push_back(&test01); two.push_back(&test02); two.push_back(&test03); run_tests_wrapped_locale("ja_JP.eucjp", two); return 0; }
SanDisk-Open-Source/SSD_Dashboard
uefi/gcc/gcc-4.6.3/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc
C++
gpl-2.0
1,387
/* * Copyright 2012-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package sample.testng.service; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class HelloWorldService { @Value("${name:World}") private String name; public String getHelloMessage() { return "Hello " + this.name; } }
rokn/Count_Words_2015
testing/spring-boot-master/spring-boot-samples/spring-boot-sample-testng/src/main/java/sample/testng/service/HelloWorldService.java
Java
mit
928
<?php namespace Codeception\Exception; class ExtensionException extends \Exception { public function __construct($extension, $message, \Exception $previous = null) { parent::__construct($message, $previous); if (is_object($extension)) { $extension = get_class($extension); } $this->message = $extension . "\n\n" . $this->message; } }
yeqingwen/Yii2_PHP7_Redis
yii2/vendor/codeception/base/src/Codeception/Exception/ExtensionException.php
PHP
apache-2.0
391
/* YUI 3.17.1 (build 0eb5a52) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('event-custom-base', function (Y, NAME) { /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom */ Y.Env.evt = { handles: {}, plugins: {} }; /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ /** * Allows for the insertion of methods that are executed before or after * a specified method * @class Do * @static */ var DO_BEFORE = 0, DO_AFTER = 1, DO = { /** * Cache of objects touched by the utility * @property objs * @static * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object * replaces the role of this property, but is considered to be private, and * is only mentioned to provide a migration path. * * If you have a use case which warrants migration to the _yuiaop property, * please file a ticket to let us know what it's used for and we can see if * we need to expose hooks for that functionality more formally. */ objs: null, /** * <p>Execute the supplied method before the specified function. Wrapping * function may optionally return an instance of the following classes to * further alter runtime behavior:</p> * <dl> * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> * <dd>Immediatly stop execution and return * <code>returnValue</code>. No other wrapping functions will be * executed.</dd> * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt> * <dd>Replace the arguments that the original function will be * called with.</dd> * <dt></code>Y.Do.Prevent(message)</code></dt> * <dd>Don't execute the wrapped function. Other before phase * wrappers will be executed.</dd> * </dl> * * @method before * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @param arg* {mixed} 0..n additional arguments to supply to the subscriber * when the event fires. * @return {EventHandle} handle for the subscription * @static */ before: function(fn, obj, sFn, c) { // Y.log('Do before: ' + sFn, 'info', 'event'); var f = fn, a; if (c) { a = [fn, c].concat(Y.Array(arguments, 4, true)); f = Y.rbind.apply(Y, a); } return this._inject(DO_BEFORE, f, obj, sFn); }, /** * <p>Execute the supplied method after the specified function. Wrapping * function may optionally return an instance of the following classes to * further alter runtime behavior:</p> * <dl> * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> * <dd>Immediatly stop execution and return * <code>returnValue</code>. No other wrapping functions will be * executed.</dd> * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt> * <dd>Return <code>returnValue</code> instead of the wrapped * method's original return value. This can be further altered by * other after phase wrappers.</dd> * </dl> * * <p>The static properties <code>Y.Do.originalRetVal</code> and * <code>Y.Do.currentRetVal</code> will be populated for reference.</p> * * @method after * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @param arg* {mixed} 0..n additional arguments to supply to the subscriber * @return {EventHandle} handle for the subscription * @static */ after: function(fn, obj, sFn, c) { var f = fn, a; if (c) { a = [fn, c].concat(Y.Array(arguments, 4, true)); f = Y.rbind.apply(Y, a); } return this._inject(DO_AFTER, f, obj, sFn); }, /** * Execute the supplied method before or after the specified function. * Used by <code>before</code> and <code>after</code>. * * @method _inject * @param when {string} before or after * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @return {EventHandle} handle for the subscription * @private * @static */ _inject: function(when, fn, obj, sFn) { // object id var id = Y.stamp(obj), o, sid; if (!obj._yuiaop) { // create a map entry for the obj if it doesn't exist, to hold overridden methods obj._yuiaop = {}; } o = obj._yuiaop; if (!o[sFn]) { // create a map entry for the method if it doesn't exist o[sFn] = new Y.Do.Method(obj, sFn); // re-route the method to our wrapper obj[sFn] = function() { return o[sFn].exec.apply(o[sFn], arguments); }; } // subscriber id sid = id + Y.stamp(fn) + sFn; // register the callback o[sFn].register(sid, fn, when); return new Y.EventHandle(o[sFn], sid); }, /** * Detach a before or after subscription. * * @method detach * @param handle {EventHandle} the subscription handle * @static */ detach: function(handle) { if (handle.detach) { handle.detach(); } } }; Y.Do = DO; ////////////////////////////////////////////////////////////////////////// /** * Contains the return value from the wrapped method, accessible * by 'after' event listeners. * * @property originalRetVal * @static * @since 3.2.0 */ /** * Contains the current state of the return value, consumable by * 'after' event listeners, and updated if an after subscriber * changes the return value generated by the wrapped function. * * @property currentRetVal * @static * @since 3.2.0 */ ////////////////////////////////////////////////////////////////////////// /** * Wrapper for a displaced method with aop enabled * @class Do.Method * @constructor * @param obj The object to operate on * @param sFn The name of the method to displace */ DO.Method = function(obj, sFn) { this.obj = obj; this.methodName = sFn; this.method = obj[sFn]; this.before = {}; this.after = {}; }; /** * Register a aop subscriber * @method register * @param sid {string} the subscriber id * @param fn {Function} the function to execute * @param when {string} when to execute the function */ DO.Method.prototype.register = function (sid, fn, when) { if (when) { this.after[sid] = fn; } else { this.before[sid] = fn; } }; /** * Unregister a aop subscriber * @method delete * @param sid {string} the subscriber id * @param fn {Function} the function to execute * @param when {string} when to execute the function */ DO.Method.prototype._delete = function (sid) { // Y.log('Y.Do._delete: ' + sid, 'info', 'Event'); delete this.before[sid]; delete this.after[sid]; }; /** * <p>Execute the wrapped method. All arguments are passed into the wrapping * functions. If any of the before wrappers return an instance of * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped * function nor any after phase subscribers will be executed.</p> * * <p>The return value will be the return value of the wrapped function or one * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or * <code>Y.Do.AlterReturn</code>. * * @method exec * @param arg* {any} Arguments are passed to the wrapping and wrapped functions * @return {any} Return value of wrapped function unless overwritten (see above) */ DO.Method.prototype.exec = function () { var args = Y.Array(arguments, 0, true), i, ret, newRet, bf = this.before, af = this.after, prevented = false; // execute before for (i in bf) { if (bf.hasOwnProperty(i)) { ret = bf[i].apply(this.obj, args); if (ret) { switch (ret.constructor) { case DO.Halt: return ret.retVal; case DO.AlterArgs: args = ret.newArgs; break; case DO.Prevent: prevented = true; break; default: } } } } // execute method if (!prevented) { ret = this.method.apply(this.obj, args); } DO.originalRetVal = ret; DO.currentRetVal = ret; // execute after methods. for (i in af) { if (af.hasOwnProperty(i)) { newRet = af[i].apply(this.obj, args); // Stop processing if a Halt object is returned if (newRet && newRet.constructor === DO.Halt) { return newRet.retVal; // Check for a new return value } else if (newRet && newRet.constructor === DO.AlterReturn) { ret = newRet.newRetVal; // Update the static retval state DO.currentRetVal = ret; } } } return ret; }; ////////////////////////////////////////////////////////////////////////// /** * Return an AlterArgs object when you want to change the arguments that * were passed into the function. Useful for Do.before subscribers. An * example would be a service that scrubs out illegal characters prior to * executing the core business logic. * @class Do.AlterArgs * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param newArgs {Array} Call parameters to be used for the original method * instead of the arguments originally passed in. */ DO.AlterArgs = function(msg, newArgs) { this.msg = msg; this.newArgs = newArgs; }; /** * Return an AlterReturn object when you want to change the result returned * from the core method to the caller. Useful for Do.after subscribers. * @class Do.AlterReturn * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param newRetVal {any} Return value passed to code that invoked the wrapped * function. */ DO.AlterReturn = function(msg, newRetVal) { this.msg = msg; this.newRetVal = newRetVal; }; /** * Return a Halt object when you want to terminate the execution * of all subsequent subscribers as well as the wrapped method * if it has not exectued yet. Useful for Do.before subscribers. * @class Do.Halt * @constructor * @param msg {String} (optional) Explanation of why the termination was done * @param retVal {any} Return value passed to code that invoked the wrapped * function. */ DO.Halt = function(msg, retVal) { this.msg = msg; this.retVal = retVal; }; /** * Return a Prevent object when you want to prevent the wrapped function * from executing, but want the remaining listeners to execute. Useful * for Do.before subscribers. * @class Do.Prevent * @constructor * @param msg {String} (optional) Explanation of why the termination was done */ DO.Prevent = function(msg) { this.msg = msg; }; /** * Return an Error object when you want to terminate the execution * of all subsequent method calls. * @class Do.Error * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param retVal {any} Return value passed to code that invoked the wrapped * function. * @deprecated use Y.Do.Halt or Y.Do.Prevent */ DO.Error = DO.Halt; ////////////////////////////////////////////////////////////////////////// /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ // var onsubscribeType = "_event:onsub", var YArray = Y.Array, AFTER = 'after', CONFIGS = [ 'broadcast', 'monitored', 'bubbles', 'context', 'contextFn', 'currentTarget', 'defaultFn', 'defaultTargetOnly', 'details', 'emitFacade', 'fireOnce', 'async', 'host', 'preventable', 'preventedFn', 'queuable', 'silent', 'stoppedFn', 'target', 'type' ], CONFIGS_HASH = YArray.hash(CONFIGS), nativeSlice = Array.prototype.slice, YUI3_SIGNATURE = 9, YUI_LOG = 'yui:log', mixConfigs = function(r, s, ov) { var p; for (p in s) { if (CONFIGS_HASH[p] && (ov || !(p in r))) { r[p] = s[p]; } } return r; }; /** * The CustomEvent class lets you define events for your application * that can be subscribed to by one or more independent component. * * @param {String} type The type of event, which is passed to the callback * when the event fires. * @param {object} defaults configuration object. * @class CustomEvent * @constructor */ /** * The type of event, returned to subscribers when the event fires * @property type * @type string */ /** * By default all custom events are logged in the debug build, set silent * to true to disable debug outpu for this event. * @property silent * @type boolean */ Y.CustomEvent = function(type, defaults) { this._kds = Y.CustomEvent.keepDeprecatedSubs; this.id = Y.guid(); this.type = type; this.silent = this.logSystem = (type === YUI_LOG); if (this._kds) { /** * The subscribers to this event * @property subscribers * @type Subscriber {} * @deprecated */ /** * 'After' subscribers * @property afters * @type Subscriber {} * @deprecated */ this.subscribers = {}; this.afters = {}; } if (defaults) { mixConfigs(this, defaults, true); } }; /** * Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a> * and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance. * * These properties were changed to private properties (`_subscribers` and `_afters`), and * converted from objects to arrays for performance reasons. * * Setting this property to true will populate the deprecated `subscribers` and `afters` * properties for people who may be using them (which is expected to be rare). There will * be a performance hit, compared to the new array based implementation. * * If you are using these deprecated properties for a use case which the public API * does not support, please file an enhancement request, and we can provide an alternate * public implementation which doesn't have the performance cost required to maintiain the * properties as objects. * * @property keepDeprecatedSubs * @static * @for CustomEvent * @type boolean * @default false * @deprecated */ Y.CustomEvent.keepDeprecatedSubs = false; Y.CustomEvent.mixConfigs = mixConfigs; Y.CustomEvent.prototype = { constructor: Y.CustomEvent, /** * Monitor when an event is attached or detached. * * @property monitored * @type boolean */ /** * If 0, this event does not broadcast. If 1, the YUI instance is notified * every time this event fires. If 2, the YUI instance and the YUI global * (if event is enabled on the global) are notified every time this event * fires. * @property broadcast * @type int */ /** * Specifies whether this event should be queued when the host is actively * processing an event. This will effect exectution order of the callbacks * for the various events. * @property queuable * @type boolean * @default false */ /** * This event has fired if true * * @property fired * @type boolean * @default false; */ /** * An array containing the arguments the custom event * was last fired with. * @property firedWith * @type Array */ /** * This event should only fire one time if true, and if * it has fired, any new subscribers should be notified * immediately. * * @property fireOnce * @type boolean * @default false; */ /** * fireOnce listeners will fire syncronously unless async * is set to true * @property async * @type boolean * @default false */ /** * Flag for stopPropagation that is modified during fire() * 1 means to stop propagation to bubble targets. 2 means * to also stop additional subscribers on this target. * @property stopped * @type int */ /** * Flag for preventDefault that is modified during fire(). * if it is not 0, the default behavior for this event * @property prevented * @type int */ /** * Specifies the host for this custom event. This is used * to enable event bubbling * @property host * @type EventTarget */ /** * The default function to execute after event listeners * have fire, but only if the default action was not * prevented. * @property defaultFn * @type Function */ /** * Flag for the default function to execute only if the * firing event is the current target. This happens only * when using custom event delegation and setting the * flag to `true` mimics the behavior of event delegation * in the DOM. * * @property defaultTargetOnly * @type Boolean * @default false */ /** * The function to execute if a subscriber calls * stopPropagation or stopImmediatePropagation * @property stoppedFn * @type Function */ /** * The function to execute if a subscriber calls * preventDefault * @property preventedFn * @type Function */ /** * The subscribers to this event * @property _subscribers * @type Subscriber [] * @private */ /** * 'After' subscribers * @property _afters * @type Subscriber [] * @private */ /** * If set to true, the custom event will deliver an EventFacade object * that is similar to a DOM event object. * @property emitFacade * @type boolean * @default false */ /** * Supports multiple options for listener signatures in order to * port YUI 2 apps. * @property signature * @type int * @default 9 */ signature : YUI3_SIGNATURE, /** * The context the the event will fire from by default. Defaults to the YUI * instance. * @property context * @type object */ context : Y, /** * Specifies whether or not this event's default function * can be cancelled by a subscriber by executing preventDefault() * on the event facade * @property preventable * @type boolean * @default true */ preventable : true, /** * Specifies whether or not a subscriber can stop the event propagation * via stopPropagation(), stopImmediatePropagation(), or halt() * * Events can only bubble if emitFacade is true. * * @property bubbles * @type boolean * @default true */ bubbles : true, /** * Returns the number of subscribers for this event as the sum of the on() * subscribers and after() subscribers. * * @method hasSubs * @return Number */ hasSubs: function(when) { var s = 0, a = 0, subs = this._subscribers, afters = this._afters, sib = this.sibling; if (subs) { s = subs.length; } if (afters) { a = afters.length; } if (sib) { subs = sib._subscribers; afters = sib._afters; if (subs) { s += subs.length; } if (afters) { a += afters.length; } } if (when) { return (when === 'after') ? a : s; } return (s + a); }, /** * Monitor the event state for the subscribed event. The first parameter * is what should be monitored, the rest are the normal parameters when * subscribing to an event. * @method monitor * @param what {string} what to monitor ('detach', 'attach', 'publish'). * @return {EventHandle} return value from the monitor event subscription. */ monitor: function(what) { this.monitored = true; var type = this.id + '|' + this.type + '_' + what, args = nativeSlice.call(arguments, 0); args[0] = type; return this.host.on.apply(this.host, args); }, /** * Get all of the subscribers to this event and any sibling event * @method getSubs * @return {Array} first item is the on subscribers, second the after. */ getSubs: function() { var sibling = this.sibling, subs = this._subscribers, afters = this._afters, siblingSubs, siblingAfters; if (sibling) { siblingSubs = sibling._subscribers; siblingAfters = sibling._afters; } if (siblingSubs) { if (subs) { subs = subs.concat(siblingSubs); } else { subs = siblingSubs.concat(); } } else { if (subs) { subs = subs.concat(); } else { subs = []; } } if (siblingAfters) { if (afters) { afters = afters.concat(siblingAfters); } else { afters = siblingAfters.concat(); } } else { if (afters) { afters = afters.concat(); } else { afters = []; } } return [subs, afters]; }, /** * Apply configuration properties. Only applies the CONFIG whitelist * @method applyConfig * @param o hash of properties to apply. * @param force {boolean} if true, properties that exist on the event * will be overwritten. */ applyConfig: function(o, force) { mixConfigs(this, o, force); }, /** * Create the Subscription for subscribing function, context, and bound * arguments. If this is a fireOnce event, the subscriber is immediately * notified. * * @method _on * @param fn {Function} Subscription callback * @param [context] {Object} Override `this` in the callback * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire() * @param [when] {String} "after" to slot into after subscribers * @return {EventHandle} * @protected */ _on: function(fn, context, args, when) { if (!fn) { this.log('Invalid callback for CE: ' + this.type); } var s = new Y.Subscriber(fn, context, args, when), firedWith; if (this.fireOnce && this.fired) { firedWith = this.firedWith; // It's a little ugly for this to know about facades, // but given the current breakup, not much choice without // moving a whole lot of stuff around. if (this.emitFacade && this._addFacadeToArgs) { this._addFacadeToArgs(firedWith); } if (this.async) { setTimeout(Y.bind(this._notify, this, s, firedWith), 0); } else { this._notify(s, firedWith); } } if (when === AFTER) { if (!this._afters) { this._afters = []; } this._afters.push(s); } else { if (!this._subscribers) { this._subscribers = []; } this._subscribers.push(s); } if (this._kds) { if (when === AFTER) { this.afters[s.id] = s; } else { this.subscribers[s.id] = s; } } return new Y.EventHandle(this, s); }, /** * Listen for this event * @method subscribe * @param {Function} fn The function to execute. * @return {EventHandle} Unsubscribe handle. * @deprecated use on. */ subscribe: function(fn, context) { Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated'); var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; return this._on(fn, context, a, true); }, /** * Listen for this event * @method on * @param {Function} fn The function to execute. * @param {object} context optional execution context. * @param {mixed} arg* 0..n additional arguments to supply to the subscriber * when the event fires. * @return {EventHandle} An object with a detach method to detch the handler(s). */ on: function(fn, context) { var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; if (this.monitored && this.host) { this.host._monitor('attach', this, { args: arguments }); } return this._on(fn, context, a, true); }, /** * Listen for this event after the normal subscribers have been notified and * the default behavior has been applied. If a normal subscriber prevents the * default behavior, it also prevents after listeners from firing. * @method after * @param {Function} fn The function to execute. * @param {object} context optional execution context. * @param {mixed} arg* 0..n additional arguments to supply to the subscriber * when the event fires. * @return {EventHandle} handle Unsubscribe handle. */ after: function(fn, context) { var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; return this._on(fn, context, a, AFTER); }, /** * Detach listeners. * @method detach * @param {Function} fn The subscribed function to remove, if not supplied * all will be removed. * @param {Object} context The context object passed to subscribe. * @return {Number} returns the number of subscribers unsubscribed. */ detach: function(fn, context) { // unsubscribe handle if (fn && fn.detach) { return fn.detach(); } var i, s, found = 0, subs = this._subscribers, afters = this._afters; if (subs) { for (i = subs.length; i >= 0; i--) { s = subs[i]; if (s && (!fn || fn === s.fn)) { this._delete(s, subs, i); found++; } } } if (afters) { for (i = afters.length; i >= 0; i--) { s = afters[i]; if (s && (!fn || fn === s.fn)) { this._delete(s, afters, i); found++; } } } return found; }, /** * Detach listeners. * @method unsubscribe * @param {Function} fn The subscribed function to remove, if not supplied * all will be removed. * @param {Object} context The context object passed to subscribe. * @return {int|undefined} returns the number of subscribers unsubscribed. * @deprecated use detach. */ unsubscribe: function() { return this.detach.apply(this, arguments); }, /** * Notify a single subscriber * @method _notify * @param {Subscriber} s the subscriber. * @param {Array} args the arguments array to apply to the listener. * @protected */ _notify: function(s, args, ef) { this.log(this.type + '->' + 'sub: ' + s.id); var ret; ret = s.notify(args, this); if (false === ret || this.stopped > 1) { this.log(this.type + ' cancelled by subscriber'); return false; } return true; }, /** * Logger abstraction to centralize the application of the silent flag * @method log * @param {string} msg message to log. * @param {string} cat log category. */ log: function(msg, cat) { if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); } }, /** * Notifies the subscribers. The callback functions will be executed * from the context specified when the event was created, and with the * following parameters: * <ul> * <li>The type of event</li> * <li>All of the arguments fire() was executed with as an array</li> * <li>The custom object (if any) that was passed into the subscribe() * method</li> * </ul> * @method fire * @param {Object*} arguments an arbitrary set of parameters to pass to * the handler. * @return {boolean} false if one of the subscribers returned false, * true otherwise. * */ fire: function() { // push is the fastest way to go from arguments to arrays // for most browsers currently // http://jsperf.com/push-vs-concat-vs-slice/2 var args = []; args.push.apply(args, arguments); return this._fire(args); }, /** * Private internal implementation for `fire`, which is can be used directly by * `EventTarget` and other event module classes which have already converted from * an `arguments` list to an array, to avoid the repeated overhead. * * @method _fire * @private * @param {Array} args The array of arguments passed to be passed to handlers. * @return {boolean} false if one of the subscribers returned false, true otherwise. */ _fire: function(args) { if (this.fireOnce && this.fired) { this.log('fireOnce event: ' + this.type + ' already fired'); return true; } else { // this doesn't happen if the event isn't published // this.host._monitor('fire', this.type, args); this.fired = true; if (this.fireOnce) { this.firedWith = args; } if (this.emitFacade) { return this.fireComplex(args); } else { return this.fireSimple(args); } } }, /** * Set up for notifying subscribers of non-emitFacade events. * * @method fireSimple * @param args {Array} Arguments passed to fire() * @return Boolean false if a subscriber returned false * @protected */ fireSimple: function(args) { this.stopped = 0; this.prevented = 0; if (this.hasSubs()) { var subs = this.getSubs(); this._procSubs(subs[0], args); this._procSubs(subs[1], args); } if (this.broadcast) { this._broadcast(args); } return this.stopped ? false : true; }, // Requires the event-custom-complex module for full funcitonality. fireComplex: function(args) { this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type); args[0] = args[0] || {}; return this.fireSimple(args); }, /** * Notifies a list of subscribers. * * @method _procSubs * @param subs {Array} List of subscribers * @param args {Array} Arguments passed to fire() * @param ef {} * @return Boolean false if a subscriber returns false or stops the event * propagation via e.stopPropagation(), * e.stopImmediatePropagation(), or e.halt() * @private */ _procSubs: function(subs, args, ef) { var s, i, l; for (i = 0, l = subs.length; i < l; i++) { s = subs[i]; if (s && s.fn) { if (false === this._notify(s, args, ef)) { this.stopped = 2; } if (this.stopped === 2) { return false; } } } return true; }, /** * Notifies the YUI instance if the event is configured with broadcast = 1, * and both the YUI instance and Y.Global if configured with broadcast = 2. * * @method _broadcast * @param args {Array} Arguments sent to fire() * @private */ _broadcast: function(args) { if (!this.stopped && this.broadcast) { var a = args.concat(); a.unshift(this.type); if (this.host !== Y) { Y.fire.apply(Y, a); } if (this.broadcast === 2) { Y.Global.fire.apply(Y.Global, a); } } }, /** * Removes all listeners * @method unsubscribeAll * @return {Number} The number of listeners unsubscribed. * @deprecated use detachAll. */ unsubscribeAll: function() { return this.detachAll.apply(this, arguments); }, /** * Removes all listeners * @method detachAll * @return {Number} The number of listeners unsubscribed. */ detachAll: function() { return this.detach(); }, /** * Deletes the subscriber from the internal store of on() and after() * subscribers. * * @method _delete * @param s subscriber object. * @param subs (optional) on or after subscriber array * @param index (optional) The index found. * @private */ _delete: function(s, subs, i) { var when = s._when; if (!subs) { subs = (when === AFTER) ? this._afters : this._subscribers; } if (subs) { i = YArray.indexOf(subs, s, 0); if (s && subs[i] === s) { subs.splice(i, 1); } } if (this._kds) { if (when === AFTER) { delete this.afters[s.id]; } else { delete this.subscribers[s.id]; } } if (this.monitored && this.host) { this.host._monitor('detach', this, { ce: this, sub: s }); } if (s) { s.deleted = true; } } }; /** * Stores the subscriber information to be used when the event fires. * @param {Function} fn The wrapped function to execute. * @param {Object} context The value of the keyword 'this' in the listener. * @param {Array} args* 0..n additional arguments to supply the listener. * * @class Subscriber * @constructor */ Y.Subscriber = function(fn, context, args, when) { /** * The callback that will be execute when the event fires * This is wrapped by Y.rbind if obj was supplied. * @property fn * @type Function */ this.fn = fn; /** * Optional 'this' keyword for the listener * @property context * @type Object */ this.context = context; /** * Unique subscriber id * @property id * @type String */ this.id = Y.guid(); /** * Additional arguments to propagate to the subscriber * @property args * @type Array */ this.args = args; this._when = when; /** * Custom events for a given fire transaction. * @property events * @type {EventTarget} */ // this.events = null; /** * This listener only reacts to the event once * @property once */ // this.once = false; }; Y.Subscriber.prototype = { constructor: Y.Subscriber, _notify: function(c, args, ce) { if (this.deleted && !this.postponed) { if (this.postponed) { delete this.fn; delete this.context; } else { delete this.postponed; return null; } } var a = this.args, ret; switch (ce.signature) { case 0: ret = this.fn.call(c, ce.type, args, c); break; case 1: ret = this.fn.call(c, args[0] || null, c); break; default: if (a || args) { args = args || []; a = (a) ? args.concat(a) : args; ret = this.fn.apply(c, a); } else { ret = this.fn.call(c); } } if (this.once) { ce._delete(this); } return ret; }, /** * Executes the subscriber. * @method notify * @param args {Array} Arguments array for the subscriber. * @param ce {CustomEvent} The custom event that sent the notification. */ notify: function(args, ce) { var c = this.context, ret = true; if (!c) { c = (ce.contextFn) ? ce.contextFn() : ce.context; } // only catch errors if we will not re-throw them. if (Y.config && Y.config.throwFail) { ret = this._notify(c, args, ce); } else { try { ret = this._notify(c, args, ce); } catch (e) { Y.error(this + ' failed: ' + e.message, e); } } return ret; }, /** * Returns true if the fn and obj match this objects properties. * Used by the unsubscribe method to match the right subscriber. * * @method contains * @param {Function} fn the function to execute. * @param {Object} context optional 'this' keyword for the listener. * @return {boolean} true if the supplied arguments match this * subscriber's signature. */ contains: function(fn, context) { if (context) { return ((this.fn === fn) && this.context === context); } else { return (this.fn === fn); } }, valueOf : function() { return this.id; } }; /** * Return value from all subscribe operations * @class EventHandle * @constructor * @param {CustomEvent} evt the custom event. * @param {Subscriber} sub the subscriber. */ Y.EventHandle = function(evt, sub) { /** * The custom event * * @property evt * @type CustomEvent */ this.evt = evt; /** * The subscriber object * * @property sub * @type Subscriber */ this.sub = sub; }; Y.EventHandle.prototype = { batch: function(f, c) { f.call(c || this, this); if (Y.Lang.isArray(this.evt)) { Y.Array.each(this.evt, function(h) { h.batch.call(c || h, f); }); } }, /** * Detaches this subscriber * @method detach * @return {Number} the number of detached listeners */ detach: function() { var evt = this.evt, detached = 0, i; if (evt) { // Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event'); if (Y.Lang.isArray(evt)) { for (i = 0; i < evt.length; i++) { detached += evt[i].detach(); } } else { evt._delete(this.sub); detached = 1; } } return detached; }, /** * Monitor the event state for the subscribed event. The first parameter * is what should be monitored, the rest are the normal parameters when * subscribing to an event. * @method monitor * @param what {string} what to monitor ('attach', 'detach', 'publish'). * @return {EventHandle} return value from the monitor event subscription. */ monitor: function(what) { return this.evt.monitor.apply(this.evt, arguments); } }; /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ /** * EventTarget provides the implementation for any object to * publish, subscribe and fire to custom events, and also * alows other EventTargets to target the object with events * sourced from the other object. * EventTarget is designed to be used with Y.augment to wrap * EventCustom in an interface that allows events to be listened to * and fired by name. This makes it possible for implementing code to * subscribe to an event that either has not been created yet, or will * not be created at all. * @class EventTarget * @param opts a configuration object * @config emitFacade {boolean} if true, all events will emit event * facade payloads by default (default false) * @config prefix {String} the prefix to apply to non-prefixed event names */ var L = Y.Lang, PREFIX_DELIMITER = ':', CATEGORY_DELIMITER = '|', AFTER_PREFIX = '~AFTER~', WILD_TYPE_RE = /(.*?)(:)(.*?)/, _wildType = Y.cached(function(type) { return type.replace(WILD_TYPE_RE, "*$2$3"); }), /** * If the instance has a prefix attribute and the * event type is not prefixed, the instance prefix is * applied to the supplied type. * @method _getType * @private */ _getType = function(type, pre) { if (!pre || !type || type.indexOf(PREFIX_DELIMITER) > -1) { return type; } return pre + PREFIX_DELIMITER + type; }, /** * Returns an array with the detach key (if provided), * and the prefixed event name from _getType * Y.on('detachcategory| menu:click', fn) * @method _parseType * @private */ _parseType = Y.cached(function(type, pre) { var t = type, detachcategory, after, i; if (!L.isString(t)) { return t; } i = t.indexOf(AFTER_PREFIX); if (i > -1) { after = true; t = t.substr(AFTER_PREFIX.length); } i = t.indexOf(CATEGORY_DELIMITER); if (i > -1) { detachcategory = t.substr(0, (i)); t = t.substr(i+1); if (t === '*') { t = null; } } // detach category, full type with instance prefix, is this an after listener, short type return [detachcategory, (pre) ? _getType(t, pre) : t, after, t]; }), ET = function(opts) { var etState = this._yuievt, etConfig; if (!etState) { etState = this._yuievt = { events: {}, // PERF: Not much point instantiating lazily. We're bound to have events targets: null, // PERF: Instantiate lazily, if user actually adds target, config: { host: this, context: this }, chain: Y.config.chain }; } etConfig = etState.config; if (opts) { mixConfigs(etConfig, opts, true); if (opts.chain !== undefined) { etState.chain = opts.chain; } if (opts.prefix) { etConfig.prefix = opts.prefix; } } }; ET.prototype = { constructor: ET, /** * Listen to a custom event hosted by this object one time. * This is the equivalent to <code>on</code> except the * listener is immediatelly detached when it is executed. * @method once * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching the * subscription */ once: function() { var handle = this.on.apply(this, arguments); handle.batch(function(hand) { if (hand.sub) { hand.sub.once = true; } }); return handle; }, /** * Listen to a custom event hosted by this object one time. * This is the equivalent to <code>after</code> except the * listener is immediatelly detached when it is executed. * @method onceAfter * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching that * subscription */ onceAfter: function() { var handle = this.after.apply(this, arguments); handle.batch(function(hand) { if (hand.sub) { hand.sub.once = true; } }); return handle; }, /** * Takes the type parameter passed to 'on' and parses out the * various pieces that could be included in the type. If the * event type is passed without a prefix, it will be expanded * to include the prefix one is supplied or the event target * is configured with a default prefix. * @method parseType * @param {String} type the type * @param {String} [pre] The prefix. Defaults to this._yuievt.config.prefix * @since 3.3.0 * @return {Array} an array containing: * * the detach category, if supplied, * * the prefixed event type, * * whether or not this is an after listener, * * the supplied event type */ parseType: function(type, pre) { return _parseType(type, pre || this._yuievt.config.prefix); }, /** * Subscribe a callback function to a custom event fired by this object or * from an object that bubbles its events to this object. * * Callback functions for events published with `emitFacade = true` will * receive an `EventFacade` as the first argument (typically named "e"). * These callbacks can then call `e.preventDefault()` to disable the * behavior published to that event's `defaultFn`. See the `EventFacade` * API for all available properties and methods. Subscribers to * non-`emitFacade` events will receive the arguments passed to `fire()` * after the event name. * * To subscribe to multiple events at once, pass an object as the first * argument, where the key:value pairs correspond to the eventName:callback, * or pass an array of event names as the first argument to subscribe to * all listed events with the same callback. * * Returning `false` from a callback is supported as an alternative to * calling `e.preventDefault(); e.stopPropagation();`. However, it is * recommended to use the event methods whenever possible. * * @method on * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching that * subscription */ on: function(type, fn, context) { var yuievt = this._yuievt, parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce, detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype, Node = Y.Node, n, domevent, isArr; // full name, args, detachcategory, after this._monitor('attach', parts[1], { args: arguments, category: parts[0], after: parts[2] }); if (L.isObject(type)) { if (L.isFunction(type)) { return Y.Do.before.apply(Y.Do, arguments); } f = fn; c = context; args = nativeSlice.call(arguments, 0); ret = []; if (L.isArray(type)) { isArr = true; } after = type._after; delete type._after; Y.each(type, function(v, k) { if (L.isObject(v)) { f = v.fn || ((L.isFunction(v)) ? v : f); c = v.context || c; } var nv = (after) ? AFTER_PREFIX : ''; args[0] = nv + ((isArr) ? v : k); args[1] = f; args[2] = c; ret.push(this.on.apply(this, args)); }, this); return (yuievt.chain) ? this : new Y.EventHandle(ret); } detachcategory = parts[0]; after = parts[2]; shorttype = parts[3]; // extra redirection so we catch adaptor events too. take a look at this. if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) { args = nativeSlice.call(arguments, 0); args.splice(2, 0, Node.getDOMNode(this)); // Y.log("Node detected, redirecting with these args: " + args); return Y.on.apply(Y, args); } type = parts[1]; if (Y.instanceOf(this, YUI)) { adapt = Y.Env.evt.plugins[type]; args = nativeSlice.call(arguments, 0); args[0] = shorttype; if (Node) { n = args[2]; if (Y.instanceOf(n, Y.NodeList)) { n = Y.NodeList.getDOMNodes(n); } else if (Y.instanceOf(n, Node)) { n = Node.getDOMNode(n); } domevent = (shorttype in Node.DOM_EVENTS); // Captures both DOM events and event plugins. if (domevent) { args[2] = n; } } // check for the existance of an event adaptor if (adapt) { Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event'); handle = adapt.on.apply(Y, args); } else if ((!type) || domevent) { handle = Y.Event._attach(args); } } if (!handle) { ce = yuievt.events[type] || this.publish(type); handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true); // TODO: More robust regex, accounting for category if (type.indexOf("*:") !== -1) { this._hasSiblings = true; } } if (detachcategory) { store[detachcategory] = store[detachcategory] || {}; store[detachcategory][type] = store[detachcategory][type] || []; store[detachcategory][type].push(handle); } return (yuievt.chain) ? this : handle; }, /** * subscribe to an event * @method subscribe * @deprecated use on */ subscribe: function() { Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated'); return this.on.apply(this, arguments); }, /** * Detach one or more listeners the from the specified event * @method detach * @param type {string|Object} Either the handle to the subscriber or the * type of event. If the type * is not specified, it will attempt to remove * the listener from all hosted events. * @param fn {Function} The subscribed function to unsubscribe, if not * supplied, all subscribers will be removed. * @param context {Object} The custom object passed to subscribe. This is * optional, but if supplied will be used to * disambiguate multiple listeners that are the same * (e.g., you subscribe many object using a function * that lives on the prototype) * @return {EventTarget} the host */ detach: function(type, fn, context) { var evts = this._yuievt.events, i, Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node)); // detachAll disabled on the Y instance. if (!type && (this !== Y)) { for (i in evts) { if (evts.hasOwnProperty(i)) { evts[i].detach(fn, context); } } if (isNode) { Y.Event.purgeElement(Node.getDOMNode(this)); } return this; } var parts = _parseType(type, this._yuievt.config.prefix), detachcategory = L.isArray(parts) ? parts[0] : null, shorttype = (parts) ? parts[3] : null, adapt, store = Y.Env.evt.handles, detachhost, cat, args, ce, keyDetacher = function(lcat, ltype, host) { var handles = lcat[ltype], ce, i; if (handles) { for (i = handles.length - 1; i >= 0; --i) { ce = handles[i].evt; if (ce.host === host || ce.el === host) { handles[i].detach(); } } } }; if (detachcategory) { cat = store[detachcategory]; type = parts[1]; detachhost = (isNode) ? Y.Node.getDOMNode(this) : this; if (cat) { if (type) { keyDetacher(cat, type, detachhost); } else { for (i in cat) { if (cat.hasOwnProperty(i)) { keyDetacher(cat, i, detachhost); } } } return this; } // If this is an event handle, use it to detach } else if (L.isObject(type) && type.detach) { type.detach(); return this; // extra redirection so we catch adaptor events too. take a look at this. } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) { args = nativeSlice.call(arguments, 0); args[2] = Node.getDOMNode(this); Y.detach.apply(Y, args); return this; } adapt = Y.Env.evt.plugins[shorttype]; // The YUI instance handles DOM events and adaptors if (Y.instanceOf(this, YUI)) { args = nativeSlice.call(arguments, 0); // use the adaptor specific detach code if if (adapt && adapt.detach) { adapt.detach.apply(Y, args); return this; // DOM event fork } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) { args[0] = type; Y.Event.detach.apply(Y.Event, args); return this; } } // ce = evts[type]; ce = evts[parts[1]]; if (ce) { ce.detach(fn, context); } return this; }, /** * detach a listener * @method unsubscribe * @deprecated use detach */ unsubscribe: function() { Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated'); return this.detach.apply(this, arguments); }, /** * Removes all listeners from the specified event. If the event type * is not specified, all listeners from all hosted custom events will * be removed. * @method detachAll * @param type {String} The type, or name of the event */ detachAll: function(type) { return this.detach(type); }, /** * Removes all listeners from the specified event. If the event type * is not specified, all listeners from all hosted custom events will * be removed. * @method unsubscribeAll * @param type {String} The type, or name of the event * @deprecated use detachAll */ unsubscribeAll: function() { Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated'); return this.detachAll.apply(this, arguments); }, /** * Creates a new custom event of the specified type. If a custom event * by that name already exists, it will not be re-created. In either * case the custom event is returned. * * @method publish * * @param type {String} the type, or name of the event * @param opts {object} optional config params. Valid properties are: * * <ul> * <li> * 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false) * </li> * <li> * 'bubbles': whether or not this event bubbles (true) * Events can only bubble if emitFacade is true. * </li> * <li> * 'context': the default execution context for the listeners (this) * </li> * <li> * 'defaultFn': the default function to execute when this event fires if preventDefault was not called * </li> * <li> * 'emitFacade': whether or not this event emits a facade (false) * </li> * <li> * 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click' * </li> * <li> * 'fireOnce': if an event is configured to fire once, new subscribers after * the fire will be notified immediately. * </li> * <li> * 'async': fireOnce event listeners will fire synchronously if the event has already * fired unless async is true. * </li> * <li> * 'preventable': whether or not preventDefault() has an effect (true) * </li> * <li> * 'preventedFn': a function that is executed when preventDefault is called * </li> * <li> * 'queuable': whether or not this event can be queued during bubbling (false) * </li> * <li> * 'silent': if silent is true, debug messages are not provided for this event. * </li> * <li> * 'stoppedFn': a function that is executed when stopPropagation is called * </li> * * <li> * 'monitored': specifies whether or not this event should send notifications about * when the event has been attached, detached, or published. * </li> * <li> * 'type': the event type (valid option if not provided as the first parameter to publish) * </li> * </ul> * * @return {CustomEvent} the custom event * */ publish: function(type, opts) { var ret, etState = this._yuievt, etConfig = etState.config, pre = etConfig.prefix; if (typeof type === "string") { if (pre) { type = _getType(type, pre); } ret = this._publish(type, etConfig, opts); } else { ret = {}; Y.each(type, function(v, k) { if (pre) { k = _getType(k, pre); } ret[k] = this._publish(k, etConfig, v || opts); }, this); } return ret; }, /** * Returns the fully qualified type, given a short type string. * That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix. * * NOTE: This method, unlike _getType, does no checking of the value passed in, and * is designed to be used with the low level _publish() method, for critical path * implementations which need to fast-track publish for performance reasons. * * @method _getFullType * @private * @param {String} type The short type to prefix * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in */ _getFullType : function(type) { var pre = this._yuievt.config.prefix; if (pre) { return pre + PREFIX_DELIMITER + type; } else { return type; } }, /** * The low level event publish implementation. It expects all the massaging to have been done * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast * path publish, which can be used by critical code paths to improve performance. * * @method _publish * @private * @param {String} fullType The prefixed type of the event to publish. * @param {Object} etOpts The EventTarget specific configuration to mix into the published event. * @param {Object} ceOpts The publish specific configuration to mix into the published event. * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will * be the default `CustomEvent` instance, and can be configured independently. */ _publish : function(fullType, etOpts, ceOpts) { var ce, etState = this._yuievt, etConfig = etState.config, host = etConfig.host, context = etConfig.context, events = etState.events; ce = events[fullType]; // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight. if ((etConfig.monitored && !ce) || (ce && ce.monitored)) { this._monitor('publish', fullType, { args: arguments }); } if (!ce) { // Publish event ce = events[fullType] = new Y.CustomEvent(fullType, etOpts); if (!etOpts) { ce.host = host; ce.context = context; } } if (ceOpts) { mixConfigs(ce, ceOpts, true); } return ce; }, /** * This is the entry point for the event monitoring system. * You can monitor 'attach', 'detach', 'fire', and 'publish'. * When configured, these events generate an event. click -> * click_attach, click_detach, click_publish -- these can * be subscribed to like other events to monitor the event * system. Inividual published events can have monitoring * turned on or off (publish can't be turned off before it * it published) by setting the events 'monitor' config. * * @method _monitor * @param what {String} 'attach', 'detach', 'fire', or 'publish' * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object. * @param o {Object} Information about the event interaction, such as * fire() args, subscription category, publish config * @private */ _monitor: function(what, eventType, o) { var monitorevt, ce, type; if (eventType) { if (typeof eventType === "string") { type = eventType; ce = this.getEvent(eventType, true); } else { ce = eventType; type = eventType.type; } if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { monitorevt = type + '_' + what; o.monitored = what; this.fire.call(this, monitorevt, o); } } }, /** * Fire a custom event by name. The callback functions will be executed * from the context specified when the event was created, and with the * following parameters. * * The first argument is the event type, and any additional arguments are * passed to the listeners as parameters. If the first of these is an * object literal, and the event is configured to emit an event facade, * that object is mixed into the event facade and the facade is provided * in place of the original object. * * If the custom event object hasn't been created, then the event hasn't * been published and it has no subscribers. For performance sake, we * immediate exit in this case. This means the event won't bubble, so * if the intention is that a bubble target be notified, the event must * be published on this object first. * * @method fire * @param type {String|Object} The type of the event, or an object that contains * a 'type' property. * @param arguments {Object*} an arbitrary set of parameters to pass to * the handler. If the first of these is an object literal and the event is * configured to emit an event facade, the event facade will replace that * parameter after the properties the object literal contains are copied to * the event facade. * @return {Boolean} True if the whole lifecycle of the event went through, * false if at any point the event propagation was halted. */ fire: function(type) { var typeIncluded = (typeof type === "string"), argCount = arguments.length, t = type, yuievt = this._yuievt, etConfig = yuievt.config, pre = etConfig.prefix, ret, ce, ce2, args; if (typeIncluded && argCount <= 3) { // PERF: Try to avoid slice/iteration for the common signatures // Most common if (argCount === 2) { args = [arguments[1]]; // fire("foo", {}) } else if (argCount === 3) { args = [arguments[1], arguments[2]]; // fire("foo", {}, opts) } else { args = []; // fire("foo") } } else { args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0)); } if (!typeIncluded) { t = (type && type.type); } if (pre) { t = _getType(t, pre); } ce = yuievt.events[t]; if (this._hasSiblings) { ce2 = this.getSibling(t, ce); if (ce2 && !ce) { ce = this.publish(t); } } // PERF: trying to avoid function call, since this is a critical path if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { this._monitor('fire', (ce || t), { args: args }); } // this event has not been published or subscribed to if (!ce) { if (yuievt.hasTargets) { return this.bubble({ type: t }, args, this); } // otherwise there is nothing to be done ret = true; } else { if (ce2) { ce.sibling = ce2; } ret = ce._fire(args); } return (yuievt.chain) ? this : ret; }, getSibling: function(type, ce) { var ce2; // delegate to *:type events if there are subscribers if (type.indexOf(PREFIX_DELIMITER) > -1) { type = _wildType(type); ce2 = this.getEvent(type, true); if (ce2) { ce2.applyConfig(ce); ce2.bubbles = false; ce2.broadcast = 0; } } return ce2; }, /** * Returns the custom event of the provided type has been created, a * falsy value otherwise * @method getEvent * @param type {String} the type, or name of the event * @param prefixed {String} if true, the type is prefixed already * @return {CustomEvent} the custom event or null */ getEvent: function(type, prefixed) { var pre, e; if (!prefixed) { pre = this._yuievt.config.prefix; type = (pre) ? _getType(type, pre) : type; } e = this._yuievt.events; return e[type] || null; }, /** * Subscribe to a custom event hosted by this object. The * supplied callback will execute after any listeners add * via the subscribe method, and after the default function, * if configured for the event, has executed. * * @method after * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching the * subscription */ after: function(type, fn) { var a = nativeSlice.call(arguments, 0); switch (L.type(type)) { case 'function': return Y.Do.after.apply(Y.Do, arguments); case 'array': // YArray.each(a[0], function(v) { // v = AFTER_PREFIX + v; // }); // break; case 'object': a[0]._after = true; break; default: a[0] = AFTER_PREFIX + type; } return this.on.apply(this, a); }, /** * Executes the callback before a DOM event, custom event * or method. If the first argument is a function, it * is assumed the target is a method. For DOM and custom * events, this is an alias for Y.on. * * For DOM and custom events: * type, callback, context, 0-n arguments * * For methods: * callback, object (method host), methodName, context, 0-n arguments * * @method before * @return detach handle */ before: function() { return this.on.apply(this, arguments); } }; Y.EventTarget = ET; // make Y an event target Y.mix(Y, ET.prototype); ET.call(Y, { bubbles: false }); YUI.Env.globalEvents = YUI.Env.globalEvents || new ET(); /** * Hosts YUI page level events. This is where events bubble to * when the broadcast config is set to 2. This property is * only available if the custom event module is loaded. * @property Global * @type EventTarget * @for YUI */ Y.Global = YUI.Env.globalEvents; // @TODO implement a global namespace function on Y.Global? /** `Y.on()` can do many things: <ul> <li>Subscribe to custom events `publish`ed and `fire`d from Y</li> <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and `fire`d from any object in the YUI instance sandbox</li> <li>Subscribe to DOM events</li> <li>Subscribe to the execution of a method on any object, effectively treating that method as an event</li> </ul> For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument. Y.on('io:complete', function () { Y.MyApp.updateStatus('Transaction complete'); }); To subscribe to DOM events, pass the name of a DOM event as the first argument and a CSS selector string as the third argument after the callback function. Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`, array, or simply omitted (the default is the `window` object). Y.on('click', function (e) { e.preventDefault(); // proceed with ajax form submission var url = this.get('action'); ... }, '#my-form'); The `this` object in DOM event callbacks will be the `Node` targeted by the CSS selector or other identifier. `on()` subscribers for DOM events or custom events `publish`ed with a `defaultFn` can prevent the default behavior with `e.preventDefault()` from the event object passed as the first parameter to the subscription callback. To subscribe to the execution of an object method, pass arguments corresponding to the call signature for <a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>. NOTE: The formal parameter list below is for events, not for function injection. See `Y.Do.before` for that signature. @method on @param {String} type DOM or custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @see Do.before @for YUI **/ /** Listen for an event one time. Equivalent to `on()`, except that the listener is immediately detached when executed. See the <a href="#methods_on">`on()` method</a> for additional subscription options. @see on @method once @param {String} type DOM or custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ /** Listen for an event one time. Equivalent to `once()`, except, like `after()`, the subscription callback executes after all `on()` subscribers and the event's `defaultFn` (if configured) have executed. Like `after()` if any `on()` phase subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()` subscribers will execute. The listener is immediately detached when executed. See the <a href="#methods_on">`on()` method</a> for additional subscription options. @see once @method onceAfter @param {String} type The custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ /** Like `on()`, this method creates a subscription to a custom event or to the execution of a method on an object. For events, `after()` subscribers are executed after the event's `defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber. See the <a href="#methods_on">`on()` method</a> for additional subscription options. NOTE: The subscription signature shown is for events, not for function injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a> for that signature. @see on @see Do.after @method after @param {String} type The custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [args*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ }, '3.17.1', {"requires": ["oop"]});
extend1994/cdnjs
ajax/libs/yui/3.17.1/event-custom-base/event-custom-base-debug.js
JavaScript
mit
75,885
<?php namespace Drupal\Tests\serialization\Kernel; use Drupal\Core\Url; use Drupal\entity_test\Entity\EntityTestMulRev; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; /** * Tests that entities references can be resolved. * * @group serialization */ class EntityResolverTest extends NormalizerTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['hal', 'rest']; /** * The format being tested. * * @var string */ protected $format = 'hal_json'; protected function setUp() { parent::setUp(); \Drupal::service('router.builder')->rebuild(); // Create the test field storage. FieldStorageConfig::create([ 'entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_entity_reference', 'type' => 'entity_reference', 'settings' => [ 'target_type' => 'entity_test_mulrev', ], ])->save(); // Create the test field. FieldConfig::create([ 'entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_entity_reference', 'bundle' => 'entity_test_mulrev', ])->save(); } /** * Test that fields referencing UUIDs can be denormalized. */ public function testUuidEntityResolver() { // Create an entity to get the UUID from. $entity = EntityTestMulRev::create(['type' => 'entity_test_mulrev']); $entity->set('name', 'foobar'); $entity->set('field_test_entity_reference', [['target_id' => 1]]); $entity->save(); $field_uri = Url::fromUri('base:rest/relation/entity_test_mulrev/entity_test_mulrev/field_test_entity_reference', ['absolute' => TRUE])->toString(); $data = [ '_links' => [ 'type' => [ 'href' => Url::fromUri('base:rest/type/entity_test_mulrev/entity_test_mulrev', ['absolute' => TRUE])->toString(), ], $field_uri => [ [ 'href' => $entity->url(), ], ], ], '_embedded' => [ $field_uri => [ [ '_links' => [ 'self' => $entity->url(), ], 'uuid' => [ [ 'value' => $entity->uuid(), ], ], ], ], ], ]; $denormalized = $this->container->get('serializer')->denormalize($data, 'Drupal\entity_test\Entity\EntityTestMulRev', $this->format); $field_value = $denormalized->get('field_test_entity_reference')->getValue(); $this->assertEqual($field_value[0]['target_id'], 1, 'Entity reference resolved using UUID.'); } }
sunlight25/d8
web/core/modules/serialization/tests/src/Kernel/EntityResolverTest.php
PHP
gpl-2.0
2,605
/** * Copyright 2011 Rackspace * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var sprintf = require('./sprintf').sprintf; var utils = require('./utils'); var SyntaxError = require('./errors').SyntaxError; var _cache = {}; var RE = new RegExp( "(" + "'[^']*'|\"[^\"]*\"|" + "::|" + "//?|" + "\\.\\.|" + "\\(\\)|" + "[/.*:\\[\\]\\(\\)@=])|" + "((?:\\{[^}]+\\})?[^/\\[\\]\\(\\)@=\\s]+)|" + "\\s+", 'g' ); var xpath_tokenizer = utils.findall.bind(null, RE); function prepare_tag(next, token) { var tag = token[0]; function select(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; elem._children.forEach(function(e) { if (e.tag === tag) { rv.push(e); } }); } return rv; } return select; } function prepare_star(next, token) { function select(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; elem._children.forEach(function(e) { rv.push(e); }); } return rv; } return select; } function prepare_dot(next, token) { function select(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; rv.push(elem); } return rv; } return select; } function prepare_iter(next, token) { var tag; token = next(); if (token[1] === '*') { tag = '*'; } else if (!token[1]) { tag = token[0] || ''; } else { throw new SyntaxError(token); } function select(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; elem.iter(tag, function(e) { if (e !== elem) { rv.push(e); } }); } return rv; } return select; } function prepare_dot_dot(next, token) { function select(context, result) { var i, len, elem, rv = [], parent_map = context.parent_map; if (!parent_map) { context.parent_map = parent_map = {}; context.root.iter(null, function(p) { p._children.forEach(function(e) { parent_map[e] = p; }); }); } for (i = 0, len = result.length; i < len; i++) { elem = result[i]; if (parent_map.hasOwnProperty(elem)) { rv.push(parent_map[elem]); } } return rv; } return select; } function prepare_predicate(next, token) { var tag, key, value, select; token = next(); if (token[1] === '@') { // attribute token = next(); if (token[1]) { throw new SyntaxError(token, 'Invalid attribute predicate'); } key = token[0]; token = next(); if (token[1] === ']') { select = function(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; if (elem.get(key)) { rv.push(elem); } } return rv; }; } else if (token[1] === '=') { value = next()[1]; if (value[0] === '"' || value[value.length - 1] === '\'') { value = value.slice(1, value.length - 1); } else { throw new SyntaxError(token, 'Ivalid comparison target'); } token = next(); select = function(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; if (elem.get(key) === value) { rv.push(elem); } } return rv; }; } if (token[1] !== ']') { throw new SyntaxError(token, 'Invalid attribute predicate'); } } else if (!token[1]) { tag = token[0] || ''; token = next(); if (token[1] !== ']') { throw new SyntaxError(token, 'Invalid node predicate'); } select = function(context, result) { var i, len, elem, rv = []; for (i = 0, len = result.length; i < len; i++) { elem = result[i]; if (elem.find(tag)) { rv.push(elem); } } return rv; }; } else { throw new SyntaxError(null, 'Invalid predicate'); } return select; } var ops = { "": prepare_tag, "*": prepare_star, ".": prepare_dot, "..": prepare_dot_dot, "//": prepare_iter, "[": prepare_predicate, }; function _SelectorContext(root) { this.parent_map = null; this.root = root; } function findall(elem, path) { var selector, result, i, len, token, value, select, context; if (_cache.hasOwnProperty(path)) { selector = _cache[path]; } else { // TODO: Use smarter cache purging approach if (Object.keys(_cache).length > 100) { _cache = {}; } if (path.charAt(0) === '/') { throw new SyntaxError(null, 'Cannot use absolute path on element'); } result = xpath_tokenizer(path); selector = []; function getToken() { return result.shift(); } token = getToken(); while (true) { var c = token[1] || ''; value = ops[c](getToken, token); if (!value) { throw new SyntaxError(null, sprintf('Invalid path: %s', path)); } selector.push(value); token = getToken(); if (!token) { break; } else if (token[1] === '/') { token = getToken(); } if (!token) { break; } } _cache[path] = selector; } // Execute slector pattern result = [elem]; context = new _SelectorContext(elem); for (i = 0, len = selector.length; i < len; i++) { select = selector[i]; result = select(context, result); } return result || []; } function find(element, path) { var resultElements = findall(element, path); if (resultElements && resultElements.length > 0) { return resultElements[0]; } return null; } function findtext(element, path, defvalue) { var resultElements = findall(element, path); if (resultElements && resultElements.length > 0) { return resultElements[0].text; } return defvalue; } exports.find = find; exports.findall = findall; exports.findtext = findtext;
zendey/Zendey
zendey/platforms/android/cordova/node_modules/elementtree/lib/elementpath.js
JavaScript
gpl-3.0
6,742
var now = require('../time/now') var timeout = require('./timeout') var append = require('../array/append') // ensure a minimum delay for callbacks function awaitDelay (fn, delay) { var baseTime = now() + delay return function () { // ensure all browsers will execute it asynchronously (avoid hard // to catch errors) not using "0" because of old browsers and also // since new browsers increase the value to be at least "4" // http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout var ms = Math.max(baseTime - now(), 4) return timeout.apply(this, append([fn, ms, this], arguments)) } } module.exports = awaitDelay
akileez/toolz
src/function/awaitDelay.js
JavaScript
isc
694
import chai from 'chai'; import cas from 'chai-as-promised'; chai.use(cas); export default { expect: chai.expect };
romeovs/all
test/instrument.js
JavaScript
isc
121
export type StyleToHexColor = Readonly<Record<string, string>>; export const styleToHexColor: StyleToHexColor = { orange: 'ff5f00', grayLight: '808080', 'gray-light': '808080', };
christophehurpeau/nightingale
packages/nightingale-formatter/src/styleToHexColor.ts
TypeScript
isc
187
'use strict'; var test = require('tap').test, _ = require('lodash'), parse = require('../../../lib/parsers/javascript'), inferMembership = require('../../../lib/infer/membership')(); function toComment(fn, file) { return parse({ file: file, source: fn instanceof Function ? '(' + fn.toString() + ')' : fn }); } function evaluate(fn, file) { return toComment(fn, file).map(inferMembership); } function Foo() {} function lend() {} test('inferMembership - explicit', function (t) { t.deepEqual(_.pick(evaluate(function () { /** * Test * @memberof Bar * @static */ Foo.bar = 0; })[0], ['memberof', 'scope']), { memberof: 'Bar', scope: 'static' }, 'explicit'); t.deepEqual(_.pick(evaluate(function () { /** Test */ Foo.bar = 0; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'implicit'); t.deepEqual(_.pick(evaluate(function () { /** Test */ Foo.prototype.bar = 0; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'instance' }, 'instance'); t.deepEqual(_.pick(evaluate(function () { /** Test */ Foo.bar.baz = 0; })[0], ['memberof', 'scope']), { memberof: 'Foo.bar', scope: 'static' }, 'compound'); t.deepEqual(_.pick(evaluate(function () { /** Test */ (0).baz = 0; })[0], ['memberof', 'scope']), { }, 'unknown'); t.deepEqual(_.pick(evaluate(function () { Foo.bar = { /** Test */ baz: 0 }; })[0], ['memberof', 'scope']), { memberof: 'Foo.bar', scope: 'static' }, 'static object assignment'); t.deepEqual(_.pick(evaluate(function () { Foo.prototype = { /** Test */ bar: 0 }; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'instance' }, 'instance object assignment'); t.deepEqual(_.pick(evaluate(function () { Foo.prototype = { /** * Test */ bar: function () {} }; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'instance' }, 'instance object assignment, function'); t.deepEqual(_.pick(evaluate(function () { var Foo = { /** Test */ baz: 0 }; return Foo; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'variable object assignment'); t.deepEqual(_.pick(evaluate(function () { var Foo = { /** Test */ baz: function () {} }; return Foo; })[0], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'variable object assignment, function'); t.deepEqual(_.pick(evaluate(function () { /** Test */ module.exports = function () {}; })[0], ['memberof', 'scope']), { memberof: 'module', scope: 'static' }, 'simple'); t.deepEqual(_.pick(evaluate(function () { lend(/** @lends Foo */{ /** Test */ bar: 0 }); })[1], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'lends, static'); t.deepEqual(_.pick(evaluate(function () { lend(/** @lends Foo */{ /** Test */ bar: function () {} }); })[1], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'inferMembership - lends, static, function'); t.deepEqual(_.pick(evaluate(function () { lend(/** @lends Foo.prototype */{ /** Test */ bar: 0 }); })[1], ['memberof', 'scope']), { memberof: 'Foo', scope: 'instance' }); t.deepEqual(_.pick(evaluate(function () { lend(/** @lends Foo.prototype */{ /** Test */ bar: function () {} }); })[1], ['memberof', 'scope']), { memberof: 'Foo', scope: 'instance' }, 'inferMembership - lends, instance, function'); t.deepEqual(_.pick(evaluate(function () { /** Foo */ function Foo() { /** Test */ function bar() {} return { bar: bar }; } })[1], ['memberof', 'scope']), { memberof: 'Foo', scope: 'static' }, 'inferMembership - revealing, static, function'); t.equal(evaluate(function () { lend(/** @lends Foo */{}); /** Test */ })[1].memberof, undefined, 'inferMembership - lends applies only to following object'); t.equal(evaluate(function () { lend(/** @lends Foo */{}); })[0], undefined, 'inferMembership - drops lends'); t.end(); }); test('inferMembership - exports', function (t) { t.equal(evaluate(function () { /** @module mod */ /** foo */ exports.foo = 1; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** @module mod */ /** foo */ exports.foo = function () {}; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** @module mod */ /** bar */ exports.foo.bar = 1; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ exports.foo = { /** bar */ bar: 1 }; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ exports.foo = { /** bar */ bar: function () {} }; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ /** bar */ exports.foo.prototype.bar = function () {}; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ exports.foo.prototype = { /** bar */ bar: function () {} }; })[1].memberof, 'mod.foo'); t.end(); }); test('inferMembership - module.exports', function (t) { t.equal(evaluate(function () { /** @module mod */ /** foo */ module.exports.foo = 1; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** @module mod */ /** foo */ module.exports.foo = function () {}; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** @module mod */ /** bar */ module.exports.foo.bar = 1; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ module.exports.foo = { /** bar */ bar: 1 }; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ module.exports.foo = { /** bar */ bar: function () {} }; })[1].memberof, 'mod.foo'); t.equal(evaluate(function () { /** @module mod */ /** bar */ module.exports.prototype.bar = function () {}; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** @module mod */ module.exports.prototype = { /** bar */ bar: function () {} }; })[1].memberof, 'mod'); t.equal(evaluate(function () { /** * @module mod * @name exports */ module.exports = 1; })[0].memberof, undefined); t.equal(evaluate(function () { /** * @module mod * @name exports */ module.exports = function () {}; })[0].memberof, undefined); t.equal(evaluate(function () { /** @module mod */ module.exports = { /** foo */ foo: 1 }; })[1].memberof, 'mod'); t.end(); }); test('inferMembership - not module exports', function (t) { var result = evaluate(function () { /** * @module mod */ /** Test */ global.module.exports.foo = 1; }, '/path/mod.js'); t.equal(result.length, 2); t.notEqual(result[0].memberof, 'mod'); t.end(); }); test('inferMembership - anonymous @module', function (t) { var result = evaluate(function () { /** * @module */ /** Test */ exports.foo = 1; }, '/path/mod.js'); t.equal(result.length, 2); t.equal(result[1].memberof, 'mod'); t.end(); }); test('inferMembership - no @module', function (t) { var result = evaluate(function () { /** Test */ exports.foo = 1; }, '/path/mod.js'); t.equal(result.length, 1); t.equal(result[0].memberof, 'mod'); t.end(); });
researchgate/documentation
test/lib/infer/membership.js
JavaScript
isc
7,692
// This takes in a set of pairs and writes them to the database. /*jshint node: true */ "use strict"; var csv = require('fast-csv'); var database = require('./database'); var data = csv.fromPath('team.csv', {headers : true}). on("data", function(datum) { database.writeUser({name: datum.User, location: datum.Location, active: true}); });
tahoemph/random_pairs
import_users.js
JavaScript
isc
345
import capitalize from './util/capitalize'; const unitNames = { npc_dota_roshan_spawner: 'Roshan', dota_item_rune_spawner_powerup: 'Rune', dota_item_rune_spawner_bounty: 'Bounty Rune', ent_dota_tree: 'Tree', npc_dota_healer: 'Shrine', ent_dota_fountain: 'Fountain', npc_dota_fort: 'Ancient', ent_dota_shop: 'Shop', npc_dota_tower: 'Tower', npc_dota_barracks: 'Barracks', npc_dota_filler: 'Building', npc_dota_watch_tower: 'Outpost', trigger_multiple: 'Neutral Camp Spawn Box', npc_dota_neutral_spawner: 'Neutral Camp', observer: 'Observer Ward', sentry: 'Sentry Ward', }; const getUnitName = (unitType, unitSubType) => (unitSubType ? `${capitalize(unitSubType.replace('tower', 'Tier ').replace('range', 'Ranged'))} ` : '') + unitNames[unitType]; const pullTypes = ['Normal', 'Fast', 'Slow']; const neutralTypes = ['Easy', 'Medium', 'Hard', 'Ancient']; const getPopupContent = (stats, feature) => { const dotaProps = feature.get('dotaProps'); const unitClass = dotaProps.subType ? `${dotaProps.id}_${dotaProps.subType}` : dotaProps.id; const unitStats = stats[unitClass]; let htmlContent = `<div class="info"><span class="info-header">${getUnitName(dotaProps.id, dotaProps.subType)}</span><span class="info-body">`; if (dotaProps.pullType != null) { htmlContent += `<br><span class="info-line">Pull Type: ${pullTypes[dotaProps.pullType]}</span>`; } if (dotaProps.neutralType != null) { htmlContent += `<br><span class="info-line">Difficulty: ${neutralTypes[dotaProps.neutralType]}</span>`; } if (stats && unitStats) { if (unitStats.hasOwnProperty('damageMin') && unitStats.hasOwnProperty('damageMax')) { htmlContent += `<br><span class="info-line">Damage: ${unitStats.damageMin}&ndash;${unitStats.damageMax}</span>`; } if (unitStats.hasOwnProperty('bat')) { htmlContent += `<br><span class="info-line">BAT: ${unitStats.bat}</span>`; } if (unitStats.hasOwnProperty('attackRange')) { htmlContent += `<br><span class="info-line">Attack Range: ${unitStats.attackRange}</span>`; } if (unitStats.hasOwnProperty('health')) { htmlContent += `<br><span class="info-line">Health: ${unitStats.health}</span>`; } if (unitStats.hasOwnProperty('armor')) { htmlContent += `<br><span class="info-line">Armor: ${unitStats.armor}</span>`; } if (unitStats.hasOwnProperty('dayVision') && unitStats.hasOwnProperty('nightVision')) { htmlContent += `<br><span class="info-line">Vision: ${unitStats.dayVision}/${unitStats.nightVision}</span>`; } } htmlContent += '</span></div>'; return htmlContent; }; export default getPopupContent;
devilesk/dota-interactive-map
src/js/getPopupContent.js
JavaScript
isc
2,819
package br.com.gestaoigrejas.sgi.model; import java.util.Date; import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import br.com.gestaoigrejas.sgi.enums.Status; import lombok.Getter; import lombok.Setter; @Entity @Getter @Setter @Table(name = "TB_TASK") public class Task { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "task_id") private Long id; @Basic(optional = false) @Column(name = "name", unique = false, length = 255) private String name; @Basic(optional = false) @Column(name = "description", unique = false, length = 5000) private String description; @Basic(optional = false) @Temporal(TemporalType.TIMESTAMP) @Column(name = "start_date", unique = false, length = 255) private Date startDate; @Basic(optional = false) @Temporal(TemporalType.TIMESTAMP) @Column(name = "end_date", unique = false, length = 255) private Date endDate; @Basic(optional = false) @Column(name = "completion_percentage", unique = false, length = 255) private Integer completionPercentage; @ManyToOne @JoinColumn(name = "project_id") private Project project; @OneToMany(mappedBy = "task") private List<Attachment> attachments; @Basic(optional = true) @Column(name = "observation", unique = false, length = 5000) private String observation; @Basic(optional = false) @Enumerated(EnumType.STRING) @Column(name = "status", unique = false, length = 50) private Status status; @Basic(optional = false) @Temporal(TemporalType.TIMESTAMP) @Column(name = "registration", unique = false, length = 50) private Date registration; @Basic(optional = false) @Temporal(TemporalType.TIMESTAMP) @Column(name = "last_update", unique = false, length = 50) private Date lastUpdate; @OneToOne @JoinColumn(name = "responsible_change_id") private Collaborator responsibleChange; }
danielpinna/sgi-back
src/main/java/br/com/gestaoigrejas/sgi/model/Task.java
Java
isc
2,343
package main import ( "log" "net/http" "github.com/dim13/gold/articles" ) type rss struct { URL string Title string Subtitle string Articles articles.Articles } func rssHandler(w http.ResponseWriter, r *http.Request) { app := conf.Blog.ArticlesPerPage a := art.Enabled().Limit(app) rss := rss{ URL: "http://" + r.Host, Title: conf.Blog.Title, Subtitle: conf.Blog.Subtitle, Articles: a, } err := tmpl.ExecuteTemplate(w, "rss.tmpl", rss) if err != nil { log.Println(err) } }
dim13/gold
rss.go
GO
isc
518
/** Markup under cursor and editing */ var Reflux=require("reflux"); var docfilestore=require("./docfile"); var markupNav=require("../markup/nav"); var markupStore=Reflux.createStore({ listenables:[require("../actions/markup")] ,markupsUnderCursor:[] ,ctrl_m_handler:null ,editing:null ,hovering:null ,onMarkupsUnderCursor:function(markupsUnderCursor) { //this.editing=null; if (this.markupsUnderCursor==markupsUnderCursor) return; this.markupsUnderCursor=markupsUnderCursor||[]; this.trigger(this.markupsUnderCursor,{cursor:true}); } ,getEditing:function() { return this.editing; } ,getNext:function() { if (!this.editing) return; return markupNav.next(this.editing.markup); } ,getPrev:function() { if (!this.editing) return; return markupNav.prev(this.editing.markup); } ,cancelEdit:function() { this.editing=null; this.ctrl_m_handler=null; } ,freeEditing:function() { if (!this.editing) return; this.editing.doc=null;//to notify markupselector shouldComponentUpdate } ,onEditMarkup:function(markup) { this.cancelEdit(); this.editing=markup; this.ctrl_m_handler=null; this.trigger([{doc:markup.handle.doc,key:markup.key,markup:markup}],{cursor:true}); } ,setEditing:function(markup,handler) { this.cancelEdit(); this.editing=markup; this.ctrl_m_handler=handler; //this.trigger([],{cursor:true}); this.trigger(markup,{editing:true}); } ,onSetHotkey:function(handler) { this.ctrl_m_handler=handler; //console.log("handler",handler,this); } ,remove:function(markup) { //console.log("remove markup",markup); this.cancelEdit(); var doc=markup.handle.doc; doc.getEditor().react.removeMarkup(markup.key); this.trigger([],{cursor:true}); } ,removeByMid:function(mid,file){ //console.log("remove mid in file",mid,file); var doc=docfilestore.docOf(file); doc.getEditor().react.removeMarkup(mid); this.trigger([],{cursor:true}); } ,onToggleMarkup:function(){ if (this.ctrl_m_handler) { this.ctrl_m_handler(); this.ctrl_m_handler=null;//fire once } } ,getHovering:function() { return this.hovering; } ,onHovering:function(m) { this.hovering=m; this.trigger(m,{hovering:true}); } ,onCreateMarkup:function(obj,cb) { if (!obj.typedef || !obj.typedef.mark) { console.log(obj); throw "cannot create markup" } this.editing=null; obj.typedef.mark(obj, docfilestore.docOf ,function(err,newmarkup){ this.markupsUnderCursor=newmarkup; this.trigger( this.markupsUnderCursor,{newly:true}); if (cb) cb(); }.bind(this)); } }) module.exports=markupStore;
ksanaforge/pannaloka
src/stores/markup.js
JavaScript
isc
2,579
/*jslint node: true*/ "use strict"; var fs = require('fs'), path = require('path'), util = require('util'), protocolHandler = {}, moment = require('moment'); protocolHandler.http = require('http'); protocolHandler.https = require('https'); function asArray(a) { if (Array.isArray(a)) { return a; } // else if (a === null || a === undefined) { return []; } // else return [a]; } function Client(settings) { var protocol = settings.protocol || "http"; this.handler = protocolHandler[protocol]; this.verbose = !!settings.verbose; // false if not set this.server = settings.server || "win-api.westtoer.be"; this.version = settings.version || "v1"; this.clientid = settings.clientid || "westtoer"; this.secret = settings.secret || "no-secret"; this.baseURI = protocol + "://" + this.server + "/api/" + this.version + "/"; this.authURI = protocol + "://" + this.server + "/oauth/v2/token?grant_type=client_credentials&client_id=" + encodeURIComponent(this.clientid) + "&client_secret=" + encodeURIComponent(this.secret); // we initialize in a stopped modus this.stop(); } Client.DEFAULT_PAGE = 1; Client.DEFAULT_SIZE = 10; function GenericQuery(tpl) { if (tpl !== undefined && tpl.constructor === GenericQuery) { // clone - constructor this.format = tpl.format; this.resources = tpl.resources.slice(0); this.touristictypes = tpl.touristictypes.slice(0); this.sizeVal = tpl.sizeVal; this.pageNum = tpl.pageNum; this.channels = tpl.channels.slice(0); this.lastmodRange = tpl.lastmodRange; this.softDelState = tpl.softDelState; this.pubState = tpl.pubState; this.bulkMode = tpl.bulkMode; this.partnerId = tpl.partnerId; this.keyvalset = tpl.keyvalset.slice(0); this.ownerEmail = tpl.ownerEmail; this.requiredFields = tpl.requiredFields.slice(0); this.selectId = tpl.selectId; this.selectMunicipal = tpl.selectMunicipal; this.machineName = tpl.machineName; this.anyTerm = tpl.anyTerm; } else { // nothing to clone, use defaults this.format = 'xml'; this.resources = ['accommodation']; //default zou alle types moeten kunnen bevatten this.touristictypes = []; this.sizeVal = Client.DEFAULT_SIZE; this.pageNum = Client.DEFAULT_PAGE; this.channels = []; this.requiredFields = []; this.keyvalset = []; this.bulkMode = false; } } GenericQuery.prototype.clone = function () { return new GenericQuery(this); }; // paging GenericQuery.prototype.page = function (page) { this.pageNum = Number(page) || Client.DEFAULT_PAGE; return this; }; GenericQuery.prototype.size = function (size) { this.sizeVal = Number(size) || 10; return this; }; // qrybuilder formats GenericQuery.prototype.asJSON_HAL = function () { this.format = 'json+hal'; return this; }; GenericQuery.prototype.asJSON = function () { this.format = 'json'; return this; }; GenericQuery.prototype.asXML = function () { this.format = 'xml'; return this; }; GenericQuery.prototype.bulk = function () { this.bulkMode = true; return this; }; //qrybuilder resource filter GenericQuery.prototype.forResources = function (newRsrc) { this.resources = asArray(newRsrc); return this; }; GenericQuery.prototype.andResource = function (singleRsrc) { this.resources.push(singleRsrc); return this; }; //qrybuilder type filter -- product queries GenericQuery.prototype.forTypes = function (newtypes) { return this.forResources(newtypes); }; GenericQuery.prototype.andType = function (singletype) { return this.andResource(singletype); }; //qrybuilder type filter -- vocabularies queries GenericQuery.prototype.forVocs = function () { return this.forResources(['vocabulary']); }; //qrybuilder type filter -- claims queries GenericQuery.prototype.forClaims = function () { return this.forResources(['product_claim']); }; //qrybuilder type filter -- statistical queries GenericQuery.prototype.forStats = function () { return this.forResources(['product_statistical_data']); }; //qrybuilder touristic_type filter GenericQuery.prototype.forTouristicTypes = function (newtypes) { this.touristictypes = asArray(newtypes); return this; }; GenericQuery.prototype.andTouristicType = function (singletype) { this.touristictypes.push(singletype); return this; }; //qrybuilder generic keyvals filter GenericQuery.prototype.andKeyVal = function (key, val) { this.keyvalset.push({"key": key, "val": val}); return this; }; //qrybuilder lastmod filter GenericQuery.prototype.lastmod = function (range) { this.lastmodRange = range; return this; }; function dateFormat(s) { if (s === undefined || s === null) { return "*"; } return moment(s).format('YYYY-MM-DD'); } GenericQuery.prototype.lastmodBetween = function (from, to) { var range = {}; if (from !== undefined && from !== null) { range.gte = dateFormat(from); } if (to !== undefined && to !== null) { range.lt = dateFormat(to); } return this.lastmod(range); // start boundary is inclusive, end-boundary is exclusive }; //qrybuilder delete filter GenericQuery.prototype.removed = function () { this.softDelState = true; return this; }; GenericQuery.prototype.active = function () { this.softDelState = false; return this; }; GenericQuery.prototype.ignoreRemoved = function () { this.softDelState = undefined; return this; }; //qrybuilder pubchannel filter GenericQuery.prototype.forChannels = function (chs) { this.channels = asArray(chs); return this; }; GenericQuery.prototype.andChannel = function (ch) { this.channels.push(ch); return this; }; GenericQuery.prototype.requirePubChannel = function () { return this.andChannel(".*"); }; //qrybuilder published filter GenericQuery.prototype.published = function () { this.pubState = true; return this; }; GenericQuery.prototype.hidden = function () { this.pubState = false; return this; }; GenericQuery.prototype.ignorePublished = function () { this.pubState = undefined; return this; }; //qrybuilder owner-email filtering GenericQuery.prototype.owner = function (email) { this.ownerEmail = email; return this; }; //qrybuilder partner-id filtering GenericQuery.prototype.partner = function (id) { this.partnerId = id; return this; }; //qrybuilder id filtering GenericQuery.prototype.id = function (id) { this.selectId = id; return this; }; //qrybuilder municipality filtering GenericQuery.prototype.municipality = function (muni) { this.selectMunicipal = muni; return this; }; //qrybuilder existingfields filter GenericQuery.prototype.requireFields = function (flds) { this.requiredFields = asArray(flds); return this; }; GenericQuery.prototype.andField = function (fld) { this.requiredFields.push(fld); return this; }; //qrybuilder vocname filtering GenericQuery.prototype.vocname = function (name) { this.machineName = name; return this; }; //qrybuilder stats-year filtering GenericQuery.prototype.statsyear = function (year) { this.statsYear = Number(year); return this; }; //qrybuilder any field matching GenericQuery.prototype.match = function (term) { this.anyTerm = term; return this; }; GenericQuery.addURI = function (key, value, unsetVal) { if (value === unsetVal) { return ""; } // else return "&" + key + "=" + encodeURIComponent(value); }; GenericQuery.addQuery = function (set, type, key, value) { if (Array.isArray(value)) { value = value.join(" "); } if (value === undefined || value === null || value === "") { return; } // else var rule = {}, qry = {}; rule[key] = value; qry[type] = rule; set.push(qry); }; GenericQuery.addMatchQuery = function (set, key, value) { GenericQuery.addQuery(set, "match", key, value); }; GenericQuery.addFuzzyQuery = function (set, key, value) { GenericQuery.addQuery(set, "fuzzy", key, value); }; GenericQuery.addTermsQuery = function (set, key, value) { GenericQuery.addQuery(set, "terms", key, value.split(/\s/)); }; GenericQuery.addRegExpQuery = function (set, key, value) { GenericQuery.addQuery(set, "regexp", key, value); }; GenericQuery.addRangeQuery = function (set, key, range) { GenericQuery.addQuery(set, "range", key, range); }; GenericQuery.addNestedQuery = function (set, path, subfn) { if (path === undefined) { return; } // else var subset = [], qry = {"bool": {"must": subset}}; subfn(subset); set.push({"nested": {"path": path, "query": qry}}); }; GenericQuery.addExistsFilters = function (set, fields) { fields.forEach(function (field) { if (field === undefined || field === null || field === "") { return; } set.push({"exists": {"field": field}}); }); }; GenericQuery.prototype.getURI = function (client, notoken) { notoken = notoken || false; var me = this, uri, esq = [], esf = [], query, queryNeeded = false, expired = client.token_expires < Date.now(); if (!notoken && (client.token === null || expired)) { throw new Error("client has no active (" + !expired + ") token (" + client.token + ")"); } if (this.resources === undefined || this.resources === null || this.resources.length === 0) { throw new Error("no types specified for fetch"); } uri = client.baseURI + (this.bulkMode ? "bulk/" : "") + this.resources.join(',') + "?format=" + this.format + "&access_token=" + (notoken ? "***" : encodeURIComponent(client.token)); if (!this.bulkMode) { // paging is meaningless in bulk mode uri += GenericQuery.addURI("size", this.sizeVal, Client.DEFAULT_SIZE); uri += GenericQuery.addURI("page", this.pageNum, Client.DEFAULT_PAGE); } GenericQuery.addRangeQuery(esq, "metadata.update_date", this.lastmodRange); GenericQuery.addMatchQuery(esq, "metadata.deleted", this.softDelState); GenericQuery.addMatchQuery(esq, "publishing_channels.published", this.pubState); GenericQuery.addMatchQuery(esq, "metadata.id", this.selectId); GenericQuery.addMatchQuery(esq, "location_info.address.municipality", this.selectMunicipal); this.keyvalset.forEach( function(kv) { GenericQuery.addMatchQuery(esq, kv.key, kv.val); }); GenericQuery.addFuzzyQuery(esq, "_all", this.anyTerm); GenericQuery.addExistsFilters(esf, this.requiredFields); if (this.channels.length > 0) { GenericQuery.addNestedQuery( esq, "publishing_channels.publishing_channel", function (subset) { GenericQuery.addRegExpQuery(subset, "publishing_channels.publishing_channel.code", me.channels); GenericQuery.addMatchQuery(subset, "publishing_channels.publishing_channel.published", true); } ); } GenericQuery.addMatchQuery(esq, "metadata.touristic_product_type.code", this.touristictypes); // specific for claims GenericQuery.addRegExpQuery(esq, "claims.claim.owner.email_address", this.ownerEmail); GenericQuery.addMatchQuery(esq, "metadata.partner_id", this.partnerId); // specific for vocabs GenericQuery.addMatchQuery(esq, "machine_name", this.machineName); // specific for stats GenericQuery.addMatchQuery(esq, "statistical_data_collection.year", this.statsYear); query = {"query" : {"filtered": {}}}; if (esq.length > 0) { queryNeeded = true; query.query.filtered.query = {"bool" : {"must": esq}}; } if (esf.length > 0) { queryNeeded = true; query.query.filtered.filter = {"bool" : {"must": esf}}; } if (queryNeeded) { uri += "&_query=" + encodeURIComponent(JSON.stringify(query)); } return uri; }; function getResponse(client, uri, cb, verbose) { verbose = verbose || false; if (verbose) { console.log("call uri [%s]", uri); } client.get(uri, function (res) { cb(null, res); }).on('error', function (e) { cb(e); }); } function streamData(client, uri, sink, cb, verbose) { getResponse(client, uri, function (e, res) { var stream; if (e) { sink.emit('error', e); } else if (res === undefined || res === null) { sink.emit('error', new Error("error reading uri [" + uri + "] - no response object.")); } else if (res.statusCode !== 200) { sink.emit('error', new Error("error reading uri [" + uri + "] to stream - response.status == " + res.statusCode)); } else { // all is well, so try sinking this data stream = res.pipe(sink); } cb(e, res, stream); }, verbose); } function getData(client, uri, cb, verbose) { getResponse(client, uri, function (e, res) { var data = ""; if (e) { return cb(e); } //else if (res === undefined || res === null) { return cb(new Error("error reading uri [" + uri + "] - no response object.")); } if (res.statusCode !== 200) { return cb(new Error("error reading uri [" + uri + "] - status == " + res.statusCode)); } // else res .on('data', function (chunk) { data += chunk; }) .on('end', function () { cb(null, data); }) .on('error', cb); }, verbose); } function getJSON(client, uri, cb, verbose) { getData(client, uri, function (e, data) { if (e) { return cb(e); } //else cb(null, JSON.parse(data)); }, verbose); } function getXML(client, uri, cb, verbose) { //TODO parse XML to DOM ? getData(client, uri, cb, verbose); } Client.prototype.stop = function () { clearTimeout(this.token_refresh); this.token = null; this.token_expires = Date.now(); this.token_refresh = null; }; Client.prototype.start = function (cb) { cb = cb || function () {return; }; var me = this, SLACK_MILLIS = 1000, exp_in_millis; if (me.token_refresh !== null) { // already started... if (cb) { return cb(null); // no errors, but no token object either } return; } // else getJSON(this.handler, this.authURI, function (e, resp) { if (e) { console.error("getjson ERROR: %j", e); return cb(e); } me.token = resp.access_token; exp_in_millis = resp.expires_in * 1000; me.token_expires = Date.now() + exp_in_millis; if (exp_in_millis > SLACK_MILLIS) { // we assume at least 1s slack to operate me.token_refresh = setTimeout(function () { me.start(); }, exp_in_millis - SLACK_MILLIS); } else { console.warn("token validity too short to organize self-refresh"); } if (me.verbose) { console.log("got token %s - valid for %d - till %s", me.token, resp.expires_in, moment(me.token_expires)); } cb(e, resp); }, this.verbose); }; Client.prototype.fetch = function (qry, cb) { if (arguments.length < 2) { cb = qry; qry = new GenericQuery(); } try { if (qry.format === 'json') { getJSON(this.handler, qry.getURI(this), function (e, resp) { cb(e, resp); }, this.verbose); } else if (qry.format === 'json+hal') { getJSON(this.handler, qry.getURI(this), function (e, resp) { if (e) { return cb(e); } // else var meta = resp, EMB = "_embedded", emb = meta[EMB]; resp = emb.items; delete emb.items; cb(e, resp, meta); }, this.verbose); } else if (qry.format === 'xml') { getXML(this.handler, qry.getURI(this), function (e, resp) { cb(e, resp); }, this.verbose); } } catch (e) { cb(e); } }; Client.prototype.stream = function (qry, sink, cb) { if (arguments.length < 2) { sink = qry; qry = new GenericQuery(); } cb = cb || function () { return; }; // do nothing callback try { streamData(this.handler, qry.getURI(this), sink, cb, this.verbose); } catch (e) { cb(e, null); } }; Client.prototype.parseVocabularyCodes = function (vocabs, onlyNames) { return vocabs.reduce(function (byName, voc) { var name = voc.machine_name; if (onlyNames === undefined || onlyNames.indexOf(name) !== -1) { if (byName.hasOwnProperty(name)) { throw new Error("duplicate key machine_name : " + name); } if (voc && voc.terms && voc.terms.term) { byName[name] = Object.keys(voc.terms.term.reduce(function (res, term) { var code = term.code || ""; if (code.length === 0) { throw new Error("invalid empty code '' for vocabulary: " + name); } if (res.hasOwnProperty(code)) { throw new Error("duplicate code '" + code + "' for vocabulary: " + name); } res[code] = term; return res; }, {})); // byName[name] = voc.terms.term.map(function (term) { // var code = term.code || ""; // if (code.length === 0) { // throw new Error("invalid empty code '' for vocabulary: " + name); // } // return code; // }); } else { byName[name] = []; } } return byName; }, {}); }; Client.prototype.parseVocabularyTrees = function (vocabs, onlyNames) { return vocabs.reduce(function (byName, voc) { var name = voc.machine_name, termRoot = {children: []}, termNodes; if (onlyNames === undefined || onlyNames.indexOf(name) !== -1) { if (byName.hasOwnProperty(name)) { throw new Error("duplicate key machine_name : " + name); } if (voc && voc.terms && voc.terms.term && voc.hierarchy) { // list all linkable nodes termNodes = voc.terms.term.reduce(function (tns, term) { var code = term.code || "", pcode = term.parent_code || ""; if (code.length === 0) { throw new Error("invalid empty code '' for vocabulary: " + name); } if (tns.hasOwnProperty(code)) { throw new Error("duplicate code '" + code + "' for vocabulary: " + name); } tns[code] = { code: code, parent: pcode, children: [] }; return tns; }, {}); // link parents and children Object.keys(termNodes).forEach(function (code) { var tn = termNodes[code], pn = tn.parent === "" ? termRoot : termNodes[tn.parent]; if (pn === null || pn === undefined) { throw new Error("not found node for parent_code '" + tn.parent + "' in voc named: " + name); } tn.parent = pn; pn.children.push(tn); }); byName[name] = termRoot.children; } else { byName[name] = null; } } return byName; }, {}); }; module.exports.client = function (settings) { return new Client(settings); }; module.exports.query = function (service) { service = service || 'product'; if (service === 'product') { return new GenericQuery(); } if (service === 'vocabulary') { return new GenericQuery().forVocs(); } if (service === 'claim') { return new GenericQuery().forClaims(); } if (service === 'statistics') { return new GenericQuery().forStats(); } throw "unknown service request"; };
westtoer/node-winapi
lib/winapi.js
JavaScript
isc
20,578
<?php namespace MooPhp\MooInterface\Request; use MooPhp\Api; use MooPhp\MooInterface\Data\ImageBasket; use MooPhp\MooInterface\Data\Side; /** * @package MooPhp * @author Jonathan Oddy <jonathan@moo.com> * @copyright Copyright (c) 2012, Moo Print Ltd. */ class RenderSideUrl extends CommonRenderSide { public function __construct() { parent::__construct("moo.pack.renderSideUrl", self::HTTP_POST); } }
moodev/moo-php
lib/MooPhp/MooInterface/Request/RenderSideUrl.php
PHP
isc
429
/* * Copyright (c) 2011 Pierre-Etienne Bougué <pe.bougue(a)gmail.com> * Copyright (c) 2011 Florian Colin <florian.colin28(a)gmail.com> * Copyright (c) 2011 Kamal Fadlaoui <kamal.fadlaoui(a)gmail.com> * Copyright (c) 2011 Quentin Lequy <quentin.lequy(a)gmail.com> * Copyright (c) 2011 Guillaume Pinot <guillaume.pinot(a)tremplin-utc.net> * Copyright (c) 2011 Cédric Royer <cedroyer(a)gmail.com> * Copyright (c) 2011 Guillaume Turri <guillaume.turri(a)gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include "SolutionALG.hh" #include "RestrictionALG.hh" #include "ConstraintSystemALG.hh" #include "EvaluationSystemALG.hh" #include <list> const SolutionALG::MachineId SolutionALG::unassigned = -1; const SolutionALG::MachineId SolutionALG::failToAssign = -2; SolutionALG::SolutionALG(size_t nbProcesses_p) :assignment_m(nbProcesses_p,unassigned),incrementalValue_m(0.0) { } SolutionALG::~SolutionALG() { for (RestrictionPool::const_iterator it_l = restrictions_m.begin(); it_l != restrictions_m.end(); ++it_l) { RestrictionALG * pRestriction_l = *it_l; if (pRestriction_l != pConstraintSystem_m) delete pRestriction_l; } } void SolutionALG::unassign(ProcessId process_p) { pConstraintSystem_m->unassign(process_p, assignment_m[process_p]); assignment_m[process_p] = unassigned; } void SolutionALG::assign(ProcessId process_p, MachineId machine_p) { assignment_m[process_p] = machine_p; pConstraintSystem_m->assign(process_p, machine_p); } double SolutionALG::evaluate() { return pEvaluationSystem_m->evaluate(assignment_m); } std::vector<SolutionALG::ProcessId> SolutionALG::getAvaiableProcesses() const { std::vector<SolutionALG::ProcessId> return_l; std::vector<ProcessId> unassigned_l; ProcessId current_l = 0; ProcessId end_l = assignment_m.size(); for( ; current_l < end_l; ++current_l) { if (assignment_m[current_l] == unassigned) { unassigned_l.push_back(current_l); } } for (RestrictionPool::const_iterator it_l = restrictions_m.begin(); it_l != restrictions_m.end(); ++it_l) { RestrictionALG * pRestriction_l = *it_l; pRestriction_l->filter(unassigned_l); } return_l.insert(return_l.begin(), unassigned_l.begin(), unassigned_l.end()); return return_l; } std::vector<SolutionALG::MachineId> SolutionALG::getAvaiableMachines(ProcessId process_p) const { std::vector<SolutionALG::MachineId> return_l; std::vector<MachineId> possibles_l = pConstraintSystem_m->getLegalMachinePool(process_p); for (RestrictionPool::const_iterator it_l = restrictions_m.begin(); it_l != restrictions_m.end(); ++it_l) { RestrictionALG * pRestriction_l = *it_l; pRestriction_l->filter(process_p,possibles_l); } return_l.insert(return_l.begin(), possibles_l.begin(), possibles_l.end()); return return_l; } void SolutionALG::addRestriction(RestrictionALG * pRestriction_p) { restrictions_m.push_back(pRestriction_p); } void SolutionALG::setpConstraintSystem(ConstraintSystemALG * pSystem_p) { pConstraintSystem_m = pSystem_p; addRestriction(pConstraintSystem_m); } void SolutionALG::setpEvaluationSystem(EvaluationSystemALG * pSystem_p) { pEvaluationSystem_m = pSystem_p; }
gturri/roadef2012
src/alg/MCTS/SolutionALG.cc
C++
isc
4,222
// Copyright (c) 2014 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package btcjson_test import ( "encoding/json" "reflect" "testing" "github.com/adiabat/btcd/btcjson" ) // TestIsValidIDType ensures the IsValidIDType function behaves as expected. func TestIsValidIDType(t *testing.T) { t.Parallel() tests := []struct { name string id interface{} isValid bool }{ {"int", int(1), true}, {"int8", int8(1), true}, {"int16", int16(1), true}, {"int32", int32(1), true}, {"int64", int64(1), true}, {"uint", uint(1), true}, {"uint8", uint8(1), true}, {"uint16", uint16(1), true}, {"uint32", uint32(1), true}, {"uint64", uint64(1), true}, {"string", "1", true}, {"nil", nil, true}, {"float32", float32(1), true}, {"float64", float64(1), true}, {"bool", true, false}, {"chan int", make(chan int), false}, {"complex64", complex64(1), false}, {"complex128", complex128(1), false}, {"func", func() {}, false}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { if btcjson.IsValidIDType(test.id) != test.isValid { t.Errorf("Test #%d (%s) valid mismatch - got %v, "+ "want %v", i, test.name, !test.isValid, test.isValid) continue } } } // TestMarshalResponse ensures the MarshalResponse function works as expected. func TestMarshalResponse(t *testing.T) { t.Parallel() testID := 1 tests := []struct { name string result interface{} jsonErr *btcjson.RPCError expected []byte }{ { name: "ordinary bool result with no error", result: true, jsonErr: nil, expected: []byte(`{"result":true,"error":null,"id":1}`), }, { name: "result with error", result: nil, jsonErr: func() *btcjson.RPCError { return btcjson.NewRPCError(btcjson.ErrRPCBlockNotFound, "123 not found") }(), expected: []byte(`{"result":null,"error":{"code":-5,"message":"123 not found"},"id":1}`), }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { _, _ = i, test marshalled, err := btcjson.MarshalResponse(testID, test.result, test.jsonErr) if err != nil { t.Errorf("Test #%d (%s) unexpected error: %v", i, test.name, err) continue } if !reflect.DeepEqual(marshalled, test.expected) { t.Errorf("Test #%d (%s) mismatched result - got %s, "+ "want %s", i, test.name, marshalled, test.expected) } } } // TestMiscErrors tests a few error conditions not covered elsewhere. func TestMiscErrors(t *testing.T) { t.Parallel() // Force an error in NewRequest by giving it a parameter type that is // not supported. _, err := btcjson.NewRequest(nil, "test", []interface{}{make(chan int)}) if err == nil { t.Error("NewRequest: did not receive error") return } // Force an error in MarshalResponse by giving it an id type that is not // supported. wantErr := btcjson.Error{ErrorCode: btcjson.ErrInvalidType} _, err = btcjson.MarshalResponse(make(chan int), nil, nil) if jerr, ok := err.(btcjson.Error); !ok || jerr.ErrorCode != wantErr.ErrorCode { t.Errorf("MarshalResult: did not receive expected error - got "+ "%v (%[1]T), want %v (%[2]T)", err, wantErr) return } // Force an error in MarshalResponse by giving it a result type that // can't be marshalled. _, err = btcjson.MarshalResponse(1, make(chan int), nil) if _, ok := err.(*json.UnsupportedTypeError); !ok { wantErr := &json.UnsupportedTypeError{} t.Errorf("MarshalResult: did not receive expected error - got "+ "%v (%[1]T), want %T", err, wantErr) return } } // TestRPCError tests the error output for the RPCError type. func TestRPCError(t *testing.T) { t.Parallel() tests := []struct { in *btcjson.RPCError want string }{ { btcjson.ErrRPCInvalidRequest, "-32600: Invalid request", }, { btcjson.ErrRPCMethodNotFound, "-32601: Method not found", }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { result := test.in.Error() if result != test.want { t.Errorf("Error #%d\n got: %s want: %s", i, result, test.want) continue } } }
adiabat/btcd
btcjson/jsonrpc_test.go
GO
isc
4,149
//////////////////////////////////////////////////////////////////////////////// // GaProject.cpp // Includes #include "GaProject.h" // Games #include "PgMain.h" pgMain project; //////////////////////////////////////////////////////////////////////////////// // Init void GaProject::Create() { project.Create(); } //////////////////////////////////////////////////////////////////////////////// // Init void GaProject::Init() { project.Init(); } //////////////////////////////////////////////////////////////////////////////// // Reset void GaProject::Reset() { project.Reset(); } //////////////////////////////////////////////////////////////////////////////// // Update void GaProject::Update() { project.Update(); } //////////////////////////////////////////////////////////////////////////////// // Render void GaProject::Render() { project.Render(); } //////////////////////////////////////////////////////////////////////////////// // Destroy void GaProject::Destroy() { project.Destroy(); } //////////////////////////////////////////////////////////////////////////////// // SetClosing void GaProject::SetClosing() { project.SetClosing(); } //////////////////////////////////////////////////////////////////////////////// // IsClosed BtBool GaProject::IsClosed() { return project.IsClosed(); } //////////////////////////////////////////////////////////////////////////////// // IsClosing BtBool GaProject::IsClosing() { return project.IsClosing(); }
thecreativeexchange/labella
OpenLab_Apps/LabellaApp/Mirror/GaProject.cpp
C++
isc
1,487
// Generated by typings // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e0abafb1a6ff652f7ff967120e312d5c1916eaef/lodash/lodash.d.ts declare var _: _.LoDashStatic; declare module _ { interface LoDashStatic { /** * Creates a lodash object which wraps the given value to enable intuitive method chaining. * * In addition to Lo-Dash methods, wrappers also have the following Array methods: * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift * * Chaining is supported in custom builds as long as the value method is implicitly or * explicitly included in the build. * * The chainable wrapper functions are: * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, * keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unset, unshift, unzip, values, where, without, wrap, and zip * * The non-chainable wrapper functions are: * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, * sortedIndex, runInContext, template, unescape, uniqueId, and value * * The wrapper functions first and last return wrapped values when n is provided, otherwise * they return unwrapped values. * * Explicit chaining can be enabled by using the _.chain method. **/ (value: number): LoDashImplicitWrapper<number>; (value: string): LoDashImplicitStringWrapper; (value: boolean): LoDashImplicitWrapper<boolean>; (value: Array<number>): LoDashImplicitNumberArrayWrapper; <T>(value: Array<T>): LoDashImplicitArrayWrapper<T>; <T extends {}>(value: T): LoDashImplicitObjectWrapper<T>; (value: any): LoDashImplicitWrapper<any>; /** * The semantic version number. **/ VERSION: string; /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ templateSettings: TemplateSettings; } /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ interface TemplateSettings { /** * The "escape" delimiter. **/ escape?: RegExp; /** * The "evaluate" delimiter. **/ evaluate?: RegExp; /** * An object to import into the template as local variables. **/ imports?: Dictionary<any>; /** * The "interpolate" delimiter. **/ interpolate?: RegExp; /** * Used to reference the data object in the template text. **/ variable?: string; } /** * Creates a cache object to store key/value pairs. */ interface MapCache { /** * Removes `key` and its value from the cache. * @param key The key of the value to remove. * @return Returns `true` if the entry was removed successfully, else `false`. */ delete(key: string): boolean; /** * Gets the cached value for `key`. * @param key The key of the value to get. * @return Returns the cached value. */ get(key: string): any; /** * Checks if a cached value for `key` exists. * @param key The key of the entry to check. * @return Returns `true` if an entry for `key` exists, else `false`. */ has(key: string): boolean; /** * Sets `value` to `key` of the cache. * @param key The key of the value to cache. * @param value The value to cache. * @return Returns the cache object. */ set(key: string, value: any): _.Dictionary<any>; } interface LoDashWrapperBase<T, TWrapper> { } interface LoDashImplicitWrapperBase<T, TWrapper> extends LoDashWrapperBase<T, TWrapper> { } interface LoDashExplicitWrapperBase<T, TWrapper> extends LoDashWrapperBase<T, TWrapper> { } interface LoDashImplicitWrapper<T> extends LoDashImplicitWrapperBase<T, LoDashImplicitWrapper<T>> { } interface LoDashExplicitWrapper<T> extends LoDashExplicitWrapperBase<T, LoDashExplicitWrapper<T>> { } interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper<string> { } interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper<string> { } interface LoDashImplicitObjectWrapper<T> extends LoDashImplicitWrapperBase<T, LoDashImplicitObjectWrapper<T>> { } interface LoDashExplicitObjectWrapper<T> extends LoDashExplicitWrapperBase<T, LoDashExplicitObjectWrapper<T>> { } interface LoDashImplicitArrayWrapper<T> extends LoDashImplicitWrapperBase<T[], LoDashImplicitArrayWrapper<T>> { pop(): T; push(...items: T[]): LoDashImplicitArrayWrapper<T>; shift(): T; sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper<T>; splice(start: number): LoDashImplicitArrayWrapper<T>; splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper<T>; unshift(...items: T[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> extends LoDashExplicitWrapperBase<T[], LoDashExplicitArrayWrapper<T>> { } interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper<number> { } interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper<number> { } /********* * Array * *********/ //_.chunk interface LoDashStatic { /** * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the * final chunk will be the remaining elements. * * @param array The array to process. * @param size The length of each chunk. * @return Returns the new array containing chunks. */ chunk<T>( array: List<T>, size?: number ): T[][]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.chunk */ chunk(size?: number): LoDashImplicitArrayWrapper<T[]>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.chunk */ chunk<TResult>(size?: number): LoDashImplicitArrayWrapper<TResult[]>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.chunk */ chunk(size?: number): LoDashExplicitArrayWrapper<T[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.chunk */ chunk<TResult>(size?: number): LoDashExplicitArrayWrapper<TResult[]>; } //_.compact interface LoDashStatic { /** * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are * falsey. * * @param array The array to compact. * @return (Array) Returns the new array of filtered values. */ compact<T>(array?: List<T>): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.compact */ compact(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.compact */ compact<TResult>(): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.compact */ compact(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.compact */ compact<TResult>(): LoDashExplicitArrayWrapper<TResult>; } //_.concat DUMMY interface LoDashStatic { /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. * @returns {Array} Returns the new concatenated array. * @example * * var array = [1]; * var other = _.concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] * * console.log(array); * // => [1] */ concat<T>(...values: (T[]|List<T>)[]) : T[]; } //_.difference interface LoDashStatic { /** * Creates an array of unique array values not included in the other provided arrays using SameValueZero for * equality comparisons. * * @param array The array to inspect. * @param values The arrays of values to exclude. * @return Returns the new array of filtered values. */ difference<T>( array: T[]|List<T>, ...values: Array<T[]|List<T>> ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.difference */ difference(...values: (T[]|List<T>)[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.difference */ difference<TValue>(...values: (TValue[]|List<TValue>)[]): LoDashImplicitArrayWrapper<TValue>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.difference */ difference(...values: (T[]|List<T>)[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.difference */ difference<TValue>(...values: (TValue[]|List<TValue>)[]): LoDashExplicitArrayWrapper<TValue>; } //_.differenceBy interface LoDashStatic { /** * This method is like _.difference except that it accepts iteratee which is invoked for each element of array * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one * argument: (value). * * @param array The array to inspect. * @param values The values to exclude. * @param iteratee The iteratee invoked per element. * @returns Returns the new array of filtered values. */ differenceBy<T>( array: T[]|List<T>, values?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): T[]; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( array: T[]|List<T>, values?: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.differenceBy */ differenceBy<T>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): T[]; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.differenceBy */ differenceBy<T>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): T[]; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.differenceBy */ differenceBy<T>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): T[]; /** * @see _.differenceBy */ differenceBy<T>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): T[]; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( array: T[]|List<T>, values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.differenceBy */ differenceBy<T>( array: T[]|List<T>, ...values: any[] ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.differenceBy */ differenceBy<T>( values?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( ...values: any[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.differenceBy */ differenceBy<T>( values?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( ...values: any[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.differenceBy */ differenceBy<T>( values?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( ...values: any[] ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.differenceBy */ differenceBy<T>( values?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: ((value: T) => any)|string ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T, W extends Object>( values1?: T[]|List<T>, values2?: T[]|List<T>, values3?: T[]|List<T>, values4?: T[]|List<T>, values5?: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.differenceBy */ differenceBy<T>( ...values: any[] ): LoDashExplicitArrayWrapper<T>; } //_.differenceWith DUMMY interface LoDashStatic { /** * Creates an array of unique `array` values not included in the other * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.difference([3, 2, 1], [4, 2]); * // => [3, 1] */ differenceWith( array: any[]|List<any>, ...values: any[] ): any[]; } //_.drop interface LoDashStatic { /** * Creates a slice of array with n elements dropped from the beginning. * * @param array The array to query. * @param n The number of elements to drop. * @return Returns the slice of array. */ drop<T>(array: T[]|List<T>, n?: number): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.drop */ drop(n?: number): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.drop */ drop<T>(n?: number): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.drop */ drop(n?: number): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.drop */ drop<T>(n?: number): LoDashExplicitArrayWrapper<T>; } //_.dropRight interface LoDashStatic { /** * Creates a slice of array with n elements dropped from the end. * * @param array The array to query. * @param n The number of elements to drop. * @return Returns the slice of array. */ dropRight<T>( array: List<T>, n?: number ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.dropRight */ dropRight(n?: number): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.dropRight */ dropRight<TResult>(n?: number): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.dropRight */ dropRight(n?: number): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.dropRight */ dropRight<TResult>(n?: number): LoDashExplicitArrayWrapper<TResult>; } //_.dropRightWhile interface LoDashStatic { /** * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * match the properties of the given object, else false. * * @param array The array to query. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ dropRightWhile<TValue>( array: List<TValue>, predicate?: ListIterator<TValue, boolean> ): TValue[]; /** * @see _.dropRightWhile */ dropRightWhile<TValue>( array: List<TValue>, predicate?: string ): TValue[]; /** * @see _.dropRightWhile */ dropRightWhile<TWhere, TValue>( array: List<TValue>, predicate?: TWhere ): TValue[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.dropRightWhile */ dropRightWhile( predicate?: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.dropRightWhile */ dropRightWhile( predicate?: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.dropRightWhile */ dropRightWhile<TWhere>( predicate?: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.dropRightWhile */ dropRightWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.dropRightWhile */ dropRightWhile<TValue>( predicate?: string ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.dropRightWhile */ dropRightWhile<TWhere, TValue>( predicate?: TWhere ): LoDashImplicitArrayWrapper<TValue>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.dropRightWhile */ dropRightWhile( predicate?: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.dropRightWhile */ dropRightWhile( predicate?: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.dropRightWhile */ dropRightWhile<TWhere>( predicate?: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.dropRightWhile */ dropRightWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.dropRightWhile */ dropRightWhile<TValue>( predicate?: string ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.dropRightWhile */ dropRightWhile<TWhere, TValue>( predicate?: TWhere ): LoDashExplicitArrayWrapper<TValue>; } //_.dropWhile interface LoDashStatic { /** * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param array The array to query. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ dropWhile<TValue>( array: List<TValue>, predicate?: ListIterator<TValue, boolean> ): TValue[]; /** * @see _.dropWhile */ dropWhile<TValue>( array: List<TValue>, predicate?: string ): TValue[]; /** * @see _.dropWhile */ dropWhile<TWhere, TValue>( array: List<TValue>, predicate?: TWhere ): TValue[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.dropWhile */ dropWhile( predicate?: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.dropWhile */ dropWhile( predicate?: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.dropWhile */ dropWhile<TWhere>( predicate?: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.dropWhile */ dropWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.dropWhile */ dropWhile<TValue>( predicate?: string ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.dropWhile */ dropWhile<TWhere, TValue>( predicate?: TWhere ): LoDashImplicitArrayWrapper<TValue>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.dropWhile */ dropWhile( predicate?: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.dropWhile */ dropWhile( predicate?: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.dropWhile */ dropWhile<TWhere>( predicate?: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.dropWhile */ dropWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.dropWhile */ dropWhile<TValue>( predicate?: string ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.dropWhile */ dropWhile<TWhere, TValue>( predicate?: TWhere ): LoDashExplicitArrayWrapper<TValue>; } //_.fill interface LoDashStatic { /** * Fills elements of array with value from start up to, but not including, end. * * Note: This method mutates array. * * @param array The array to fill. * @param value The value to fill array with. * @param start The start position. * @param end The end position. * @return Returns array. */ fill<T>( array: any[], value: T, start?: number, end?: number ): T[]; /** * @see _.fill */ fill<T>( array: List<any>, value: T, start?: number, end?: number ): List<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.fill */ fill<T>( value: T, start?: number, end?: number ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.fill */ fill<T>( value: T, start?: number, end?: number ): LoDashImplicitObjectWrapper<List<T>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.fill */ fill<T>( value: T, start?: number, end?: number ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.fill */ fill<T>( value: T, start?: number, end?: number ): LoDashExplicitObjectWrapper<List<T>>; } //_.findIndex interface LoDashStatic { /** * This method is like _.find except that it returns the index of the first element predicate returns truthy * for instead of the element itself. * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param array The array to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the index of the found element, else -1. */ findIndex<T>( array: List<T>, predicate?: ListIterator<T, boolean> ): number; /** * @see _.findIndex */ findIndex<T>( array: List<T>, predicate?: string ): number; /** * @see _.findIndex */ findIndex<W, T>( array: List<T>, predicate?: W ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.findIndex */ findIndex( predicate?: ListIterator<T, boolean> ): number; /** * @see _.findIndex */ findIndex( predicate?: string ): number; /** * @see _.findIndex */ findIndex<W>( predicate?: W ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.findIndex */ findIndex<TResult>( predicate?: ListIterator<TResult, boolean> ): number; /** * @see _.findIndex */ findIndex( predicate?: string ): number; /** * @see _.findIndex */ findIndex<W>( predicate?: W ): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.findIndex */ findIndex( predicate?: ListIterator<T, boolean> ): LoDashExplicitWrapper<number>; /** * @see _.findIndex */ findIndex( predicate?: string ): LoDashExplicitWrapper<number>; /** * @see _.findIndex */ findIndex<W>( predicate?: W ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.findIndex */ findIndex<TResult>( predicate?: ListIterator<TResult, boolean> ): LoDashExplicitWrapper<number>; /** * @see _.findIndex */ findIndex( predicate?: string ): LoDashExplicitWrapper<number>; /** * @see _.findIndex */ findIndex<W>( predicate?: W ): LoDashExplicitWrapper<number>; } //_.findLastIndex interface LoDashStatic { /** * This method is like _.findIndex except that it iterates over elements of collection from right to left. * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param array The array to search. * @param predicate The function invoked per iteration. * @param thisArg The function invoked per iteration. * @return Returns the index of the found element, else -1. */ findLastIndex<T>( array: List<T>, predicate?: ListIterator<T, boolean> ): number; /** * @see _.findLastIndex */ findLastIndex<T>( array: List<T>, predicate?: string ): number; /** * @see _.findLastIndex */ findLastIndex<W, T>( array: List<T>, predicate?: W ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.findLastIndex */ findLastIndex( predicate?: ListIterator<T, boolean> ): number; /** * @see _.findLastIndex */ findLastIndex( predicate?: string ): number; /** * @see _.findLastIndex */ findLastIndex<W>( predicate?: W ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.findLastIndex */ findLastIndex<TResult>( predicate?: ListIterator<TResult, boolean> ): number; /** * @see _.findLastIndex */ findLastIndex( predicate?: string ): number; /** * @see _.findLastIndex */ findLastIndex<W>( predicate?: W ): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.findLastIndex */ findLastIndex( predicate?: ListIterator<T, boolean> ): LoDashExplicitWrapper<number>; /** * @see _.findLastIndex */ findLastIndex( predicate?: string ): LoDashExplicitWrapper<number>; /** * @see _.findLastIndex */ findLastIndex<W>( predicate?: W ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.findLastIndex */ findLastIndex<TResult>( predicate?: ListIterator<TResult, boolean> ): LoDashExplicitWrapper<number>; /** * @see _.findLastIndex */ findLastIndex( predicate?: string ): LoDashExplicitWrapper<number>; /** * @see _.findLastIndex */ findLastIndex<W>( predicate?: W ): LoDashExplicitWrapper<number>; } //_.first interface LoDashStatic { /** * @see _.head */ first<T>(array: List<T>): T; } interface LoDashImplicitWrapper<T> { /** * @see _.head */ first(): string; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.head */ first(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.head */ first<T>(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.head */ first(): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.head */ first<T>(): T; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.head */ first<T>(): T; } interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {} interface ListOfRecursiveArraysOrValues<T> extends List<T|RecursiveArray<T>> {} //_.flatten interface LoDashStatic { /** * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only * flattened a single level. * * @param array The array to flatten. * @param isDeep Specify a deep flatten. * @return Returns the new flattened array. */ flatten<T>(array: ListOfRecursiveArraysOrValues<T>, isDeep: boolean): T[]; /** * @see _.flatten */ flatten<T>(array: List<T|T[]>): T[]; /** * @see _.flatten */ flatten<T>(array: ListOfRecursiveArraysOrValues<T>): RecursiveArray<T>; } interface LoDashImplicitWrapper<T> { /** * @see _.flatten */ flatten(): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.flatten */ flatten<TResult>(isDeep?: boolean): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flatten */ flatten<TResult>(isDeep?: boolean): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.flatten */ flatten(): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.flatten */ flatten<TResult>(isDeep?: boolean): LoDashExplicitArrayWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flatten */ flatten<TResult>(isDeep?: boolean): LoDashExplicitArrayWrapper<TResult>; } //_.flattenDeep interface LoDashStatic { /** * Recursively flattens a nested array. * * @param array The array to recursively flatten. * @return Returns the new flattened array. */ flattenDeep<T>(array: ListOfRecursiveArraysOrValues<T>): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.flattenDeep */ flattenDeep(): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.flattenDeep */ flattenDeep<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flattenDeep */ flattenDeep<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.flattenDeep */ flattenDeep(): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.flattenDeep */ flattenDeep<T>(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flattenDeep */ flattenDeep<T>(): LoDashExplicitArrayWrapper<T>; } //_.fromPairs DUMMY interface LoDashStatic { /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['fred', 30], ['barney', 40]]); * // => { 'fred': 30, 'barney': 40 } */ fromPairs( array: any[]|List<any> ): Dictionary<any>; } //_.fromPairs DUMMY interface LoDashImplicitArrayWrapper<T> { /** * @see _.fromPairs */ fromPairs(): LoDashImplicitObjectWrapper<any>; } //_.fromPairs DUMMY interface LoDashExplicitArrayWrapper<T> { /** * @see _.fromPairs */ fromPairs(): LoDashExplicitObjectWrapper<any>; } //_.head interface LoDashStatic { /** * Gets the first element of array. * * @alias _.first * * @param array The array to query. * @return Returns the first element of array. */ head<T>(array: List<T>): T; } interface LoDashImplicitWrapper<T> { /** * @see _.head */ head(): string; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.head */ head(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.head */ head<T>(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.head */ head(): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.head */ head<T>(): T; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.head */ head<T>(): T; } //_.indexOf interface LoDashStatic { /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` * performs a faster binary search. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.indexOf([1, 2, 1, 2], 2); * // => 1 * * // using `fromIndex` * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ indexOf<T>( array: List<T>, value: T, fromIndex?: boolean|number ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.indexOf */ indexOf( value: T, fromIndex?: boolean|number ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.indexOf */ indexOf<TValue>( value: TValue, fromIndex?: boolean|number ): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.indexOf */ indexOf( value: T, fromIndex?: boolean|number ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.indexOf */ indexOf<TValue>( value: TValue, fromIndex?: boolean|number ): LoDashExplicitWrapper<number>; } //_.intersectionBy DUMMY interface LoDashStatic { /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * * // using the `_.property` iteratee shorthand * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ intersectionBy( array: any[]|List<any>, ...values: any[] ): any[]; } //_.intersectionWith DUMMY interface LoDashStatic { /** * This method is like `_.intersection` except that it accepts `comparator` * which is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.intersectionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }] */ intersectionWith( array: any[]|List<any>, ...values: any[] ): any[]; } //_.join interface LoDashStatic { /** * Converts all elements in `array` into a string separated by `separator`. * * @param array The array to convert. * @param separator The element separator. * @returns Returns the joined string. */ join( array: List<any>, separator?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.join */ join(separator?: string): string; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.join */ join(separator?: string): string; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.join */ join(separator?: string): string; } interface LoDashExplicitWrapper<T> { /** * @see _.join */ join(separator?: string): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.join */ join(separator?: string): LoDashExplicitWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.join */ join(separator?: string): LoDashExplicitWrapper<string>; } //_.pullAll DUMMY interface LoDashStatic { /** * This method is like `_.pull` except that it accepts an array of values to remove. * * **Note:** Unlike `_.difference`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * * _.pull(array, [2, 3]); * console.log(array); * // => [1, 1] */ pullAll( array: any[]|List<any>, ...values: any[] ): any[]; } //_.pullAllBy DUMMY interface LoDashStatic { /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; * * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); * console.log(array); * // => [{ 'x': 2 }] */ pullAllBy( array: any[]|List<any>, ...values: any[] ): any[]; } //_.reverse DUMMY interface LoDashStatic { /** * Reverses `array` so that the first element becomes the last, the second * element becomes the second to last, and so on. * * **Note:** This method mutates `array` and is based on * [`Array#reverse`](https://mdn.io/Array/reverse). * * @memberOf _ * @category Array * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.reverse(array); * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ reverse( array: any[]|List<any>, ...values: any[] ): any[]; } //_.sortedIndexOf interface LoDashStatic { /** * This method is like `_.indexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedIndexOf([1, 1, 2, 2], 2); * // => 2 */ sortedIndexOf<T>( array: List<T>, value: T ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedIndexOf */ sortedIndexOf( value: T ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedIndexOf */ sortedIndexOf<TValue>( value: TValue ): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedIndexOf */ sortedIndexOf( value: T ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedIndexOf */ sortedIndexOf<TValue>( value: TValue ): LoDashExplicitWrapper<number>; } //_.initial interface LoDashStatic { /** * Gets all but the last element of array. * * @param array The array to query. * @return Returns the slice of array. */ initial<T>(array: List<T>): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.initial */ initial(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.initial */ initial<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.initial */ initial(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.initial */ initial<T>(): LoDashExplicitArrayWrapper<T>; } //_.intersection interface LoDashStatic { /** * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for * equality comparisons. * * @param arrays The arrays to inspect. * @return Returns the new array of shared values. */ intersection<T>(...arrays: (T[]|List<T>)[]): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.intersection */ intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.intersection */ intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.intersection */ intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashExplicitArrayWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.intersection */ intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashExplicitArrayWrapper<TResult>; } //_.last interface LoDashStatic { /** * Gets the last element of array. * * @param array The array to query. * @return Returns the last element of array. */ last<T>(array: List<T>): T; } interface LoDashImplicitWrapper<T> { /** * @see _.last */ last(): string; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.last */ last(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.last */ last<T>(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.last */ last(): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.last */ last<T>(): T; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.last */ last<T>(): T; } //_.lastIndexOf interface LoDashStatic { /** * This method is like _.indexOf except that it iterates over elements of array from right to left. * * @param array The array to search. * @param value The value to search for. * @param fromIndex The index to search from or true to perform a binary search on a sorted array. * @return Returns the index of the matched value, else -1. */ lastIndexOf<T>( array: List<T>, value: T, fromIndex?: boolean|number ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.lastIndexOf */ lastIndexOf( value: T, fromIndex?: boolean|number ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.lastIndexOf */ lastIndexOf<TResult>( value: TResult, fromIndex?: boolean|number ): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.lastIndexOf */ lastIndexOf( value: T, fromIndex?: boolean|number ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.lastIndexOf */ lastIndexOf<TResult>( value: TResult, fromIndex?: boolean|number ): LoDashExplicitWrapper<number>; } //_.pull interface LoDashStatic { /** * Removes all provided values from array using SameValueZero for equality comparisons. * * Note: Unlike _.without, this method mutates array. * * @param array The array to modify. * @param values The values to remove. * @return Returns array. */ pull<T>( array: T[], ...values: T[] ): T[]; /** * @see _.pull */ pull<T>( array: List<T>, ...values: T[] ): List<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.pull */ pull(...values: T[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.pull */ pull<TValue>(...values: TValue[]): LoDashImplicitObjectWrapper<List<TValue>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.pull */ pull(...values: T[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.pull */ pull<TValue>(...values: TValue[]): LoDashExplicitObjectWrapper<List<TValue>>; } //_.pullAt interface LoDashStatic { /** * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. * Indexes may be specified as an array of indexes or as individual arguments. * * Note: Unlike _.at, this method mutates array. * * @param array The array to modify. * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. * @return Returns the new array of removed elements. */ pullAt<T>( array: List<T>, ...indexes: (number|number[])[] ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.pullAt */ pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.pullAt */ pullAt<T>(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.pullAt */ pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.pullAt */ pullAt<T>(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper<T>; } //_.remove interface LoDashStatic { /** * Removes all elements from array that predicate returns truthy for and returns an array of the removed * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * Note: Unlike _.filter, this method mutates array. * * @param array The array to modify. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the new array of removed elements. */ remove<T>( array: List<T>, predicate?: ListIterator<T, boolean> ): T[]; /** * @see _.remove */ remove<T>( array: List<T>, predicate?: string ): T[]; /** * @see _.remove */ remove<W, T>( array: List<T>, predicate?: W ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.remove */ remove( predicate?: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.remove */ remove( predicate?: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.remove */ remove<W>( predicate?: W ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.remove */ remove<TResult>( predicate?: ListIterator<TResult, boolean> ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.remove */ remove<TResult>( predicate?: string ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.remove */ remove<W, TResult>( predicate?: W ): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.remove */ remove( predicate?: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.remove */ remove( predicate?: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.remove */ remove<W>( predicate?: W ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.remove */ remove<TResult>( predicate?: ListIterator<TResult, boolean> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.remove */ remove<TResult>( predicate?: string ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.remove */ remove<W, TResult>( predicate?: W ): LoDashExplicitArrayWrapper<TResult>; } //_.tail interface LoDashStatic { /** * Gets all but the first element of array. * * @alias _.tail * * @param array The array to query. * @return Returns the slice of array. */ tail<T>(array: List<T>): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.tail */ tail(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.tail */ tail<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.tail */ tail(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.tail */ tail<T>(): LoDashExplicitArrayWrapper<T>; } //_.slice interface LoDashStatic { /** * Creates a slice of array from start up to, but not including, end. * * @param array The array to slice. * @param start The start position. * @param end The end position. * @return Returns the slice of array. */ slice<T>( array: T[], start?: number, end?: number ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.slice */ slice( start?: number, end?: number ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.slice */ slice( start?: number, end?: number ): LoDashExplicitArrayWrapper<T>; } //_.sortedIndex interface LoDashStatic { /** * Uses a binary search to determine the lowest index at which `value` should * be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 * * _.sortedIndex([4, 5], 4); * // => 0 */ sortedIndex<T, TSort>( array: List<T>, value: T ): number; /** * @see _.sortedIndex */ sortedIndex<T>( array: List<T>, value: T ): number; /** * @see _.sortedIndex */ sortedIndex<T>( array: List<T>, value: T ): number; /** * @see _.sortedIndex */ sortedIndex<W, T>( array: List<T>, value: T ): number; /** * @see _.sortedIndex */ sortedIndex<T>( array: List<T>, value: T ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<TSort>( value: string ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<TSort>( value: T ): number; /** * @see _.sortedIndex */ sortedIndex( value: T ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<T, TSort>( value: T ): number; /** * @see _.sortedIndex */ sortedIndex<T>( value: T ): number; /** * @see _.sortedIndex */ sortedIndex<W, T>( value: T ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<TSort>( value: string ): LoDashExplicitWrapper<number>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<TSort>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndex */ sortedIndex( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndex */ sortedIndex<W>( value: T ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedIndex */ sortedIndex<T, TSort>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndex */ sortedIndex<T>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndex */ sortedIndex<W, T>( value: T ): LoDashExplicitWrapper<number>; } //_.sortedIndexBy interface LoDashStatic { /** * This method is like `_.sortedIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; * * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); * // => 1 * * // using the `_.property` iteratee shorthand * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ sortedIndexBy<T, TSort>( array: List<T>, value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( array: List<T>, value: T, iteratee: (x: T) => any ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( array: List<T>, value: T, iteratee: string ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<W, T>( array: List<T>, value: T, iteratee: W ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( array: List<T>, value: T, iteratee: Object ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<TSort>( value: string, iteratee: (x: string) => TSort ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<TSort>( value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedIndexBy */ sortedIndexBy( value: T, iteratee: string ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<W>( value: T, iteratee: W ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<T, TSort>( value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: (x: T) => any ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: string ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<W, T>( value: T, iteratee: W ): number; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: Object ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<TSort>( value: string, iteratee: (x: string) => TSort ): LoDashExplicitWrapper<number>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<TSort>( value: T, iteratee: (x: T) => TSort ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy( value: T, iteratee: string ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy<W>( value: T, iteratee: W ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedIndexBy */ sortedIndexBy<T, TSort>( value: T, iteratee: (x: T) => TSort ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: (x: T) => any ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: string ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy<W, T>( value: T, iteratee: W ): LoDashExplicitWrapper<number>; /** * @see _.sortedIndexBy */ sortedIndexBy<T>( value: T, iteratee: Object ): LoDashExplicitWrapper<number>; } //_.sortedLastIndex interface LoDashStatic { /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * _.sortedLastIndex([4, 5], 4); * // => 1 */ sortedLastIndex<T, TSort>( array: List<T>, value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<T>( array: List<T>, value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<T>( array: List<T>, value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<W, T>( array: List<T>, value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<T>( array: List<T>, value: T ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<TSort>( value: string ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<TSort>( value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<W>( value: T ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<T, TSort>( value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<T>( value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex<W, T>( value: T ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<TSort>( value: string ): LoDashExplicitWrapper<number>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<TSort>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndex */ sortedLastIndex( value: T ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedLastIndex */ sortedLastIndex<T, TSort>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndex */ sortedLastIndex<T>( value: T ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndex */ sortedLastIndex<W, T>( value: T ): LoDashExplicitWrapper<number>; } //_.sortedLastIndexBy interface LoDashStatic { /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * * // using the `_.property` iteratee shorthand * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ sortedLastIndexBy<T, TSort>( array: List<T>, value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( array: List<T>, value: T, iteratee: (x: T) => any ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( array: List<T>, value: T, iteratee: string ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<W, T>( array: List<T>, value: T, iteratee: W ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( array: List<T>, value: T, iteratee: Object ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<TSort>( value: string, iteratee: (x: string) => TSort ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<TSort>( value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy( value: T, iteratee: string ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<W>( value: T, iteratee: W ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T, TSort>( value: T, iteratee: (x: T) => TSort ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: (x: T) => any ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: string ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<W, T>( value: T, iteratee: W ): number; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: Object ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<TSort>( value: string, iteratee: (x: string) => TSort ): LoDashExplicitWrapper<number>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<TSort>( value: T, iteratee: (x: T) => TSort ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy( value: T, iteratee: string ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<W>( value: T, iteratee: W ): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T, TSort>( value: T, iteratee: (x: T) => TSort ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: (x: T) => any ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: string ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<W, T>( value: T, iteratee: W ): LoDashExplicitWrapper<number>; /** * @see _.sortedLastIndexBy */ sortedLastIndexBy<T>( value: T, iteratee: Object ): LoDashExplicitWrapper<number>; } //_.sortedLastIndexOf DUMMY interface LoDashStatic { /** * This method is like `_.lastIndexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedLastIndexOf([1, 1, 2, 2], 2); * // => 3 */ sortedLastIndexOf( array: any[]|List<any>, ...values: any[] ): any[]; } //_.tail interface LoDashStatic { /** * @see _.rest */ tail<T>(array: List<T>): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.rest */ tail(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.rest */ tail<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.rest */ tail(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.rest */ tail<T>(): LoDashExplicitArrayWrapper<T>; } //_.take interface LoDashStatic { /** * Creates a slice of array with n elements taken from the beginning. * * @param array The array to query. * @param n The number of elements to take. * @return Returns the slice of array. */ take<T>( array: List<T>, n?: number ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.take */ take(n?: number): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.take */ take<TResult>(n?: number): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.take */ take(n?: number): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.take */ take<TResult>(n?: number): LoDashExplicitArrayWrapper<TResult>; } //_.takeRight interface LoDashStatic { /** * Creates a slice of array with n elements taken from the end. * * @param array The array to query. * @param n The number of elements to take. * @return Returns the slice of array. */ takeRight<T>( array: List<T>, n?: number ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.takeRight */ takeRight(n?: number): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.takeRight */ takeRight<TResult>(n?: number): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.takeRight */ takeRight(n?: number): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.takeRight */ takeRight<TResult>(n?: number): LoDashExplicitArrayWrapper<TResult>; } //_.takeRightWhile interface LoDashStatic { /** * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param array The array to query. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ takeRightWhile<TValue>( array: List<TValue>, predicate?: ListIterator<TValue, boolean> ): TValue[]; /** * @see _.takeRightWhile */ takeRightWhile<TValue>( array: List<TValue>, predicate?: string ): TValue[]; /** * @see _.takeRightWhile */ takeRightWhile<TWhere, TValue>( array: List<TValue>, predicate?: TWhere ): TValue[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.takeRightWhile */ takeRightWhile( predicate?: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.takeRightWhile */ takeRightWhile( predicate?: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.takeRightWhile */ takeRightWhile<TWhere>( predicate?: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.takeRightWhile */ takeRightWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.takeRightWhile */ takeRightWhile<TValue>( predicate?: string ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.takeRightWhile */ takeRightWhile<TWhere, TValue>( predicate?: TWhere ): LoDashImplicitArrayWrapper<TValue>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.takeRightWhile */ takeRightWhile( predicate?: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.takeRightWhile */ takeRightWhile( predicate?: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.takeRightWhile */ takeRightWhile<TWhere>( predicate?: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.takeRightWhile */ takeRightWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.takeRightWhile */ takeRightWhile<TValue>( predicate?: string ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.takeRightWhile */ takeRightWhile<TWhere, TValue>( predicate?: TWhere ): LoDashExplicitArrayWrapper<TValue>; } //_.takeWhile interface LoDashStatic { /** * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param array The array to query. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the slice of array. */ takeWhile<TValue>( array: List<TValue>, predicate?: ListIterator<TValue, boolean> ): TValue[]; /** * @see _.takeWhile */ takeWhile<TValue>( array: List<TValue>, predicate?: string ): TValue[]; /** * @see _.takeWhile */ takeWhile<TWhere, TValue>( array: List<TValue>, predicate?: TWhere ): TValue[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.takeWhile */ takeWhile( predicate?: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.takeWhile */ takeWhile( predicate?: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.takeWhile */ takeWhile<TWhere>( predicate?: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.takeWhile */ takeWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.takeWhile */ takeWhile<TValue>( predicate?: string ): LoDashImplicitArrayWrapper<TValue>; /** * @see _.takeWhile */ takeWhile<TWhere, TValue>( predicate?: TWhere ): LoDashImplicitArrayWrapper<TValue>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.takeWhile */ takeWhile( predicate?: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.takeWhile */ takeWhile( predicate?: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.takeWhile */ takeWhile<TWhere>( predicate?: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.takeWhile */ takeWhile<TValue>( predicate?: ListIterator<TValue, boolean> ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.takeWhile */ takeWhile<TValue>( predicate?: string ): LoDashExplicitArrayWrapper<TValue>; /** * @see _.takeWhile */ takeWhile<TWhere, TValue>( predicate?: TWhere ): LoDashExplicitArrayWrapper<TValue>; } //_.union interface LoDashStatic { /** * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for * equality comparisons. * * @param arrays The arrays to inspect. * @return Returns the new array of combined values. */ union<T>(...arrays: List<T>[]): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.union */ union(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>; /** * @see _.union */ union<T>(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.union */ union<T>(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.union */ union(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>; /** * @see _.union */ union<T>(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.union */ union<T>(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>; } //_.unionBy interface LoDashStatic { /** * This method is like `_.union` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @param arrays The arrays to inspect. * @param iteratee The iteratee invoked per element. * @return Returns the new array of combined values. */ unionBy<T>( arrays: T[]|List<T>, iteratee?: (value: T) => any ): T[]; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.unionBy */ unionBy<T>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, iteratee?: (value: T) => any ): T[]; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.unionBy */ unionBy<T>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: (value: T) => any ): T[]; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.unionBy */ unionBy<T>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: (value: T) => any ): T[]; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.unionBy */ unionBy<T>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: (value: T) => any ): T[]; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays1: T[]|List<T>, arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: W ): T[]; /** * @see _.unionBy */ unionBy<T>( arrays: T[]|List<T>, ...iteratee: any[] ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.unionBy */ unionBy<T>( iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( ...iteratee: any[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.unionBy */ unionBy<T>( iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: W ): LoDashImplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( ...iteratee: any[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.unionBy */ unionBy<T>( iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( ...iteratee: any[] ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.unionBy */ unionBy<T>( iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T, W extends Object>( arrays2: T[]|List<T>, arrays3: T[]|List<T>, arrays4: T[]|List<T>, arrays5: T[]|List<T>, iteratee?: W ): LoDashExplicitArrayWrapper<T>; /** * @see _.unionBy */ unionBy<T>( ...iteratee: any[] ): LoDashExplicitArrayWrapper<T>; } //_.uniq interface LoDashStatic { /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ uniq<T>( array: List<T> ): T[]; /** * @see _.uniq */ uniq<T, TSort>( array: List<T> ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.uniq */ uniq<TSort>(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.uniq */ uniq<TSort>(): LoDashImplicitArrayWrapper<T>; /** * @see _.uniq */ uniq(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { uniq<T>(): LoDashImplicitArrayWrapper<T>; /** * @see _.uniq */ uniq<T, TSort>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.uniq */ uniq<TSort>(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.uniq */ uniq<TSort>(): LoDashExplicitArrayWrapper<T>; /** * @see _.uniq */ uniq(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.uniq */ uniq<T>(): LoDashExplicitArrayWrapper<T>; /** * @see _.uniq */ uniq<T, TSort>(): LoDashExplicitArrayWrapper<T>; } //_.uniqBy interface LoDashStatic { /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // using the `_.property` iteratee shorthand * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ uniqBy<T>( array: List<T>, iteratee: ListIterator<T, any> ): T[]; /** * @see _.uniqBy */ uniqBy<T, TSort>( array: List<T>, iteratee: ListIterator<T, TSort> ): T[]; /** * @see _.uniqBy */ uniqBy<T>( array: List<T>, iteratee: string ): T[]; /** * @see _.uniqBy */ uniqBy<T>( array: List<T>, iteratee: Object ): T[]; /** * @see _.uniqBy */ uniqBy<TWhere extends {}, T>( array: List<T>, iteratee: TWhere ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.uniqBy */ uniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.uniqBy */ uniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy( iteratee: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<TWhere extends {}>( iteratee: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.uniqBy */ uniqBy<T>( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T, TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T>( iteratee: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T>( iteratee: Object ): LoDashImplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<TWhere extends {}, T>( iteratee: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.uniqBy */ uniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.uniqBy */ uniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy( iteratee: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<TWhere extends {}>( iteratee: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.uniqBy */ uniqBy<T>( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T, TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T>( iteratee: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<T>( iteratee: Object ): LoDashExplicitArrayWrapper<T>; /** * @see _.uniqBy */ uniqBy<TWhere extends {}, T>( iteratee: TWhere ): LoDashExplicitArrayWrapper<T>; } //_.sortedUniq interface LoDashStatic { /** * This method is like `_.uniq` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniq([1, 1, 2]); * // => [1, 2] */ sortedUniq<T>( array: List<T> ): T[]; /** * @see _.sortedUniq */ sortedUniq<T, TSort>( array: List<T> ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedUniq */ sortedUniq<TSort>(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedUniq */ sortedUniq<TSort>(): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniq */ sortedUniq(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { sortedUniq<T>(): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniq */ sortedUniq<T, TSort>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedUniq */ sortedUniq<TSort>(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedUniq */ sortedUniq<TSort>(): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniq */ sortedUniq(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedUniq */ sortedUniq<T>(): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniq */ sortedUniq<T, TSort>(): LoDashExplicitArrayWrapper<T>; } //_.sortedUniqBy interface LoDashStatic { /** * This method is like `_.uniqBy` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.2] */ sortedUniqBy<T>( array: List<T>, iteratee: ListIterator<T, any> ): T[]; /** * @see _.sortedUniqBy */ sortedUniqBy<T, TSort>( array: List<T>, iteratee: ListIterator<T, TSort> ): T[]; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( array: List<T>, iteratee: string ): T[]; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( array: List<T>, iteratee: Object ): T[]; /** * @see _.sortedUniqBy */ sortedUniqBy<TWhere extends {}, T>( array: List<T>, iteratee: TWhere ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy( iteratee: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<TWhere extends {}>( iteratee: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T, TSort>( iteratee: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: Object ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<TWhere extends {}, T>( iteratee: TWhere ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy( iteratee: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<TWhere extends {}>( iteratee: TWhere ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T, TSort>( iteratee: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<T>( iteratee: Object ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortedUniqBy */ sortedUniqBy<TWhere extends {}, T>( iteratee: TWhere ): LoDashExplicitArrayWrapper<T>; } //_.unionWith DUMMY interface LoDashStatic { /** * This method is like `_.union` except that it accepts `comparator` which * is invoked to compare elements of `arrays`. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.unionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ unionWith( array: any[]|List<any>, ...values: any[] ): any[]; } //_.uniqWith DUMMY interface LoDashStatic { /** * This method is like `_.uniq` except that it accepts `comparator` which * is invoked to compare elements of `array`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ uniqWith( array: any[]|List<any>, ...values: any[] ): any[]; } //_.unzip interface LoDashStatic { /** * This method is like _.zip except that it accepts an array of grouped elements and creates an array * regrouping the elements to their pre-zip configuration. * * @param array The array of grouped elements to process. * @return Returns the new array of regrouped elements. */ unzip<T>(array: List<List<T>>): T[][]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.unzip */ unzip<T>(): LoDashImplicitArrayWrapper<T[]>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.unzip */ unzip<T>(): LoDashImplicitArrayWrapper<T[]>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.unzip */ unzip<T>(): LoDashExplicitArrayWrapper<T[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.unzip */ unzip<T>(): LoDashExplicitArrayWrapper<T[]>; } //_.unzipWith interface LoDashStatic { /** * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, * group). * * @param array The array of grouped elements to process. * @param iteratee The function to combine regrouped values. * @param thisArg The this binding of iteratee. * @return Returns the new array of regrouped elements. */ unzipWith<TArray, TResult>( array: List<List<TArray>>, iteratee?: MemoIterator<TArray, TResult> ): TResult[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.unzipWith */ unzipWith<TArr, TResult>( iteratee?: MemoIterator<TArr, TResult> ): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.unzipWith */ unzipWith<TArr, TResult>( iteratee?: MemoIterator<TArr, TResult> ): LoDashImplicitArrayWrapper<TResult>; } //_.without interface LoDashStatic { /** * Creates an array excluding all provided values using SameValueZero for equality comparisons. * * @param array The array to filter. * @param values The values to exclude. * @return Returns the new array of filtered values. */ without<T>( array: List<T>, ...values: T[] ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.without */ without(...values: T[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.without */ without<T>(...values: T[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.without */ without(...values: T[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.without */ without<T>(...values: T[]): LoDashExplicitArrayWrapper<T>; } //_.xor interface LoDashStatic { /** * Creates an array of unique values that is the symmetric difference of the provided arrays. * * @param arrays The arrays to inspect. * @return Returns the new array of values. */ xor<T>(...arrays: List<T>[]): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.xor */ xor(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.xor */ xor<T>(...arrays: List<T>[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.xor */ xor(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.xor */ xor<T>(...arrays: List<T>[]): LoDashExplicitArrayWrapper<T>; } //_.xorBy DUMMY interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by which * uniqueness is computed. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of values. * @example * * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [1.2, 4.3] * * // using the `_.property` iteratee shorthand * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ xorBy( array: any[]|List<any>, ...values: any[] ): any[]; } //_.xorWith DUMMY interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `comparator` which is * invoked to compare elements of `arrays`. The comparator is invoked with * two arguments: (arrVal, othVal). * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ xorWith( array: any[]|List<any>, ...values: any[] ): any[]; } //_.zip interface LoDashStatic { /** * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, * the second of which contains the second elements of the given arrays, and so on. * * @param arrays The arrays to process. * @return Returns the new array of grouped elements. */ zip<T>(...arrays: List<T>[]): T[][]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.zip */ zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.zip */ zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.zip */ zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.zip */ zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>; } //_.zipObject interface LoDashStatic { /** * The inverse of _.pairs; this method returns an object composed from arrays of property names and values. * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of * property names and one of corresponding values. * * @param props The property names. * @param values The property values. * @return Returns the new object. */ zipObject<TValues, TResult extends {}>( props: List<StringRepresentable>|List<List<any>>, values?: List<TValues> ): TResult; /** * @see _.zipObject */ zipObject<TResult extends {}>( props: List<StringRepresentable>|List<List<any>>, values?: List<any> ): TResult; /** * @see _.zipObject */ zipObject( props: List<StringRepresentable>|List<List<any>>, values?: List<any> ): _.Dictionary<any>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.zipObject */ zipObject<TValues, TResult extends {}>( values?: List<TValues> ): _.LoDashImplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject<TResult extends {}>( values?: List<any> ): _.LoDashImplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject( values?: List<any> ): _.LoDashImplicitObjectWrapper<_.Dictionary<any>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.zipObject */ zipObject<TValues, TResult extends {}>( values?: List<TValues> ): _.LoDashImplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject<TResult extends {}>( values?: List<any> ): _.LoDashImplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject( values?: List<any> ): _.LoDashImplicitObjectWrapper<_.Dictionary<any>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.zipObject */ zipObject<TValues, TResult extends {}>( values?: List<TValues> ): _.LoDashExplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject<TResult extends {}>( values?: List<any> ): _.LoDashExplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject( values?: List<any> ): _.LoDashExplicitObjectWrapper<_.Dictionary<any>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.zipObject */ zipObject<TValues, TResult extends {}>( values?: List<TValues> ): _.LoDashExplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject<TResult extends {}>( values?: List<any> ): _.LoDashExplicitObjectWrapper<TResult>; /** * @see _.zipObject */ zipObject( values?: List<any> ): _.LoDashExplicitObjectWrapper<_.Dictionary<any>>; } //_.zipWith interface LoDashStatic { /** * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, * group). * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee] The function to combine grouped values. * @param {*} [thisArg] The `this` binding of `iteratee`. * @return Returns the new array of grouped elements. */ zipWith<TResult>(...args: any[]): TResult[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.zipWith */ zipWith<TResult>(...args: any[]): LoDashImplicitArrayWrapper<TResult>; } /********* * Chain * *********/ //_.chain interface LoDashStatic { /** * Creates a lodash object that wraps value with explicit method chaining enabled. * * @param value The value to wrap. * @return Returns the new lodash wrapper instance. */ chain(value: number): LoDashExplicitWrapper<number>; chain(value: string): LoDashExplicitWrapper<string>; chain(value: boolean): LoDashExplicitWrapper<boolean>; chain<T>(value: T[]): LoDashExplicitArrayWrapper<T>; chain<T extends {}>(value: T): LoDashExplicitObjectWrapper<T>; chain(value: any): LoDashExplicitWrapper<any>; } interface LoDashImplicitWrapper<T> { /** * @see _.chain */ chain(): LoDashExplicitWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.chain */ chain(): LoDashExplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.chain */ chain(): LoDashExplicitObjectWrapper<T>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.chain */ chain(): TWrapper; } //_.tap interface LoDashStatic { /** * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations * on intermediate results within the chain. * * @param value The value to provide to interceptor. * @param interceptor The function to invoke. * @parem thisArg The this binding of interceptor. * @return Returns value. **/ tap<T>( value: T, interceptor: (value: T) => void ): T; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.tap */ tap( interceptor: (value: T) => void ): TWrapper; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.tap */ tap( interceptor: (value: T) => void ): TWrapper; } //_.thru interface LoDashStatic { /** * This method is like _.tap except that it returns the result of interceptor. * * @param value The value to provide to interceptor. * @param interceptor The function to invoke. * @param thisArg The this binding of interceptor. * @return Returns the result of interceptor. */ thru<T, TResult>( value: T, interceptor: (value: T) => TResult ): TResult; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.thru */ thru<TResult extends number>( interceptor: (value: T) => TResult): LoDashImplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends string>( interceptor: (value: T) => TResult): LoDashImplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends boolean>( interceptor: (value: T) => TResult): LoDashImplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends {}>( interceptor: (value: T) => TResult): LoDashImplicitObjectWrapper<TResult>; /** * @see _.thru */ thru<TResult>( interceptor: (value: T) => TResult[]): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.thru */ thru<TResult extends number>( interceptor: (value: T) => TResult ): LoDashExplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends string>( interceptor: (value: T) => TResult ): LoDashExplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends boolean>( interceptor: (value: T) => TResult ): LoDashExplicitWrapper<TResult>; /** * @see _.thru */ thru<TResult extends {}>( interceptor: (value: T) => TResult ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.thru */ thru<TResult>( interceptor: (value: T) => TResult[] ): LoDashExplicitArrayWrapper<TResult>; } //_.prototype.commit interface LoDashImplicitWrapperBase<T, TWrapper> { /** * Executes the chained sequence and returns the wrapped result. * * @return Returns the new lodash wrapper instance. */ commit(): TWrapper; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.commit */ commit(): TWrapper; } //_.prototype.concat interface LoDashImplicitWrapperBase<T, TWrapper> { /** * Creates a new array joining a wrapped array with any additional arrays and/or values. * * @param items * @return Returns the new concatenated array. */ concat<TItem>(...items: Array<TItem|Array<TItem>>): LoDashImplicitArrayWrapper<TItem>; /** * @see _.concat */ concat(...items: Array<T|Array<T>>): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.concat */ concat<TItem>(...items: Array<TItem|Array<TItem>>): LoDashExplicitArrayWrapper<TItem>; /** * @see _.concat */ concat(...items: Array<T|Array<T>>): LoDashExplicitArrayWrapper<T>; } //_.prototype.plant interface LoDashImplicitWrapperBase<T, TWrapper> { /** * Creates a clone of the chained sequence planting value as the wrapped value. * @param value The value to plant as the wrapped value. * @return Returns the new lodash wrapper instance. */ plant(value: number): LoDashImplicitWrapper<number>; /** * @see _.plant */ plant(value: string): LoDashImplicitStringWrapper; /** * @see _.plant */ plant(value: boolean): LoDashImplicitWrapper<boolean>; /** * @see _.plant */ plant(value: number[]): LoDashImplicitNumberArrayWrapper; /** * @see _.plant */ plant<T>(value: T[]): LoDashImplicitArrayWrapper<T>; /** * @see _.plant */ plant<T extends {}>(value: T): LoDashImplicitObjectWrapper<T>; /** * @see _.plant */ plant(value: any): LoDashImplicitWrapper<any>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.plant */ plant(value: number): LoDashExplicitWrapper<number>; /** * @see _.plant */ plant(value: string): LoDashExplicitStringWrapper; /** * @see _.plant */ plant(value: boolean): LoDashExplicitWrapper<boolean>; /** * @see _.plant */ plant(value: number[]): LoDashExplicitNumberArrayWrapper; /** * @see _.plant */ plant<T>(value: T[]): LoDashExplicitArrayWrapper<T>; /** * @see _.plant */ plant<T extends {}>(value: T): LoDashExplicitObjectWrapper<T>; /** * @see _.plant */ plant(value: any): LoDashExplicitWrapper<any>; } //_.prototype.reverse interface LoDashImplicitArrayWrapper<T> { /** * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to * last, and so on. * * Note: This method mutates the wrapped array. * * @return Returns the new reversed lodash wrapper instance. */ reverse(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.reverse */ reverse(): LoDashExplicitArrayWrapper<T>; } //_.prototype.toJSON interface LoDashWrapperBase<T, TWrapper> { /** * @see _.value */ toJSON(): T; } //_.prototype.toString interface LoDashWrapperBase<T, TWrapper> { /** * Produces the result of coercing the unwrapped value to a string. * * @return Returns the coerced string value. */ toString(): string; } //_.prototype.value interface LoDashWrapperBase<T, TWrapper> { /** * Executes the chained sequence to extract the unwrapped value. * * @alias _.toJSON, _.valueOf * * @return Returns the resolved unwrapped value. */ value(): T; } //_.valueOf interface LoDashWrapperBase<T, TWrapper> { /** * @see _.value */ valueOf(): T; } /************** * Collection * **************/ //_.at interface LoDashStatic { /** * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be * specified as individual arguments or as arrays of keys. * * @param collection The collection to iterate over. * @param props The property names or indexes of elements to pick, specified individually or in arrays. * @return Returns the new array of picked elements. */ at<T>( collection: List<T>|Dictionary<T>, ...props: (number|string|(number|string)[])[] ): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.at */ at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.at */ at<T>(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.at */ at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.at */ at<T>(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper<T>; } //_.countBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The * iteratee is bound to thisArg and invoked with three arguments: * (value, index|key, collection). * * If a property name is provided for iteratee the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for iteratee the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ countBy<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): Dictionary<number>; /** * @see _.countBy */ countBy<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<number>; /** * @see _.countBy */ countBy<T>( collection: NumericDictionary<T>, iteratee?: NumericDictionaryIterator<T, any> ): Dictionary<number>; /** * @see _.countBy */ countBy<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, iteratee?: string ): Dictionary<number>; /** * @see _.countBy */ countBy<W, T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, iteratee?: W ): Dictionary<number>; /** * @see _.countBy */ countBy<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, iteratee?: Object ): Dictionary<number>; } interface LoDashImplicitWrapper<T> { /** * @see _.countBy */ countBy( iteratee?: ListIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<number>>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.countBy */ countBy( iteratee?: ListIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy<W>( iteratee?: W ): LoDashImplicitObjectWrapper<Dictionary<number>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.countBy */ countBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any>|NumericDictionaryIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy<W>( iteratee?: W ): LoDashImplicitObjectWrapper<Dictionary<number>>; } interface LoDashExplicitWrapper<T> { /** * @see _.countBy */ countBy( iteratee?: ListIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<number>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.countBy */ countBy( iteratee?: ListIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy<W>( iteratee?: W ): LoDashExplicitObjectWrapper<Dictionary<number>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.countBy */ countBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any>|NumericDictionaryIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<number>>; /** * @see _.countBy */ countBy<W>( iteratee?: W ): LoDashExplicitObjectWrapper<Dictionary<number>>; } //_.each interface LoDashStatic { /** * @see _.forEach */ each<T>( collection: T[], iteratee?: ListIterator<T, any> ): T[]; /** * @see _.forEach */ each<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): List<T>; /** * @see _.forEach */ each<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forEach */ each<T extends {}>( collection: T, iteratee?: ObjectIterator<any, any> ): T; /** * @see _.forEach */ each<T extends {}, TValue>( collection: T, iteratee?: ObjectIterator<TValue, any> ): T; } interface LoDashImplicitWrapper<T> { /** * @see _.forEach */ each( iteratee: ListIterator<string, any> ): LoDashImplicitWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.forEach */ each( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forEach */ each<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.forEach */ each( iteratee: ListIterator<string, any> ): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.forEach */ each( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forEach */ each<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashExplicitObjectWrapper<T>; } //_.eachRight interface LoDashStatic { /** * @see _.forEachRight */ eachRight<T>( collection: T[], iteratee?: ListIterator<T, any> ): T[]; /** * @see _.forEachRight */ eachRight<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): List<T>; /** * @see _.forEachRight */ eachRight<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forEachRight */ eachRight<T extends {}>( collection: T, iteratee?: ObjectIterator<any, any> ): T; /** * @see _.forEachRight */ eachRight<T extends {}, TValue>( collection: T, iteratee?: ObjectIterator<TValue, any> ): T; } interface LoDashImplicitWrapper<T> { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator<string, any> ): LoDashImplicitWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forEachRight */ eachRight<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator<string, any> ): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forEachRight */ eachRight<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashExplicitObjectWrapper<T>; } //_.every interface LoDashStatic { /** * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @return Returns true if all elements pass the predicate check, else false. */ every<T>( collection: List<T>, predicate?: ListIterator<T, boolean> ): boolean; /** * @see _.every */ every<T>( collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean> ): boolean; /** * @see _.every */ every<T>( collection: NumericDictionary<T>, predicate?: NumericDictionaryIterator<T, boolean> ): boolean; /** * @see _.every */ every<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, predicate?: string|any[] ): boolean; /** * @see _.every */ every<TObject extends {}, T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, predicate?: TObject ): boolean; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.every */ every( predicate?: ListIterator<T, boolean>|NumericDictionaryIterator<T, boolean> ): boolean; /** * @see _.every */ every( predicate?: string|any[] ): boolean; /** * @see _.every */ every<TObject extends {}>( predicate?: TObject ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.every */ every<TResult>( predicate?: ListIterator<TResult, boolean>|DictionaryIterator<TResult, boolean>|NumericDictionaryIterator<T, boolean> ): boolean; /** * @see _.every */ every( predicate?: string|any[] ): boolean; /** * @see _.every */ every<TObject extends {}>( predicate?: TObject ): boolean; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.every */ every( predicate?: ListIterator<T, boolean>|NumericDictionaryIterator<T, boolean> ): LoDashExplicitWrapper<boolean>; /** * @see _.every */ every( predicate?: string|any[] ): LoDashExplicitWrapper<boolean>; /** * @see _.every */ every<TObject extends {}>( predicate?: TObject ): LoDashExplicitWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.every */ every<TResult>( predicate?: ListIterator<TResult, boolean>|DictionaryIterator<TResult, boolean>|NumericDictionaryIterator<T, boolean> ): LoDashExplicitWrapper<boolean>; /** * @see _.every */ every( predicate?: string|any[] ): LoDashExplicitWrapper<boolean>; /** * @see _.every */ every<TObject extends {}>( predicate?: TObject ): LoDashExplicitWrapper<boolean>; } //_.filter interface LoDashStatic { /** * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the new filtered array. */ filter<T>( collection: List<T>, predicate?: ListIterator<T, boolean> ): T[]; /** * @see _.filter */ filter<T>( collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean> ): T[]; /** * @see _.filter */ filter( collection: string, predicate?: StringIterator<boolean> ): string[]; /** * @see _.filter */ filter<T>( collection: List<T>|Dictionary<T>, predicate: string ): T[]; /** * @see _.filter */ filter<W extends {}, T>( collection: List<T>|Dictionary<T>, predicate: W ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.filter */ filter( predicate?: StringIterator<boolean> ): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.filter */ filter( predicate: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.filter */ filter( predicate: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.filter */ filter<W>(predicate: W): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.filter */ filter<T>( predicate: ListIterator<T, boolean>|DictionaryIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.filter */ filter<T>( predicate: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.filter */ filter<W, T>(predicate: W): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.filter */ filter( predicate?: StringIterator<boolean> ): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.filter */ filter( predicate: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.filter */ filter( predicate: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.filter */ filter<W>(predicate: W): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.filter */ filter<T>( predicate: ListIterator<T, boolean>|DictionaryIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.filter */ filter<T>( predicate: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.filter */ filter<W, T>(predicate: W): LoDashExplicitArrayWrapper<T>; } //_.find interface LoDashStatic { /** * Iterates over elements of collection, returning the first element predicate returns truthy for. * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param collection The collection to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the matched element, else undefined. */ find<T>( collection: List<T>, predicate?: ListIterator<T, boolean> ): T; /** * @see _.find */ find<T>( collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean> ): T; /** * @see _.find */ find<T>( collection: List<T>|Dictionary<T>, predicate?: string ): T; /** * @see _.find */ find<TObject extends {}, T>( collection: List<T>|Dictionary<T>, predicate?: TObject ): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.find */ find( predicate?: ListIterator<T, boolean> ): T; /** * @see _.find */ find( predicate?: string ): T; /** * @see _.find */ find<TObject extends {}>( predicate?: TObject ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.find */ find<TResult>( predicate?: ListIterator<TResult, boolean>|DictionaryIterator<TResult, boolean> ): TResult; /** * @see _.find */ find<TResult>( predicate?: string ): TResult; /** * @see _.find */ find<TObject extends {}, TResult>( predicate?: TObject ): TResult; } //_.findLast interface LoDashStatic { /** * This method is like _.find except that it iterates over elements of a collection from * right to left. * @param collection Searches for a value in this list. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return The found element, else undefined. **/ findLast<T>( collection: Array<T>, callback: ListIterator<T, boolean>): T; /** * @see _.find **/ findLast<T>( collection: List<T>, callback: ListIterator<T, boolean>): T; /** * @see _.find **/ findLast<T>( collection: Dictionary<T>, callback: DictionaryIterator<T, boolean>): T; /** * @see _.find * @param _.pluck style callback **/ findLast<W, T>( collection: Array<T>, whereValue: W): T; /** * @see _.find * @param _.pluck style callback **/ findLast<W, T>( collection: List<T>, whereValue: W): T; /** * @see _.find * @param _.pluck style callback **/ findLast<W, T>( collection: Dictionary<T>, whereValue: W): T; /** * @see _.find * @param _.where style callback **/ findLast<T>( collection: Array<T>, pluckValue: string): T; /** * @see _.find * @param _.where style callback **/ findLast<T>( collection: List<T>, pluckValue: string): T; /** * @see _.find * @param _.where style callback **/ findLast<T>( collection: Dictionary<T>, pluckValue: string): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.findLast */ findLast( callback: ListIterator<T, boolean>): T; /** * @see _.findLast * @param _.where style callback */ findLast<W>( whereValue: W): T; /** * @see _.findLast * @param _.where style callback */ findLast( pluckValue: string): T; } //_.flatMap interface LoDashStatic { /** * Creates an array of flattened values by running each element in collection through iteratee * and concating its result to the other mapped values. The iteratee is invoked with three arguments: * (value, index|key, collection). * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @return Returns the new flattened array. */ flatMap<T, TResult>( collection: List<T>, iteratee?: ListIterator<T, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TResult>( collection: List<any>, iteratee?: ListIterator<any, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<T, TResult>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TResult>( collection: Dictionary<any>, iteratee?: DictionaryIterator<any, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<T, TResult>( collection: NumericDictionary<T>, iteratee?: NumericDictionaryIterator<T, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TResult>( collection: NumericDictionary<any>, iteratee?: NumericDictionaryIterator<any, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TObject extends Object, TResult>( collection: TObject, iteratee?: ObjectIterator<any, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TResult>( collection: Object, iteratee?: ObjectIterator<any, TResult|TResult[]> ): TResult[]; /** * @see _.flatMap */ flatMap<TWhere extends Object, TObject extends Object>( collection: TObject, iteratee: TWhere ): boolean[]; /** * @see _.flatMap */ flatMap<TObject extends Object, TResult>( collection: TObject, iteratee: Object|string ): TResult[]; /** * @see _.flatMap */ flatMap<TObject extends Object>( collection: TObject, iteratee: [string, any] ): boolean[]; /** * @see _.flatMap */ flatMap<TResult>( collection: string ): string[]; /** * @see _.flatMap */ flatMap<TResult>( collection: Object, iteratee?: Object|string ): TResult[]; } interface LoDashImplicitWrapper<T> { /** * @see _.flatMap */ flatMap<TResult>( iteratee: ListIterator<string, TResult|TResult[]> ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap(): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.flatMap */ flatMap<TResult>( iteratee: ListIterator<T, TResult|TResult[]>|string ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TWhere extends Object>( iteratee: TWhere ): LoDashImplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap( iteratee: [string, any] ): LoDashImplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap<TResult>(): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flatMap */ flatMap<T, TResult>( iteratee: ListIterator<T, TResult|TResult[]>|DictionaryIterator<T, TResult|TResult[]>|NumericDictionaryIterator<T, TResult|TResult[]> ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TResult>( iteratee: ObjectIterator<any, TResult|TResult[]>|string ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TWhere extends Object>( iteratee: TWhere ): LoDashImplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap( iteratee: [string, any] ): LoDashImplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap<TResult>(): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.flatMap */ flatMap<TResult>( iteratee: ListIterator<string, TResult|TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap(): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.flatMap */ flatMap<TResult>( iteratee: ListIterator<T, TResult|TResult[]>|string ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TWhere extends Object>( iteratee: TWhere ): LoDashExplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap( iteratee: [string, any] ): LoDashExplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap<TResult>(): LoDashExplicitArrayWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flatMap */ flatMap<T, TResult>( iteratee: ListIterator<T, TResult|TResult[]>|DictionaryIterator<T, TResult|TResult[]>|NumericDictionaryIterator<T, TResult|TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TResult>( iteratee: ObjectIterator<any, TResult|TResult[]>|string ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.flatMap */ flatMap<TWhere extends Object>( iteratee: TWhere ): LoDashExplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap( iteratee: [string, any] ): LoDashExplicitArrayWrapper<boolean>; /** * @see _.flatMap */ flatMap<TResult>(): LoDashExplicitArrayWrapper<TResult>; } //_.forEach interface LoDashStatic { /** * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg * and invoked with three arguments: * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. * * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To * avoid this behavior _.forIn or _.forOwn may be used for object iteration. * * @alias _.each * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. */ forEach<T>( collection: T[], iteratee?: ListIterator<T, any> ): T[]; /** * @see _.forEach */ forEach<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): List<T>; /** * @see _.forEach */ forEach<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forEach */ forEach<T extends {}>( collection: T, iteratee?: ObjectIterator<any, any> ): T; /** * @see _.forEach */ forEach<T extends {}, TValue>( collection: T, iteratee?: ObjectIterator<TValue, any> ): T; } interface LoDashImplicitWrapper<T> { /** * @see _.forEach */ forEach( iteratee: ListIterator<string, any> ): LoDashImplicitWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.forEach */ forEach( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forEach */ forEach<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.forEach */ forEach( iteratee: ListIterator<string, any> ): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.forEach */ forEach( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forEach */ forEach<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashExplicitObjectWrapper<T>; } //_.forEachRight interface LoDashStatic { /** * This method is like _.forEach except that it iterates over elements of collection from right to left. * * @alias _.eachRight * * @param collection The collection to iterate over. * @param iteratee The function called per iteration. * @param thisArg The this binding of callback. */ forEachRight<T>( collection: T[], iteratee?: ListIterator<T, any> ): T[]; /** * @see _.forEachRight */ forEachRight<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): List<T>; /** * @see _.forEachRight */ forEachRight<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forEachRight */ forEachRight<T extends {}>( collection: T, iteratee?: ObjectIterator<any, any> ): T; /** * @see _.forEachRight */ forEachRight<T extends {}, TValue>( collection: T, iteratee?: ObjectIterator<TValue, any> ): T; } interface LoDashImplicitWrapper<T> { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator<string, any> ): LoDashImplicitWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator<T, any> ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forEachRight */ forEachRight<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator<string, any> ): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator<T, any> ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forEachRight */ forEachRight<TValue>( iteratee?: ListIterator<TValue, any>|DictionaryIterator<TValue, any> ): LoDashExplicitObjectWrapper<T>; } //_.groupBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through * iteratee. The corresponding value of each key is an array of the elements responsible for generating the * key. The iteratee is bound to thisArg and invoked with three arguments: * (value, index|key, collection). * * If a property name is provided for iteratee the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for iteratee the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ groupBy<T, TKey>( collection: List<T>, iteratee?: ListIterator<T, TKey> ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T>( collection: List<any>, iteratee?: ListIterator<T, any> ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T, TKey>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, TKey> ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T>( collection: Dictionary<any>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T, TValue>( collection: List<T>|Dictionary<T>, iteratee?: string ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T>( collection: List<T>|Dictionary<T>, iteratee?: string ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<TWhere, T>( collection: List<T>|Dictionary<T>, iteratee?: TWhere ): Dictionary<T[]>; /** * @see _.groupBy */ groupBy<T>( collection: List<T>|Dictionary<T>, iteratee?: Object ): Dictionary<T[]>; } interface LoDashImplicitWrapper<T> { /** * @see _.groupBy */ groupBy<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.groupBy */ groupBy<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TValue>( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TWhere>( iteratee?: TWhere ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.groupBy */ groupBy<T, TKey>( iteratee?: ListIterator<T, TKey>|DictionaryIterator<T, TKey> ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T, TValue>( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TWhere, T>( iteratee?: TWhere ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: Object ): LoDashImplicitObjectWrapper<Dictionary<T[]>>; } interface LoDashExplicitWrapper<T> { /** * @see _.groupBy */ groupBy<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.groupBy */ groupBy<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TValue>( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TWhere>( iteratee?: TWhere ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.groupBy */ groupBy<T, TKey>( iteratee?: ListIterator<T, TKey>|DictionaryIterator<T, TKey> ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T, TValue>( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<TWhere, T>( iteratee?: TWhere ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy */ groupBy<T>( iteratee?: Object ): LoDashExplicitObjectWrapper<Dictionary<T[]>>; } //_.includes interface LoDashStatic { /** * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, * it’s used as the offset from the end of collection. * * @param collection The collection to search. * @param target The value to search for. * @param fromIndex The index to search from. * @return True if the target element is found, else false. */ includes<T>( collection: List<T>|Dictionary<T>, target: T, fromIndex?: number ): boolean; /** * @see _.includes */ includes( collection: string, target: string, fromIndex?: number ): boolean; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.includes */ includes( target: T, fromIndex?: number ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.includes */ includes<TValue>( target: TValue, fromIndex?: number ): boolean; } interface LoDashImplicitWrapper<T> { /** * @see _.includes */ includes( target: string, fromIndex?: number ): boolean; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.includes */ includes( target: T, fromIndex?: number ): LoDashExplicitWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.includes */ includes<TValue>( target: TValue, fromIndex?: number ): LoDashExplicitWrapper<boolean>; } interface LoDashExplicitWrapper<T> { /** * @see _.includes */ includes( target: string, fromIndex?: number ): LoDashExplicitWrapper<boolean>; } //_.keyBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through * iteratee. The corresponding value of each key is the last element responsible for generating the key. The * iteratee function is bound to thisArg and invoked with three arguments: * (value, index|key, collection). * * If a property name is provided for iteratee the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for iteratee the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ keyBy<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): Dictionary<T>; /** * @see _.keyBy */ keyBy<T>( collection: NumericDictionary<T>, iteratee?: NumericDictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.keyBy */ keyBy<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.keyBy */ keyBy<T>( collection: List<T>|NumericDictionary<T>|Dictionary<T>, iteratee?: string ): Dictionary<T>; /** * @see _.keyBy */ keyBy<W extends Object, T>( collection: List<T>|NumericDictionary<T>|Dictionary<T>, iteratee?: W ): Dictionary<T>; /** * @see _.keyBy */ keyBy<T>( collection: List<T>|NumericDictionary<T>|Dictionary<T>, iteratee?: Object ): Dictionary<T>; } interface LoDashImplicitWrapper<T> { /** * @see _.keyBy */ keyBy( iteratee?: ListIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<T>>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.keyBy */ keyBy( iteratee?: ListIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<W extends Object>( iteratee?: W ): LoDashImplicitObjectWrapper<Dictionary<T>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.keyBy */ keyBy<T>( iteratee?: ListIterator<T, any>|NumericDictionaryIterator<T, any>|DictionaryIterator<T, any> ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<T>( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<W extends Object, T>( iteratee?: W ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<T>( iteratee?: Object ): LoDashImplicitObjectWrapper<Dictionary<T>>; } interface LoDashExplicitWrapper<T> { /** * @see _.keyBy */ keyBy( iteratee?: ListIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<T>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.keyBy */ keyBy( iteratee?: ListIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<W extends Object>( iteratee?: W ): LoDashExplicitObjectWrapper<Dictionary<T>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.keyBy */ keyBy<T>( iteratee?: ListIterator<T, any>|NumericDictionaryIterator<T, any>|DictionaryIterator<T, any> ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<T>( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<W extends Object, T>( iteratee?: W ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.keyBy */ keyBy<T>( iteratee?: Object ): LoDashExplicitObjectWrapper<Dictionary<T>>; } //_.invoke interface LoDashStatic { /** * Invokes the method at path of object. * @param object The object to query. * @param path The path of the method to invoke. * @param args The arguments to invoke the method with. **/ invoke<TObject extends Object, TResult>( object: TObject, path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; /** * @see _.invoke **/ invoke<TValue, TResult>( object: Dictionary<TValue>|TValue[], path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; /** * @see _.invoke **/ invoke<TResult>( object: any, path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.invoke **/ invoke<TResult>( path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.invoke **/ invoke<TResult>( path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.invoke **/ invoke<TResult>( path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.invoke **/ invoke<TResult>( path: StringRepresentable|StringRepresentable[], ...args: any[]): TResult; } //_.invokeMap interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning * an array of the results of each invoked method. Additional arguments will be provided * to each invoked method. If methodName is a function it will be invoked for, and this * bound to, each element in the collection. * @param collection The collection to iterate over. * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ invokeMap<TValue extends {}, TResult>( collection: TValue[], methodName: string, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TValue extends {}, TResult>( collection: Dictionary<TValue>, methodName: string, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TResult>( collection: {}[], methodName: string, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TResult>( collection: Dictionary<{}>, methodName: string, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TValue extends {}, TResult>( collection: TValue[], method: (...args: any[]) => TResult, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TValue extends {}, TResult>( collection: Dictionary<TValue>, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TResult>( collection: {}[], method: (...args: any[]) => TResult, ...args: any[]): TResult[]; /** * @see _.invokeMap **/ invokeMap<TResult>( collection: Dictionary<{}>, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.invokeMap **/ invokeMap<TResult>( methodName: string, ...args: any[]): LoDashImplicitArrayWrapper<TResult>; /** * @see _.invokeMap **/ invokeMap<TResult>( method: (...args: any[]) => TResult, ...args: any[]): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.invokeMap **/ invokeMap<TResult>( methodName: string, ...args: any[]): LoDashImplicitArrayWrapper<TResult>; /** * @see _.invokeMap **/ invokeMap<TResult>( method: (...args: any[]) => TResult, ...args: any[]): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.invokeMap **/ invokeMap<TResult>( methodName: string, ...args: any[]): LoDashExplicitArrayWrapper<TResult>; /** * @see _.invokeMap **/ invokeMap<TResult>( method: (...args: any[]) => TResult, ...args: any[]): LoDashExplicitArrayWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.invokeMap **/ invokeMap<TResult>( methodName: string, ...args: any[]): LoDashExplicitArrayWrapper<TResult>; /** * @see _.invokeMap **/ invokeMap<TResult>( method: (...args: any[]) => TResult, ...args: any[]): LoDashExplicitArrayWrapper<TResult>; } //_.map interface LoDashStatic { /** * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to * thisArg and invoked with three arguments: (value, index|key, collection). * * If a property name is provided for iteratee the created _.property style callback returns the property value * of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for iteratee the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, * _.reject, and _.some. * * The guarded methods are: * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, * sample, some, sum, uniq, and words * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns the new mapped array. */ map<T, TResult>( collection: List<T>, iteratee?: ListIterator<T, TResult> ): TResult[]; /** * @see _.map */ map<T extends {}, TResult>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, TResult> ): TResult[]; map<T extends {}, TResult>( collection: NumericDictionary<T>, iteratee?: NumericDictionaryIterator<T, TResult> ): TResult[]; /** * @see _.map */ map<T, TResult>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, iteratee?: string ): TResult[]; /** * @see _.map */ map<T, TObject extends {}>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, iteratee?: TObject ): boolean[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.map */ map<TResult>( iteratee?: ListIterator<T, TResult> ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.map */ map<TResult>( iteratee?: string ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.map */ map<TObject extends {}>( iteratee?: TObject ): LoDashImplicitArrayWrapper<boolean>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.map */ map<TValue, TResult>( iteratee?: ListIterator<TValue, TResult>|DictionaryIterator<TValue, TResult> ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.map */ map<TValue, TResult>( iteratee?: string ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.map */ map<TObject extends {}>( iteratee?: TObject ): LoDashImplicitArrayWrapper<boolean>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.map */ map<TResult>( iteratee?: ListIterator<T, TResult> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.map */ map<TResult>( iteratee?: string ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.map */ map<TObject extends {}>( iteratee?: TObject ): LoDashExplicitArrayWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.map */ map<TValue, TResult>( iteratee?: ListIterator<TValue, TResult>|DictionaryIterator<TValue, TResult> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.map */ map<TValue, TResult>( iteratee?: string ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.map */ map<TObject extends {}>( iteratee?: TObject ): LoDashExplicitArrayWrapper<boolean>; } //_.partition interface LoDashStatic { /** * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, * while the second of which contains elements predicate returns falsey for. * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). * * If a property name is provided for predicate the created _.property style callback * returns the property value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback * returns true for elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns * true for elements that have the properties of the given object, else false. * * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of predicate. * @return Returns the array of grouped elements. **/ partition<T>( collection: List<T>, callback: ListIterator<T, boolean>): T[][]; /** * @see _.partition **/ partition<T>( collection: Dictionary<T>, callback: DictionaryIterator<T, boolean>): T[][]; /** * @see _.partition **/ partition<W, T>( collection: List<T>, whereValue: W): T[][]; /** * @see _.partition **/ partition<W, T>( collection: Dictionary<T>, whereValue: W): T[][]; /** * @see _.partition **/ partition<T>( collection: List<T>, path: string, srcValue: any): T[][]; /** * @see _.partition **/ partition<T>( collection: Dictionary<T>, path: string, srcValue: any): T[][]; /** * @see _.partition **/ partition<T>( collection: List<T>, pluckValue: string): T[][]; /** * @see _.partition **/ partition<T>( collection: Dictionary<T>, pluckValue: string): T[][]; } interface LoDashImplicitStringWrapper { /** * @see _.partition */ partition( callback: ListIterator<string, boolean>): LoDashImplicitArrayWrapper<string[]>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.partition */ partition( callback: ListIterator<T, boolean>): LoDashImplicitArrayWrapper<T[]>; /** * @see _.partition */ partition<W>( whereValue: W): LoDashImplicitArrayWrapper<T[]>; /** * @see _.partition */ partition( path: string, srcValue: any): LoDashImplicitArrayWrapper<T[]>; /** * @see _.partition */ partition( pluckValue: string): LoDashImplicitArrayWrapper<T[]>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.partition */ partition<TResult>( callback: ListIterator<TResult, boolean>): LoDashImplicitArrayWrapper<TResult[]>; /** * @see _.partition */ partition<TResult>( callback: DictionaryIterator<TResult, boolean>): LoDashImplicitArrayWrapper<TResult[]>; /** * @see _.partition */ partition<W, TResult>( whereValue: W): LoDashImplicitArrayWrapper<TResult[]>; /** * @see _.partition */ partition<TResult>( path: string, srcValue: any): LoDashImplicitArrayWrapper<TResult[]>; /** * @see _.partition */ partition<TResult>( pluckValue: string): LoDashImplicitArrayWrapper<TResult[]>; } //_.reduce interface LoDashStatic { /** * Reduces a collection to a value which is the accumulated result of running each * element in the collection through the callback, where each successive callback execution * consumes the return value of the previous execution. If accumulator is not provided the * first element of the collection will be used as the initial accumulator value. The callback * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param accumulator Initial value of the accumulator. * @param thisArg The this binding of callback. * @return Returns the accumulated value. **/ reduce<T, TResult>( collection: Array<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: List<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: Dictionary<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: NumericDictionary<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: Array<T>, callback: MemoIterator<T, TResult>): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: List<T>, callback: MemoIterator<T, TResult>): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: Dictionary<T>, callback: MemoIterator<T, TResult>): TResult; /** * @see _.reduce **/ reduce<T, TResult>( collection: NumericDictionary<T>, callback: MemoIterator<T, TResult>): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.reduce **/ reduce<TResult>( callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<TResult>( callback: MemoIterator<T, TResult>): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.reduce **/ reduce<TValue, TResult>( callback: MemoIterator<TValue, TResult>, accumulator: TResult): TResult; /** * @see _.reduce **/ reduce<TValue, TResult>( callback: MemoIterator<TValue, TResult>): TResult; } //_.reduceRight interface LoDashStatic { /** * This method is like _.reduce except that it iterates over elements of a collection from * right to left. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param accumulator Initial value of the accumulator. * @param thisArg The this binding of callback. * @return The accumulated value. **/ reduceRight<T, TResult>( collection: Array<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduceRight **/ reduceRight<T, TResult>( collection: List<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduceRight **/ reduceRight<T, TResult>( collection: Dictionary<T>, callback: MemoIterator<T, TResult>, accumulator: TResult): TResult; /** * @see _.reduceRight **/ reduceRight<T, TResult>( collection: Array<T>, callback: MemoIterator<T, TResult>): TResult; /** * @see _.reduceRight **/ reduceRight<T, TResult>( collection: List<T>, callback: MemoIterator<T, TResult>): TResult; /** * @see _.reduceRight **/ reduceRight<T, TResult>( collection: Dictionary<T>, callback: MemoIterator<T, TResult>): TResult; } //_.reject interface LoDashStatic { /** * The opposite of _.filter; this method returns the elements of collection that predicate does not return * truthy for. * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the new filtered array. */ reject<T>( collection: List<T>, predicate?: ListIterator<T, boolean> ): T[]; /** * @see _.reject */ reject<T>( collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean> ): T[]; /** * @see _.reject */ reject( collection: string, predicate?: StringIterator<boolean> ): string[]; /** * @see _.reject */ reject<T>( collection: List<T>|Dictionary<T>, predicate: string ): T[]; /** * @see _.reject */ reject<W extends {}, T>( collection: List<T>|Dictionary<T>, predicate: W ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.reject */ reject( predicate?: StringIterator<boolean> ): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.reject */ reject( predicate: ListIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.reject */ reject( predicate: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.reject */ reject<W>(predicate: W): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.reject */ reject<T>( predicate: ListIterator<T, boolean>|DictionaryIterator<T, boolean> ): LoDashImplicitArrayWrapper<T>; /** * @see _.reject */ reject<T>( predicate: string ): LoDashImplicitArrayWrapper<T>; /** * @see _.reject */ reject<W, T>(predicate: W): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.reject */ reject( predicate?: StringIterator<boolean> ): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.reject */ reject( predicate: ListIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.reject */ reject( predicate: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.reject */ reject<W>(predicate: W): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.reject */ reject<T>( predicate: ListIterator<T, boolean>|DictionaryIterator<T, boolean> ): LoDashExplicitArrayWrapper<T>; /** * @see _.reject */ reject<T>( predicate: string ): LoDashExplicitArrayWrapper<T>; /** * @see _.reject */ reject<W, T>(predicate: W): LoDashExplicitArrayWrapper<T>; } //_.sample interface LoDashStatic { /** * Gets a random element from collection. * * @param collection The collection to sample. * @return Returns the random element. */ sample<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T> ): T; /** * @see _.sample */ sample<O extends Object, T>( collection: O ): T; /** * @see _.sample */ sample<T>( collection: Object ): T; } interface LoDashImplicitWrapper<T> { /** * @see _.sample */ sample(): string; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sample */ sample(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sample */ sample<T>(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.sample */ sample(): LoDashExplicitWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sample */ sample<TWrapper>(): TWrapper; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sample */ sample<TWrapper>(): TWrapper; } //_.sampleSize interface LoDashStatic { /** * Gets n random elements at unique keys from collection up to the size of collection. * * @param collection The collection to sample. * @param n The number of elements to sample. * @return Returns the random elements. */ sampleSize<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, n?: number ): T[]; /** * @see _.sampleSize */ sampleSize<O extends Object, T>( collection: O, n?: number ): T[]; /** * @see _.sampleSize */ sampleSize<T>( collection: Object, n?: number ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.sampleSize */ sampleSize( n?: number ): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sampleSize */ sampleSize( n?: number ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sampleSize */ sampleSize<T>( n?: number ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.sampleSize */ sampleSize( n?: number ): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sampleSize */ sampleSize( n?: number ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sampleSize */ sampleSize<T>( n?: number ): LoDashExplicitArrayWrapper<T>; } //_.shuffle interface LoDashStatic { /** * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. * * @param collection The collection to shuffle. * @return Returns the new shuffled array. */ shuffle<T>(collection: List<T>|Dictionary<T>): T[]; /** * @see _.shuffle */ shuffle(collection: string): string[]; } interface LoDashImplicitWrapper<T> { /** * @see _.shuffle */ shuffle(): LoDashImplicitArrayWrapper<string>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.shuffle */ shuffle(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.shuffle */ shuffle<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.shuffle */ shuffle(): LoDashExplicitArrayWrapper<string>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.shuffle */ shuffle(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.shuffle */ shuffle<T>(): LoDashExplicitArrayWrapper<T>; } //_.size interface LoDashStatic { /** * Gets the size of collection by returning its length for array-like values or the number of own enumerable * properties for objects. * * @param collection The collection to inspect. * @return Returns the size of collection. */ size<T>(collection: List<T>|Dictionary<T>): number; /** * @see _.size */ size(collection: string): number; } interface LoDashImplicitWrapper<T> { /** * @see _.size */ size(): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.size */ size(): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.size */ size(): number; } interface LoDashExplicitWrapper<T> { /** * @see _.size */ size(): LoDashExplicitWrapper<number>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.size */ size(): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.size */ size(): LoDashExplicitWrapper<number>; } //_.some interface LoDashStatic { /** * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection). * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @return Returns true if any element passes the predicate check, else false. */ some<T>( collection: List<T>, predicate?: ListIterator<T, boolean> ): boolean; /** * @see _.some */ some<T>( collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean> ): boolean; /** * @see _.some */ some<T>( collection: NumericDictionary<T>, predicate?: NumericDictionaryIterator<T, boolean> ): boolean; /** * @see _.some */ some( collection: Object, predicate?: ObjectIterator<any, boolean> ): boolean; /** * @see _.some */ some<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, predicate?: string|[string, any] ): boolean; /** * @see _.some */ some( collection: Object, predicate?: string|[string, any] ): boolean; /** * @see _.some */ some<TObject extends {}, T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, predicate?: TObject ): boolean; /** * @see _.some */ some<T>( collection: List<T>|Dictionary<T>|NumericDictionary<T>, predicate?: Object ): boolean; /** * @see _.some */ some<TObject extends {}>( collection: Object, predicate?: TObject ): boolean; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.some */ some( predicate?: ListIterator<T, boolean>|NumericDictionaryIterator<T, boolean> ): boolean; /** * @see _.some */ some( predicate?: string|[string, any] ): boolean; /** * @see _.some */ some<TObject extends {}>( predicate?: TObject ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.some */ some<TResult>( predicate?: ListIterator<TResult, boolean>|DictionaryIterator<TResult, boolean>|NumericDictionaryIterator<T, boolean>|ObjectIterator<any, boolean> ): boolean; /** * @see _.some */ some( predicate?: string|[string, any] ): boolean; /** * @see _.some */ some<TObject extends {}>( predicate?: TObject ): boolean; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.some */ some( predicate?: ListIterator<T, boolean>|NumericDictionaryIterator<T, boolean> ): LoDashExplicitWrapper<boolean>; /** * @see _.some */ some( predicate?: string|[string, any] ): LoDashExplicitWrapper<boolean>; /** * @see _.some */ some<TObject extends {}>( predicate?: TObject ): LoDashExplicitWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.some */ some<TResult>( predicate?: ListIterator<TResult, boolean>|DictionaryIterator<TResult, boolean>|NumericDictionaryIterator<T, boolean>|ObjectIterator<any, boolean> ): LoDashExplicitWrapper<boolean>; /** * @see _.some */ some( predicate?: string|[string, any] ): LoDashExplicitWrapper<boolean>; /** * @see _.some */ some<TObject extends {}>( predicate?: TObject ): LoDashExplicitWrapper<boolean>; } //_.sortBy interface LoDashStatic { /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] * The iteratees to sort by, specified individually or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, function(o) { return o.user; }); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] * * _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ sortBy<T, TSort>( collection: List<T>, iteratee?: ListIterator<T, TSort> ): T[]; /** * @see _.sortBy */ sortBy<T, TSort>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, TSort> ): T[]; /** * @see _.sortBy */ sortBy<T>( collection: List<T>|Dictionary<T>, iteratee: string ): T[]; /** * @see _.sortBy */ sortBy<W extends {}, T>( collection: List<T>|Dictionary<T>, whereValue: W ): T[]; /** * @see _.sortBy */ sortBy<T>( collection: List<T>|Dictionary<T> ): T[]; /** * @see _.sortBy */ sortBy<T>( collection: (Array<T>|List<T>), iteratees: (ListIterator<T, any>|string|Object)[]): T[]; /** * @see _.sortBy */ sortBy<T>( collection: (Array<T>|List<T>), ...iteratees: (ListIterator<T, boolean>|Object|string)[]): T[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sortBy */ sortBy<TSort>( iteratee?: ListIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy(iteratee: string): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<W extends {}>(whereValue: W): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy(): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy(...iteratees: (ListIterator<T, boolean>|Object|string)[]): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy **/ sortBy(iteratees: (ListIterator<T, any>|string|Object)[]): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sortBy */ sortBy<T, TSort>( iteratee?: ListIterator<T, TSort>|DictionaryIterator<T, TSort> ): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<T>(iteratee: string): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<W extends {}, T>(whereValue: W): LoDashImplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sortBy */ sortBy<TSort>( iteratee?: ListIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy(iteratee: string): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<W extends {}>(whereValue: W): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sortBy */ sortBy<T, TSort>( iteratee?: ListIterator<T, TSort>|DictionaryIterator<T, TSort> ): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<T>(iteratee: string): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<W extends {}, T>(whereValue: W): LoDashExplicitArrayWrapper<T>; /** * @see _.sortBy */ sortBy<T>(): LoDashExplicitArrayWrapper<T>; } //_.orderBy interface LoDashStatic { /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 42 }, * { 'user': 'barney', 'age': 36 } * ]; * * // sort by `user` in ascending order and by `age` in descending order * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ orderBy<W extends Object, T>( collection: List<T>, iteratees: ListIterator<T, any>|string|W|(ListIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** * @see _.orderBy */ orderBy<T>( collection: List<T>, iteratees: ListIterator<T, any>|string|Object|(ListIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** * @see _.orderBy */ orderBy<W extends Object, T>( collection: NumericDictionary<T>, iteratees: NumericDictionaryIterator<T, any>|string|W|(NumericDictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** * @see _.orderBy */ orderBy<T>( collection: NumericDictionary<T>, iteratees: NumericDictionaryIterator<T, any>|string|Object|(NumericDictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** * @see _.orderBy */ orderBy<W extends Object, T>( collection: Dictionary<T>, iteratees: DictionaryIterator<T, any>|string|W|(DictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** * @see _.orderBy */ orderBy<T>( collection: Dictionary<T>, iteratees: DictionaryIterator<T, any>|string|Object|(DictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.orderBy */ orderBy( iteratees: ListIterator<T, any>|string|(ListIterator<T, any>|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.orderBy */ orderBy<W extends Object>( iteratees: ListIterator<T, any>|string|W|(ListIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: ListIterator<T, any>|string|W|(ListIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: ListIterator<T, any>|string|Object|(ListIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: NumericDictionaryIterator<T, any>|string|W|(NumericDictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: NumericDictionaryIterator<T, any>|string|Object|(NumericDictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: DictionaryIterator<T, any>|string|W|(DictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: DictionaryIterator<T, any>|string|Object|(DictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.orderBy */ orderBy( iteratees: ListIterator<T, any>|string|(ListIterator<T, any>|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.orderBy */ orderBy<W extends Object>( iteratees: ListIterator<T, any>|string|W|(ListIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: ListIterator<T, any>|string|W|(ListIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: ListIterator<T, any>|string|Object|(ListIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: NumericDictionaryIterator<T, any>|string|W|(NumericDictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: NumericDictionaryIterator<T, any>|string|Object|(NumericDictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<W extends Object, T>( iteratees: DictionaryIterator<T, any>|string|W|(DictionaryIterator<T, any>|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; /** * @see _.orderBy */ orderBy<T>( iteratees: DictionaryIterator<T, any>|string|Object|(DictionaryIterator<T, any>|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper<T>; } /******** * Date * ********/ //_.now interface LoDashStatic { /** * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). * * @return The number of milliseconds. */ now(): number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.now */ now(): number; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.now */ now(): LoDashExplicitWrapper<number>; } /************* * Functions * *************/ //_.after interface LoDashStatic { /** * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. * * @param n The number of calls before func is invoked. * @param func The function to restrict. * @return Returns the new restricted function. */ after<TFunc extends Function>( n: number, func: TFunc ): TFunc; } interface LoDashImplicitWrapper<T> { /** * @see _.after **/ after<TFunc extends Function>(func: TFunc): LoDashImplicitObjectWrapper<TFunc>; } interface LoDashExplicitWrapper<T> { /** * @see _.after **/ after<TFunc extends Function>(func: TFunc): LoDashExplicitObjectWrapper<TFunc>; } //_.ary interface LoDashStatic { /** * Creates a function that accepts up to n arguments ignoring any additional arguments. * * @param func The function to cap arguments for. * @param n The arity cap. * @returns Returns the new function. */ ary<TResult extends Function>( func: Function, n?: number ): TResult; ary<T extends Function, TResult extends Function>( func: T, n?: number ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.ary */ ary<TResult extends Function>(n?: number): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.ary */ ary<TResult extends Function>(n?: number): LoDashExplicitObjectWrapper<TResult>; } //_.before interface LoDashStatic { /** * Creates a function that invokes func, with the this binding and arguments of the created function, while * it’s called less than n times. Subsequent calls to the created function return the result of the last func * invocation. * * @param n The number of calls at which func is no longer invoked. * @param func The function to restrict. * @return Returns the new restricted function. */ before<TFunc extends Function>( n: number, func: TFunc ): TFunc; } interface LoDashImplicitWrapper<T> { /** * @see _.before **/ before<TFunc extends Function>(func: TFunc): LoDashImplicitObjectWrapper<TFunc>; } interface LoDashExplicitWrapper<T> { /** * @see _.before **/ before<TFunc extends Function>(func: TFunc): LoDashExplicitObjectWrapper<TFunc>; } //_.bind interface FunctionBind { placeholder: any; <T extends Function, TResult extends Function>( func: T, thisArg: any, ...partials: any[] ): TResult; <TResult extends Function>( func: Function, thisArg: any, ...partials: any[] ): TResult; } interface LoDashStatic { /** * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind * arguments to those provided to the bound function. * * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for * partially applied arguments. * * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. * * @param func The function to bind. * @param thisArg The this binding of func. * @param partials The arguments to be partially applied. * @return Returns the new bound function. */ bind: FunctionBind; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.bind */ bind<TResult extends Function>( thisArg: any, ...partials: any[] ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.bind */ bind<TResult extends Function>( thisArg: any, ...partials: any[] ): LoDashExplicitObjectWrapper<TResult>; } //_.bindAll interface LoDashStatic { /** * Binds methods of an object to the object itself, overwriting the existing method. Method names may be * specified as individual arguments or as arrays of method names. If no method names are provided all * enumerable function properties, own and inherited, of object are bound. * * Note: This method does not set the "length" property of bound functions. * * @param object The object to bind and assign the bound methods to. * @param methodNames The object method names to bind, specified as individual method names or arrays of * method names. * @return Returns object. */ bindAll<T>( object: T, ...methodNames: (string|string[])[] ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.bindAll */ bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.bindAll */ bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper<T>; } //_.bindKey interface FunctionBindKey { placeholder: any; <T extends Object, TResult extends Function>( object: T, key: any, ...partials: any[] ): TResult; <TResult extends Function>( object: Object, key: any, ...partials: any[] ): TResult; } interface LoDashStatic { /** * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments * to those provided to the bound function. * * This method differs from _.bind by allowing bound functions to reference methods that may be redefined * or don’t yet exist. See Peter Michaux’s article for more details. * * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder * for partially applied arguments. * * @param object The object the method belongs to. * @param key The key of the method. * @param partials The arguments to be partially applied. * @return Returns the new bound function. */ bindKey: FunctionBindKey; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.bindKey */ bindKey<TResult extends Function>( key: any, ...partials: any[] ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.bindKey */ bindKey<TResult extends Function>( key: any, ...partials: any[] ): LoDashExplicitObjectWrapper<TResult>; } //_.createCallback interface LoDashStatic { /** * Produces a callback bound to an optional thisArg. If func is a property name the created * callback will return the property value for a given element. If func is an object the created * callback will return true for elements that contain the equivalent object properties, * otherwise it will return false. * @param func The value to convert to a callback. * @param thisArg The this binding of the created callback. * @param argCount The number of arguments the callback accepts. * @return A callback function. **/ createCallback( func: string, argCount?: number): () => any; /** * @see _.createCallback **/ createCallback( func: Dictionary<any>, argCount?: number): () => boolean; } interface LoDashImplicitWrapper<T> { /** * @see _.createCallback **/ createCallback( argCount?: number): LoDashImplicitObjectWrapper<() => any>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.createCallback **/ createCallback( argCount?: number): LoDashImplicitObjectWrapper<() => any>; } //_.curry interface LoDashStatic { /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @return Returns the new curried function. */ curry<T1, R>(func: (t1: T1) => R): CurriedFunction1<T1, R>; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @return Returns the new curried function. */ curry<T1, T2, R>(func: (t1: T1, t2: T2) => R): CurriedFunction2<T1, T2, R>; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @return Returns the new curried function. */ curry<T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R): CurriedFunction3<T1, T2, T3, R>; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @return Returns the new curried function. */ curry<T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): CurriedFunction4<T1, T2, T3, T4, R>; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @return Returns the new curried function. */ curry<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): CurriedFunction5<T1, T2, T3, T4, T5, R>; /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning * its result, if all func arguments have been provided, or returns a function that accepts one or more of the * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. * @param func The function to curry. * @param arity The arity of func. * @return Returns the new curried function. */ curry<TResult extends Function>( func: Function, arity?: number): TResult; } interface CurriedFunction1<T1, R> { (): CurriedFunction1<T1, R>; (t1: T1): R; } interface CurriedFunction2<T1, T2, R> { (): CurriedFunction2<T1, T2, R>; (t1: T1): CurriedFunction1<T2, R>; (t1: T1, t2: T2): R; } interface CurriedFunction3<T1, T2, T3, R> { (): CurriedFunction3<T1, T2, T3, R>; (t1: T1): CurriedFunction2<T2, T3, R>; (t1: T1, t2: T2): CurriedFunction1<T3, R>; (t1: T1, t2: T2, t3: T3): R; } interface CurriedFunction4<T1, T2, T3, T4, R> { (): CurriedFunction4<T1, T2, T3, T4, R>; (t1: T1): CurriedFunction3<T2, T3, T4, R>; (t1: T1, t2: T2): CurriedFunction2<T3, T4, R>; (t1: T1, t2: T2, t3: T3): CurriedFunction1<T4, R>; (t1: T1, t2: T2, t3: T3, t4: T4): R; } interface CurriedFunction5<T1, T2, T3, T4, T5, R> { (): CurriedFunction5<T1, T2, T3, T4, T5, R>; (t1: T1): CurriedFunction4<T2, T3, T4, T5, R>; (t1: T1, t2: T2): CurriedFunction3<T3, T4, T5, R>; (t1: T1, t2: T2, t3: T3): CurriedFunction2<T4, T5, R>; (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1<T5, R>; (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.curry **/ curry<TResult extends Function>(arity?: number): LoDashImplicitObjectWrapper<TResult>; } //_.curryRight interface LoDashStatic { /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @return Returns the new curried function. */ curryRight<T1, R>(func: (t1: T1) => R): CurriedFunction1<T1, R>; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @return Returns the new curried function. */ curryRight<T1, T2, R>(func: (t1: T1, t2: T2) => R): CurriedFunction2<T2, T1, R>; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @return Returns the new curried function. */ curryRight<T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R): CurriedFunction3<T3, T2, T1, R>; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @return Returns the new curried function. */ curryRight<T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): CurriedFunction4<T4, T3, T2, T1, R>; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @return Returns the new curried function. */ curryRight<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): CurriedFunction5<T5, T4, T3, T2, T1, R>; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. * @param func The function to curry. * @param arity The arity of func. * @return Returns the new curried function. */ curryRight<TResult extends Function>( func: Function, arity?: number): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.curryRight **/ curryRight<TResult extends Function>(arity?: number): LoDashImplicitObjectWrapper<TResult>; } //_.debounce interface DebounceSettings { /** * Specify invoking on the leading edge of the timeout. */ leading?: boolean; /** * The maximum time func is allowed to be delayed before it’s invoked. */ maxWait?: number; /** * Specify invoking on the trailing edge of the timeout. */ trailing?: boolean; } interface LoDashStatic { /** * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since * the last time the debounced function was invoked. The debounced function comes with a cancel method to * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the * result of the last func invocation. * * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only * if the the debounced function is invoked more than once during the wait timeout. * * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. * * @param func The function to debounce. * @param wait The number of milliseconds to delay. * @param options The options object. * @param options.leading Specify invoking on the leading edge of the timeout. * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. * @param options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new debounced function. */ debounce<T extends Function>( func: T, wait?: number, options?: DebounceSettings ): T & Cancelable; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.debounce */ debounce( wait?: number, options?: DebounceSettings ): LoDashImplicitObjectWrapper<T & Cancelable>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.debounce */ debounce( wait?: number, options?: DebounceSettings ): LoDashExplicitObjectWrapper<T & Cancelable>; } //_.defer interface LoDashStatic { /** * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to * func when it’s invoked. * * @param func The function to defer. * @param args The arguments to invoke the function with. * @return Returns the timer id. */ defer<T extends Function>( func: T, ...args: any[] ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.defer */ defer(...args: any[]): LoDashImplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.defer */ defer(...args: any[]): LoDashExplicitWrapper<number>; } //_.delay interface LoDashStatic { /** * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. * * @param func The function to delay. * @param wait The number of milliseconds to delay invocation. * @param args The arguments to invoke the function with. * @return Returns the timer id. */ delay<T extends Function>( func: T, wait: number, ...args: any[] ): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.delay */ delay( wait: number, ...args: any[] ): LoDashImplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.delay */ delay( wait: number, ...args: any[] ): LoDashExplicitWrapper<number>; } interface LoDashStatic { /** * Creates a function that invokes `func` with arguments reversed. * * @static * @memberOf _ * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new function. * @example * * var flipped = _.flip(function() { * return _.toArray(arguments); * }); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ flip<T extends Function>(func: T): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flip */ flip(): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flip */ flip(): LoDashExplicitObjectWrapper<T>; } //_.flow interface LoDashStatic { /** * Creates a function that returns the result of invoking the provided functions with the this binding of the * created function, where each successive invocation is supplied the return value of the previous. * * @param funcs Functions to invoke. * @return Returns the new function. */ flow<TResult extends Function>(...funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flow */ flow<TResult extends Function>(...funcs: Function[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flow */ flow<TResult extends Function>(...funcs: Function[]): LoDashExplicitObjectWrapper<TResult>; } //_.flowRight interface LoDashStatic { /** * This method is like _.flow except that it creates a function that invokes the provided functions from right * to left. * * @param funcs Functions to invoke. * @return Returns the new function. */ flowRight<TResult extends Function>(...funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.flowRight */ flowRight<TResult extends Function>(...funcs: Function[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.flowRight */ flowRight<TResult extends Function>(...funcs: Function[]): LoDashExplicitObjectWrapper<TResult>; } //_.memoize interface MemoizedFunction extends Function { cache: MapCache; } interface LoDashStatic { /** * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for * storing the result based on the arguments provided to the memoized function. By default, the first argument * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with * the this binding of the memoized function. * * @param func The function to have its output memoized. * @param resolver The function to resolve the cache key. * @return Returns the new memoizing function. */ memoize: { <T extends Function>(func: T, resolver?: Function): T & MemoizedFunction; Cache: MapCache; } } interface LoDashImplicitObjectWrapper<T> { /** * @see _.memoize */ memoize(resolver?: Function): LoDashImplicitObjectWrapper<T & MemoizedFunction>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.memoize */ memoize(resolver?: Function): LoDashExplicitObjectWrapper<T & MemoizedFunction>; } //_.overArgs (was _.modArgs) interface LoDashStatic { /** * Creates a function that runs each argument through a corresponding transform function. * * @param func The function to wrap. * @param transforms The functions to transform arguments, specified as individual functions or arrays * of functions. * @return Returns the new function. */ overArgs<T extends Function, TResult extends Function>( func: T, ...transforms: Function[] ): TResult; /** * @see _.overArgs */ overArgs<T extends Function, TResult extends Function>( func: T, transforms: Function[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.overArgs */ overArgs<TResult extends Function>(...transforms: Function[]): LoDashImplicitObjectWrapper<TResult>; /** * @see _.overArgs */ overArgs<TResult extends Function>(transforms: Function[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.overArgs */ overArgs<TResult extends Function>(...transforms: Function[]): LoDashExplicitObjectWrapper<TResult>; /** * @see _.overArgs */ overArgs<TResult extends Function>(transforms: Function[]): LoDashExplicitObjectWrapper<TResult>; } //_.negate interface LoDashStatic { /** * Creates a function that negates the result of the predicate func. The func predicate is invoked with * the this binding and arguments of the created function. * * @param predicate The predicate to negate. * @return Returns the new function. */ negate<T extends Function>(predicate: T): (...args: any[]) => boolean; /** * @see _.negate */ negate<T extends Function, TResult extends Function>(predicate: T): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.negate */ negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; /** * @see _.negate */ negate<TResult extends Function>(): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.negate */ negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; /** * @see _.negate */ negate<TResult extends Function>(): LoDashExplicitObjectWrapper<TResult>; } //_.once interface LoDashStatic { /** * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value * of the first call. The func is invoked with the this binding and arguments of the created function. * * @param func The function to restrict. * @return Returns the new restricted function. */ once<T extends Function>(func: T): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.once */ once(): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.once */ once(): LoDashExplicitObjectWrapper<T>; } //_.partial interface LoDashStatic { /** * Creates a function that, when called, invokes func with any additional partial arguments * prepended to those provided to the new function. This method is similar to _.bind except * it does not alter the this binding. * @param func The function to partially apply arguments to. * @param args Arguments to be partially applied. * @return The new partially applied function. **/ partial: Partial; } type PH = LoDashStatic; interface Function0<R> { (): R; } interface Function1<T1, R> { (t1: T1): R; } interface Function2<T1, T2, R> { (t1: T1, t2: T2): R; } interface Function3<T1, T2, T3, R> { (t1: T1, t2: T2, t3: T3): R; } interface Function4<T1, T2, T3, T4, R> { (t1: T1, t2: T2, t3: T3, t4: T4): R; } interface Partial { // arity 0 <R>(func: Function0<R>): Function0<R>; // arity 1 <T1, R>(func: Function1<T1, R>): Function1<T1, R>; <T1, R>(func: Function1<T1, R>, arg1: T1): Function0<R>; // arity 2 <T1, T2, R>(func: Function2<T1, T2, R>): Function2<T1, T2, R>; <T1, T2, R>(func: Function2<T1, T2, R>, arg1: T1): Function1< T2, R>; <T1, T2, R>(func: Function2<T1, T2, R>, plc1: PH, arg2: T2): Function1<T1, R>; <T1, T2, R>(func: Function2<T1, T2, R>, arg1: T1, arg2: T2): Function0< R>; // arity 3 <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>): Function3<T1, T2, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1): Function2< T2, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: PH, arg2: T2): Function2<T1, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, arg2: T2): Function1< T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: PH, plc2: PH, arg3: T3): Function2<T1, T2, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, plc1: PH, arg2: T2, arg3: T3): Function1<T1, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, arg2: T2, arg3: T3): Function0< R>; // arity 4 <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>): Function4<T1, T2, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1): Function3< T2, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, arg2: T2): Function3<T1, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2): Function2< T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, plc2: PH, arg3: T3): Function3<T1, T2, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, arg3: T3): Function2< T2, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, arg2: T2, arg3: T3): Function2<T1, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3): Function1< T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, plc2: PH, plc3: PH, arg4: T4): Function3<T1, T2, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, arg2: T2, plc3: PH, arg4: T4): Function2<T1, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, plc2: PH, arg3: T3, arg4: T4): Function2<T1, T2, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1<T1, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; // catch-all (func: Function, ...args: any[]): Function; } //_.partialRight interface LoDashStatic { /** * This method is like _.partial except that partial arguments are appended to those provided * to the new function. * @param func The function to partially apply arguments to. * @param args Arguments to be partially applied. * @return The new partially applied function. **/ partialRight: PartialRight } interface PartialRight { // arity 0 <R>(func: Function0<R>): Function0<R>; // arity 1 <T1, R>(func: Function1<T1, R>): Function1<T1, R>; <T1, R>(func: Function1<T1, R>, arg1: T1): Function0<R>; // arity 2 <T1, T2, R>(func: Function2<T1, T2, R>): Function2<T1, T2, R>; <T1, T2, R>(func: Function2<T1, T2, R>, arg1: T1, plc2: PH): Function1< T2, R>; <T1, T2, R>(func: Function2<T1, T2, R>, arg2: T2): Function1<T1, R>; <T1, T2, R>(func: Function2<T1, T2, R>, arg1: T1, arg2: T2): Function0< R>; // arity 3 <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>): Function3<T1, T2, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, plc2: PH, plc3: PH): Function2< T2, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg2: T2, plc3: PH): Function2<T1, T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, arg2: T2, plc3: PH): Function1< T3, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg3: T3): Function2<T1, T2, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg2: T2, arg3: T3): Function1<T1, R>; <T1, T2, T3, R>(func: Function3<T1, T2, T3, R>, arg1: T1, arg2: T2, arg3: T3): Function0< R>; // arity 4 <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>): Function4<T1, T2, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, plc3: PH, plc4: PH): Function3< T2, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg2: T2, plc3: PH, plc4: PH): Function3<T1, T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, plc3: PH, plc4: PH): Function2< T3, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg3: T3, plc4: PH): Function3<T1, T2, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, arg3: T3, plc4: PH): Function2< T2, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg2: T2, arg3: T3, plc4: PH): Function2<T1, T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3, plc4: PH): Function1< T4, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg4: T4): Function3<T1, T2, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg2: T2, plc3: PH, arg4: T4): Function2<T1, T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg3: T3, arg4: T4): Function2<T1, T2, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg2: T2, arg3: T3, arg4: T4): Function1<T1, R>; <T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; // catch-all (func: Function, ...args: any[]): Function; } //_.rearg interface LoDashStatic { /** * Creates a function that invokes func with arguments arranged according to the specified indexes where the * argument value at the first index is provided as the first argument, the argument value at the second index * is provided as the second argument, and so on. * @param func The function to rearrange arguments for. * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. * @return Returns the new function. */ rearg<TResult extends Function>(func: Function, indexes: number[]): TResult; /** * @see _.rearg */ rearg<TResult extends Function>(func: Function, ...indexes: number[]): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.rearg */ rearg<TResult extends Function>(indexes: number[]): LoDashImplicitObjectWrapper<TResult>; /** * @see _.rearg */ rearg<TResult extends Function>(...indexes: number[]): LoDashImplicitObjectWrapper<TResult>; } //_.rest interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and arguments from start * and beyond provided as an array. * * Note: This method is based on the rest parameter. * * @param func The function to apply a rest parameter to. * @param start The start position of the rest parameter. * @return Returns the new function. */ rest<TResult extends Function>( func: Function, start?: number ): TResult; /** * @see _.rest */ rest<TResult extends Function, TFunc extends Function>( func: TFunc, start?: number ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.rest */ rest<TResult extends Function>(start?: number): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.rest */ rest<TResult extends Function>(start?: number): LoDashExplicitObjectWrapper<TResult>; } //_.spread interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and an array of arguments * much like Function#apply. * * Note: This method is based on the spread operator. * * @param func The function to spread arguments over. * @return Returns the new function. */ spread<F extends Function, T extends Function>(func: F): T; /** * @see _.spread */ spread<T extends Function>(func: Function): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.spread */ spread<T extends Function>(): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.spread */ spread<T extends Function>(): LoDashExplicitObjectWrapper<T>; } //_.throttle interface ThrottleSettings { /** * If you'd like to disable the leading-edge call, pass this as false. */ leading?: boolean; /** * If you'd like to disable the execution on the trailing-edge, pass false. */ trailing?: boolean; } interface LoDashStatic { /** * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to * the throttled function return the result of the last func call. * * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if * the the throttled function is invoked more than once during the wait timeout. * * @param func The function to throttle. * @param wait The number of milliseconds to throttle invocations to. * @param options The options object. * @param options.leading Specify invoking on the leading edge of the timeout. * @param options.trailing Specify invoking on the trailing edge of the timeout. * @return Returns the new throttled function. */ throttle<T extends Function>( func: T, wait?: number, options?: ThrottleSettings ): T & Cancelable; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.throttle */ throttle( wait?: number, options?: ThrottleSettings ): LoDashImplicitObjectWrapper<T & Cancelable>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.throttle */ throttle( wait?: number, options?: ThrottleSettings ): LoDashExplicitObjectWrapper<T & Cancelable>; } //_.unary interface LoDashStatic { /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ unary<T extends Function>(func: T): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.unary */ unary(): LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.unary */ unary(): LoDashExplicitObjectWrapper<T>; } //_.wrap interface LoDashStatic { /** * Creates a function that provides value to the wrapper function as its first argument. Any additional * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is * invoked with the this binding of the created function. * * @param value The value to wrap. * @param wrapper The wrapper function. * @return Returns the new function. */ wrap<V, W extends Function, R extends Function>( value: V, wrapper: W ): R; /** * @see _.wrap */ wrap<V, R extends Function>( value: V, wrapper: Function ): R; /** * @see _.wrap */ wrap<R extends Function>( value: any, wrapper: Function ): R; } interface LoDashImplicitWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashImplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashImplicitObjectWrapper<R>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashImplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashImplicitObjectWrapper<R>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashImplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashImplicitObjectWrapper<R>; } interface LoDashExplicitWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashExplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashExplicitObjectWrapper<R>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashExplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashExplicitObjectWrapper<R>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.wrap */ wrap<W extends Function, R extends Function>(wrapper: W): LoDashExplicitObjectWrapper<R>; /** * @see _.wrap */ wrap<R extends Function>(wrapper: Function): LoDashExplicitObjectWrapper<R>; } /******** * Lang * ********/ //_.castArray interface LoDashStatic { /** * Casts value as an array if it’s not one. * * @param value The value to inspect. * @return Returns the cast array. */ castArray<T>(value: T): T[]; } interface LoDashImplicitWrapper<T> { /** * @see _.castArray */ castArray(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.castArray */ castArray(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.castArray */ castArray(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitWrapper<T> { /** * @see _.castArray */ castArray(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.castArray */ castArray(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.castArray */ castArray(): LoDashExplicitArrayWrapper<T>; } //_.clone interface LoDashStatic { /** * Creates a shallow clone of value. * * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays, * array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols, * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty * object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps. * * @param value The value to clone. * @return Returns the cloned value. */ clone<T>(value: T): T; } interface LoDashImplicitWrapper<T> { /** * @see _.clone */ clone(): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.clone */ clone(): T[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.clone */ clone(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.clone */ clone(): LoDashExplicitWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.clone */ clone(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.clone */ clone(): LoDashExplicitObjectWrapper<T>; } //_.cloneDeep interface LoDashStatic { /** * This method is like _.clone except that it recursively clones value. * * @param value The value to recursively clone. * @return Returns the deep cloned value. */ cloneDeep<T>(value: T): T; } interface LoDashImplicitWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): T[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): LoDashExplicitWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.cloneDeep */ cloneDeep(): LoDashExplicitObjectWrapper<T>; } //_.cloneDeepWith interface CloneDeepWithCustomizer<TValue, TResult> { (value: TValue): TResult; } interface LoDashStatic { /** * This method is like _.cloneWith except that it recursively clones value. * * @param value The value to recursively clone. * @param customizer The function to customize cloning. * @return Returns the deep cloned value. */ cloneDeepWith<TResult>( value: any, customizer?: CloneDeepWithCustomizer<any, TResult> ): TResult; /** * @see _.clonDeepeWith */ cloneDeepWith<T, TResult>( value: T, customizer?: CloneDeepWithCustomizer<T, TResult> ): TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T, TResult> ): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T[], TResult> ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T, TResult> ): TResult; } interface LoDashExplicitWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends (number|string|boolean)>( customizer?: CloneDeepWithCustomizer<T, TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T, TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends Object>( customizer?: CloneDeepWithCustomizer<T, TResult> ): LoDashExplicitObjectWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends (number|string|boolean)>( customizer?: CloneDeepWithCustomizer<T[], TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T[], TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends Object>( customizer?: CloneDeepWithCustomizer<T[], TResult> ): LoDashExplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends (number|string|boolean)>( customizer?: CloneDeepWithCustomizer<T, TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult>( customizer?: CloneDeepWithCustomizer<T, TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneDeepWith */ cloneDeepWith<TResult extends Object>( customizer?: CloneDeepWithCustomizer<T, TResult> ): LoDashExplicitObjectWrapper<TResult>; } //_.cloneWith interface CloneWithCustomizer<TValue, TResult> { (value: TValue): TResult; } interface LoDashStatic { /** * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. * If customizer returns undefined cloning is handled by the method instead. * * @param value The value to clone. * @param customizer The function to customize cloning. * @return Returns the cloned value. */ cloneWith<TResult>( value: any, customizer?: CloneWithCustomizer<any, TResult> ): TResult; /** * @see _.cloneWith */ cloneWith<T, TResult>( value: T, customizer?: CloneWithCustomizer<T, TResult> ): TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T, TResult> ): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T[], TResult> ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T, TResult> ): TResult; } interface LoDashExplicitWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult extends (number|string|boolean)>( customizer?: CloneWithCustomizer<T, TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T, TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult extends Object>( customizer?: CloneWithCustomizer<T, TResult> ): LoDashExplicitObjectWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult extends (number|string|boolean)>( customizer?: CloneWithCustomizer<T[], TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T[], TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult extends Object>( customizer?: CloneWithCustomizer<T[], TResult> ): LoDashExplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.cloneWith */ cloneWith<TResult extends (number|string|boolean)>( customizer?: CloneWithCustomizer<T, TResult> ): LoDashExplicitWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult>( customizer?: CloneWithCustomizer<T, TResult[]> ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.cloneWith */ cloneWith<TResult extends Object>( customizer?: CloneWithCustomizer<T, TResult> ): LoDashExplicitObjectWrapper<TResult>; } //_.eq interface LoDashStatic { /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ eq( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isEqual */ eq( other: any ): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isEqual */ eq( other: any ): LoDashExplicitWrapper<boolean>; } //_.gt interface LoDashStatic { /** * Checks if value is greater than other. * * @param value The value to compare. * @param other The other value to compare. * @return Returns true if value is greater than other, else false. */ gt( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.gt */ gt(other: any): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.gt */ gt(other: any): LoDashExplicitWrapper<boolean>; } //_.gte interface LoDashStatic { /** * Checks if value is greater than or equal to other. * * @param value The value to compare. * @param other The other value to compare. * @return Returns true if value is greater than or equal to other, else false. */ gte( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.gte */ gte(other: any): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.gte */ gte(other: any): LoDashExplicitWrapper<boolean>; } //_.isArguments interface LoDashStatic { /** * Checks if value is classified as an arguments object. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isArguments(value?: any): value is IArguments; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isArguments */ isArguments(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isArguments */ isArguments(): LoDashExplicitWrapper<boolean>; } //_.isArray interface LoDashStatic { /** * Checks if value is classified as an Array object. * @param value The value to check. * * @return Returns true if value is correctly classified, else false. */ isArray<T>(value?: any): value is T[]; } interface LoDashImplicitWrapperBase<T,TWrapper> { /** * @see _.isArray */ isArray(): boolean; } interface LoDashExplicitWrapperBase<T,TWrapper> { /** * @see _.isArray */ isArray(): LoDashExplicitWrapper<boolean>; } //_.isArrayBuffer interface LoDashStatic { /** * Checks if value is classified as an ArrayBuffer object. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isArrayBuffer(value?: any): value is ArrayBuffer; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isArrayBuffer */ isArrayBuffer(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isArrayBuffer */ isArrayBuffer(): LoDashExplicitWrapper<boolean>; } //_.isArrayLike interface LoDashStatic { /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ isArrayLike<T>(value?: any): value is T[]; } interface LoDashImplicitWrapperBase<T,TWrapper> { /** * @see _.isArrayLike */ isArrayLike(): boolean; } interface LoDashExplicitWrapperBase<T,TWrapper> { /** * @see _.isArrayLike */ isArrayLike(): LoDashExplicitWrapper<boolean>; } //_.isArrayLikeObject interface LoDashStatic { /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ isArrayLikeObject<T>(value?: any): value is T[]; } interface LoDashImplicitWrapperBase<T,TWrapper> { /** * @see _.isArrayLikeObject */ isArrayLikeObject(): boolean; } interface LoDashExplicitWrapperBase<T,TWrapper> { /** * @see _.isArrayLikeObject */ isArrayLikeObject(): LoDashExplicitWrapper<boolean>; } //_.isBoolean interface LoDashStatic { /** * Checks if value is classified as a boolean primitive or object. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isBoolean(value?: any): value is boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isBoolean */ isBoolean(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isBoolean */ isBoolean(): LoDashExplicitWrapper<boolean>; } //_.isBuffer interface LoDashStatic { /** * Checks if value is a buffer. * * @param value The value to check. * @return Returns true if value is a buffer, else false. */ isBuffer(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isBuffer */ isBuffer(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isBuffer */ isBuffer(): LoDashExplicitWrapper<boolean>; } //_.isDate interface LoDashStatic { /** * Checks if value is classified as a Date object. * @param value The value to check. * * @return Returns true if value is correctly classified, else false. */ isDate(value?: any): value is Date; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isDate */ isDate(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isDate */ isDate(): LoDashExplicitWrapper<boolean>; } //_.isElement interface LoDashStatic { /** * Checks if value is a DOM element. * * @param value The value to check. * @return Returns true if value is a DOM element, else false. */ isElement(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isElement */ isElement(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isElement */ isElement(): LoDashExplicitWrapper<boolean>; } //_.isEmpty interface LoDashStatic { /** * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. * * @param value The value to inspect. * @return Returns true if value is empty, else false. */ isEmpty(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isEmpty */ isEmpty(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isEmpty */ isEmpty(): LoDashExplicitWrapper<boolean>; } //_.isEqual interface LoDashStatic { /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are **not** supported. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ isEqual( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isEqual */ isEqual( other: any ): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isEqual */ isEqual( other: any ): LoDashExplicitWrapper<boolean>; } // _.isEqualWith interface IsEqualCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; } interface LoDashStatic { /** * This method is like `_.isEqual` except that it accepts `customizer` which is * invoked to compare values. If `customizer` returns `undefined` comparisons are * handled by the method instead. The `customizer` is invoked with up to seven arguments: * (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqualWith(array, other, customizer); * // => true */ isEqualWith( value: any, other: any, customizer: IsEqualCustomizer ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isEqualWith */ isEqualWith( other: any, customizer: IsEqualCustomizer ): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isEqualWith */ isEqualWith( other: any, customizer: IsEqualCustomizer ): LoDashExplicitWrapper<boolean>; } //_.isError interface LoDashStatic { /** * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError * object. * * @param value The value to check. * @return Returns true if value is an error object, else false. */ isError(value: any): value is Error; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isError */ isError(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isError */ isError(): LoDashExplicitWrapper<boolean>; } //_.isFinite interface LoDashStatic { /** * Checks if value is a finite primitive number. * * Note: This method is based on Number.isFinite. * * @param value The value to check. * @return Returns true if value is a finite number, else false. */ isFinite(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isFinite */ isFinite(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isFinite */ isFinite(): LoDashExplicitWrapper<boolean>; } //_.isFunction interface LoDashStatic { /** * Checks if value is classified as a Function object. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isFunction(value?: any): value is Function; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isFunction */ isFunction(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isFunction */ isFunction(): LoDashExplicitWrapper<boolean>; } //_.isInteger interface LoDashStatic { /** * Checks if `value` is an integer. * * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. * @example * * _.isInteger(3); * // => true * * _.isInteger(Number.MIN_VALUE); * // => false * * _.isInteger(Infinity); * // => false * * _.isInteger('3'); * // => false */ isInteger(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isInteger */ isInteger(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isInteger */ isInteger(): LoDashExplicitWrapper<boolean>; } //_.isLength interface LoDashStatic { /** * Checks if `value` is a valid array-like length. * * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ isLength(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isLength */ isLength(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isLength */ isLength(): LoDashExplicitWrapper<boolean>; } //_.isMap interface LoDashStatic { /** * Checks if value is classified as a Map object. * * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ isMap<K, V>(value?: any): value is Map<K, V>; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isMap */ isMap(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isMap */ isMap(): LoDashExplicitWrapper<boolean>; } //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; } interface LoDashStatic { /** * Performs a deep comparison between `object` and `source` to determine if * `object` contains equivalent property values. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.isMatch(object, { 'age': 40 }); * // => true * * _.isMatch(object, { 'age': 36 }); * // => false */ isMatch(object: Object, source: Object): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.isMatch */ isMatch(source: Object): boolean; } //_.isMatchWith interface isMatchWithCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; } interface LoDashStatic { /** * This method is like `_.isMatch` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined` comparisons * are handled by the method instead. The `customizer` is invoked with three * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, srcValue) { * if (isGreeting(objValue) && isGreeting(srcValue)) { * return true; * } * } * * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatchWith(object, source, customizer); * // => true */ isMatchWith(object: Object, source: Object, customizer: isMatchWithCustomizer): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.isMatchWith */ isMatchWith(source: Object, customizer: isMatchWithCustomizer): boolean; } //_.isNaN interface LoDashStatic { /** * Checks if value is NaN. * * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. * * @param value The value to check. * @return Returns true if value is NaN, else false. */ isNaN(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isNaN */ isNaN(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isNaN */ isNaN(): LoDashExplicitWrapper<boolean>; } //_.isNative interface LoDashStatic { /** * Checks if value is a native function. * @param value The value to check. * * @retrun Returns true if value is a native function, else false. */ isNative(value: any): value is Function; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isNative */ isNative(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isNative */ isNative(): LoDashExplicitWrapper<boolean>; } //_.isNil interface LoDashStatic { /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ isNil(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isNil */ isNil(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isNil */ isNil(): LoDashExplicitWrapper<boolean>; } //_.isNull interface LoDashStatic { /** * Checks if value is null. * * @param value The value to check. * @return Returns true if value is null, else false. */ isNull(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isNull */ isNull(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isNull */ isNull(): LoDashExplicitWrapper<boolean>; } //_.isNumber interface LoDashStatic { /** * Checks if value is classified as a Number primitive or object. * * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isNumber(value?: any): value is number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isNumber */ isNumber(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isNumber */ isNumber(): LoDashExplicitWrapper<boolean>; } //_.isObject interface LoDashStatic { /** * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), * and new String('')) * * @param value The value to check. * @return Returns true if value is an object, else false. */ isObject(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isObject */ isObject(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isObject */ isObject(): LoDashExplicitWrapper<boolean>; } //_.isObjectLike interface LoDashStatic { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ isObjectLike(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isObjectLike */ isObjectLike(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isObjectLike */ isObjectLike(): LoDashExplicitWrapper<boolean>; } //_.isPlainObject interface LoDashStatic { /** * Checks if value is a plain object, that is, an object created by the Object constructor or one with a * [[Prototype]] of null. * * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. * * @param value The value to check. * @return Returns true if value is a plain object, else false. */ isPlainObject(value?: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isPlainObject */ isPlainObject(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isPlainObject */ isPlainObject(): LoDashExplicitWrapper<boolean>; } //_.isRegExp interface LoDashStatic { /** * Checks if value is classified as a RegExp object. * @param value The value to check. * * @return Returns true if value is correctly classified, else false. */ isRegExp(value?: any): value is RegExp; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isRegExp */ isRegExp(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isRegExp */ isRegExp(): LoDashExplicitWrapper<boolean>; } //_.isSafeInteger interface LoDashStatic { /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. * @example * * _.isSafeInteger(3); * // => true * * _.isSafeInteger(Number.MIN_VALUE); * // => false * * _.isSafeInteger(Infinity); * // => false * * _.isSafeInteger('3'); * // => false */ isSafeInteger(value: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isSafeInteger */ isSafeInteger(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isSafeInteger */ isSafeInteger(): LoDashExplicitWrapper<boolean>; } //_.isSet interface LoDashStatic { /** * Checks if value is classified as a Set object. * * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ isSet<T>(value?: any): value is Set<T>; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isSet */ isSet(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isSet */ isSet(): LoDashExplicitWrapper<boolean>; } //_.isString interface LoDashStatic { /** * Checks if value is classified as a String primitive or object. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isString(value?: any): value is string; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isString */ isString(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isString */ isString(): LoDashExplicitWrapper<boolean>; } //_.isSymbol interface LoDashStatic { /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ isSymbol(value: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isSymbol */ isSymbol(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isSymbol */ isSymbol(): LoDashExplicitWrapper<boolean>; } //_.isTypedArray interface LoDashStatic { /** * Checks if value is classified as a typed array. * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ isTypedArray(value: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isTypedArray */ isTypedArray(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isTypedArray */ isTypedArray(): LoDashExplicitWrapper<boolean>; } //_.isUndefined interface LoDashStatic { /** * Checks if value is undefined. * * @param value The value to check. * @return Returns true if value is undefined, else false. */ isUndefined(value: any): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * see _.isUndefined */ isUndefined(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * see _.isUndefined */ isUndefined(): LoDashExplicitWrapper<boolean>; } //_.isWeakMap interface LoDashStatic { /** * Checks if value is classified as a WeakMap object. * * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ isWeakMap<K, V>(value?: any): value is WeakMap<K, V>; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isSet */ isWeakMap(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isSet */ isWeakMap(): LoDashExplicitWrapper<boolean>; } //_.isWeakSet interface LoDashStatic { /** * Checks if value is classified as a WeakSet object. * * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ isWeakSet<T>(value?: any): value is WeakSet<T>; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.isWeakSet */ isWeakSet(): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.isWeakSet */ isWeakSet(): LoDashExplicitWrapper<boolean>; } //_.lt interface LoDashStatic { /** * Checks if value is less than other. * * @param value The value to compare. * @param other The other value to compare. * @return Returns true if value is less than other, else false. */ lt( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.lt */ lt(other: any): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.lt */ lt(other: any): LoDashExplicitWrapper<boolean>; } //_.lte interface LoDashStatic { /** * Checks if value is less than or equal to other. * * @param value The value to compare. * @param other The other value to compare. * @return Returns true if value is less than or equal to other, else false. */ lte( value: any, other: any ): boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.lte */ lte(other: any): boolean; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.lte */ lte(other: any): LoDashExplicitWrapper<boolean>; } //_.toArray interface LoDashStatic { /** * Converts value to an array. * * @param value The value to convert. * @return Returns the converted array. */ toArray<T>(value: List<T>|Dictionary<T>|NumericDictionary<T>): T[]; /** * @see _.toArray */ toArray<TValue, TResult>(value: TValue): TResult[]; /** * @see _.toArray */ toArray<TResult>(value?: any): TResult[]; } interface LoDashImplicitWrapper<T> { /** * @see _.toArray */ toArray<TResult>(): LoDashImplicitArrayWrapper<TResult>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.toArray */ toArray(): LoDashImplicitArrayWrapper<T>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.toArray */ toArray<TResult>(): LoDashImplicitArrayWrapper<TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.toArray */ toArray<TResult>(): LoDashExplicitArrayWrapper<TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.toArray */ toArray(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.toArray */ toArray<TResult>(): LoDashExplicitArrayWrapper<TResult>; } //_.toPlainObject interface LoDashStatic { /** * Converts value to a plain object flattening inherited enumerable properties of value to own properties * of the plain object. * * @param value The value to convert. * @return Returns the converted plain object. */ toPlainObject<TResult extends {}>(value?: any): TResult; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toPlainObject */ toPlainObject<TResult extends {}>(): LoDashImplicitObjectWrapper<TResult>; } //_.toInteger interface LoDashStatic { /** * Converts `value` to an integer. * * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3'); * // => 3 */ toInteger(value: any): number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toInteger */ toInteger(): LoDashImplicitWrapper<number>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.toInteger */ toInteger(): LoDashExplicitWrapper<number>; } //_.toLength interface LoDashStatic { /** * Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @return {number} Returns the converted integer. * @example * * _.toLength(3); * // => 3 * * _.toLength(Number.MIN_VALUE); * // => 0 * * _.toLength(Infinity); * // => 4294967295 * * _.toLength('3'); * // => 3 */ toLength(value: any): number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toLength */ toLength(): LoDashImplicitWrapper<number>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.toLength */ toLength(): LoDashExplicitWrapper<number>; } //_.toNumber interface LoDashStatic { /** * Converts `value` to a number. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3); * // => 3 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3'); * // => 3 */ toNumber(value: any): number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toNumber */ toNumber(): LoDashImplicitWrapper<number>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.toNumber */ toNumber(): LoDashExplicitWrapper<number>; } //_.toSafeInteger interface LoDashStatic { /** * Converts `value` to a safe integer. A safe integer can be compared and * represented correctly. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toSafeInteger(3); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); * // => 0 * * _.toSafeInteger(Infinity); * // => 9007199254740991 * * _.toSafeInteger('3'); * // => 3 */ toSafeInteger(value: any): number; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toSafeInteger */ toSafeInteger(): LoDashImplicitWrapper<number>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.toSafeInteger */ toSafeInteger(): LoDashExplicitWrapper<number>; } //_.toString DUMMY interface LoDashStatic { /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ toString(value: any): string; } /******** * Math * ********/ //_.add interface LoDashStatic { /** * Adds two numbers. * * @param augend The first number to add. * @param addend The second number to add. * @return Returns the sum. */ add( augend: number, addend: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.add */ add(addend: number): number; } interface LoDashExplicitWrapper<T> { /** * @see _.add */ add(addend: number): LoDashExplicitWrapper<number>; } //_.ceil interface LoDashStatic { /** * Calculates n rounded up to precision. * * @param n The number to round up. * @param precision The precision to round up to. * @return Returns the rounded up number. */ ceil( n: number, precision?: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.ceil */ ceil(precision?: number): number; } interface LoDashExplicitWrapper<T> { /** * @see _.ceil */ ceil(precision?: number): LoDashExplicitWrapper<number>; } //_.floor interface LoDashStatic { /** * Calculates n rounded down to precision. * * @param n The number to round down. * @param precision The precision to round down to. * @return Returns the rounded down number. */ floor( n: number, precision?: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.floor */ floor(precision?: number): number; } interface LoDashExplicitWrapper<T> { /** * @see _.floor */ floor(precision?: number): LoDashExplicitWrapper<number>; } //_.max interface LoDashStatic { /** * Computes the maximum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. */ max<T>( collection: List<T> ): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.max */ max(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.max */ max<T>(): T; } //_.maxBy interface LoDashStatic { /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.maxBy(objects, function(o) { return o.a; }); * // => { 'n': 2 } * * // using the `_.property` iteratee shorthand * _.maxBy(objects, 'n'); * // => { 'n': 2 } */ maxBy<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): T; /** * @see _.maxBy */ maxBy<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): T; /** * @see _.maxBy */ maxBy<T>( collection: List<T>|Dictionary<T>, iteratee?: string ): T; /** * @see _.maxBy */ maxBy<TObject extends {}, T>( collection: List<T>|Dictionary<T>, whereValue?: TObject ): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.maxBy */ maxBy( iteratee?: ListIterator<T, any> ): T; /** * @see _.maxBy */ maxBy( iteratee?: string ): T; /** * @see _.maxBy */ maxBy<TObject extends {}>( whereValue?: TObject ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.maxBy */ maxBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any> ): T; /** * @see _.maxBy */ maxBy<T>( iteratee?: string ): T; /** * @see _.maxBy */ maxBy<TObject extends {}, T>( whereValue?: TObject ): T; } //_.mean interface LoDashStatic { /** * Computes the mean of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. * @example * * _.mean([4, 2, 8, 6]); * // => 5 */ mean<T>( collection: List<T> ): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.mean */ mean<T>(): number; /** * @see _.mean */ mean(): number; } //_.min interface LoDashStatic { /** * Computes the minimum value of `array`. If `array` is empty or falsey * `undefined` is returned. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. */ min<T>( collection: List<T> ): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.min */ min(): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.min */ min<T>(): T; } //_.minBy interface LoDashStatic { /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.minBy(objects, function(o) { return o.a; }); * // => { 'n': 1 } * * // using the `_.property` iteratee shorthand * _.minBy(objects, 'n'); * // => { 'n': 1 } */ minBy<T>( collection: List<T>, iteratee?: ListIterator<T, any> ): T; /** * @see _.minBy */ minBy<T>( collection: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): T; /** * @see _.minBy */ minBy<T>( collection: List<T>|Dictionary<T>, iteratee?: string ): T; /** * @see _.minBy */ minBy<TObject extends {}, T>( collection: List<T>|Dictionary<T>, whereValue?: TObject ): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.minBy */ minBy( iteratee?: ListIterator<T, any> ): T; /** * @see _.minBy */ minBy( iteratee?: string ): T; /** * @see _.minBy */ minBy<TObject extends {}>( whereValue?: TObject ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.minBy */ minBy<T>( iteratee?: ListIterator<T, any>|DictionaryIterator<T, any> ): T; /** * @see _.minBy */ minBy<T>( iteratee?: string ): T; /** * @see _.minBy */ minBy<TObject extends {}, T>( whereValue?: TObject ): T; } //_.round interface LoDashStatic { /** * Calculates n rounded to precision. * * @param n The number to round. * @param precision The precision to round to. * @return Returns the rounded number. */ round( n: number, precision?: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.round */ round(precision?: number): number; } interface LoDashExplicitWrapper<T> { /** * @see _.round */ round(precision?: number): LoDashExplicitWrapper<number>; } //_.sum interface LoDashStatic { /** * Computes the sum of the values in `array`. * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. * @example * * _.sum([4, 2, 8, 6]); * // => 20 */ sum<T>(collection: List<T>): number; /** * @see _.sum */ sum(collection: List<number>|Dictionary<number>): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sum */ sum(): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sum **/ sum<TValue>(): number; /** * @see _.sum */ sum(): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sum */ sum(): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sum */ sum<TValue>(): LoDashExplicitWrapper<number>; /** * @see _.sum */ sum(): LoDashExplicitWrapper<number>; } //_.sumBy interface LoDashStatic { /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the sum. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.sumBy(objects, function(o) { return o.n; }); * // => 20 * * // using the `_.property` iteratee shorthand * _.sumBy(objects, 'n'); * // => 20 */ sumBy<T>( collection: List<T>, iteratee: ListIterator<T, number> ): number; /** * @see _.sumBy **/ sumBy<T>( collection: Dictionary<T>, iteratee: DictionaryIterator<T, number> ): number; /** * @see _.sumBy */ sumBy<T>( collection: List<number>|Dictionary<number>, iteratee: string ): number; /** * @see _.sumBy */ sumBy<T>(collection: List<T>|Dictionary<T>): number; /** * @see _.sumBy */ sumBy(collection: List<number>|Dictionary<number>): number; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.sumBy */ sumBy( iteratee: ListIterator<T, number> ): number; /** * @see _.sumBy */ sumBy(iteratee: string): number; /** * @see _.sumBy */ sumBy(): number; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.sumBy **/ sumBy<TValue>( iteratee: ListIterator<TValue, number>|DictionaryIterator<TValue, number> ): number; /** * @see _.sumBy */ sumBy(iteratee: string): number; /** * @see _.sumBy */ sumBy(): number; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.sumBy */ sumBy( iteratee: ListIterator<T, number> ): LoDashExplicitWrapper<number>; /** * @see _.sumBy */ sumBy(iteratee: string): LoDashExplicitWrapper<number>; /** * @see _.sumBy */ sumBy(): LoDashExplicitWrapper<number>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.sumBy */ sumBy<TValue>( iteratee: ListIterator<TValue, number>|DictionaryIterator<TValue, number> ): LoDashExplicitWrapper<number>; /** * @see _.sumBy */ sumBy(iteratee: string): LoDashExplicitWrapper<number>; /** * @see _.sumBy */ sumBy(): LoDashExplicitWrapper<number>; } /********** * Number * **********/ //_.subtract interface LoDashStatic { /** * Subtract two numbers. * * @static * @memberOf _ * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. * @returns {number} Returns the difference. * @example * * _.subtract(6, 4); * // => 2 */ subtract( minuend: number, subtrahend: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.subtract */ subtract( subtrahend: number ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.subtract */ subtract( subtrahend: number ): LoDashExplicitWrapper<number>; } //_.clamp interface LoDashStatic { /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * * @static * @memberOf _ * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. * @example * * _.clamp(-10, -5, 5); * // => -5 * * _.clamp(10, -5, 5); * // => 5 */ clamp( number: number, lower: number, upper: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.clamp */ clamp( lower: number, upper: number ): number; } interface LoDashExplicitWrapper<T> { /** * @see _.clamp */ clamp( lower: number, upper: number ): LoDashExplicitWrapper<number>; } //_.inRange interface LoDashStatic { /** * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start * with start then set to 0. * * @param n The number to check. * @param start The start of the range. * @param end The end of the range. * @return Returns true if n is in the range, else false. */ inRange( n: number, start: number, end: number ): boolean; /** * @see _.inRange */ inRange( n: number, end: number ): boolean; } interface LoDashImplicitWrapper<T> { /** * @see _.inRange */ inRange( start: number, end: number ): boolean; /** * @see _.inRange */ inRange(end: number): boolean; } interface LoDashExplicitWrapper<T> { /** * @see _.inRange */ inRange( start: number, end: number ): LoDashExplicitWrapper<boolean>; /** * @see _.inRange */ inRange(end: number): LoDashExplicitWrapper<boolean>; } //_.random interface LoDashStatic { /** * Produces a random number between min and max (inclusive). If only one argument is provided a number between * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point * number is returned instead of an integer. * * @param min The minimum possible value. * @param max The maximum possible value. * @param floating Specify returning a floating-point number. * @return Returns the random number. */ random( min?: number, max?: number, floating?: boolean ): number; /** * @see _.random */ random( min?: number, floating?: boolean ): number; /** * @see _.random */ random(floating?: boolean): number; } interface LoDashImplicitWrapper<T> { /** * @see _.random */ random( max?: number, floating?: boolean ): number; /** * @see _.random */ random(floating?: boolean): number; } interface LoDashExplicitWrapper<T> { /** * @see _.random */ random( max?: number, floating?: boolean ): LoDashExplicitWrapper<number>; /** * @see _.random */ random(floating?: boolean): LoDashExplicitWrapper<number>; } /********** * Object * **********/ //_.assign interface LoDashStatic { /** * Assigns own enumerable properties of source objects to the destination * object. Source objects are applied from left to right. Subsequent sources * overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.c = 3; * } * * function Bar() { * this.e = 5; * } * * Foo.prototype.d = 4; * Bar.prototype.f = 6; * * _.assign({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3, 'e': 5 } */ assign<TObject extends {}, TSource extends {}, TResult extends {}>( object: TObject, source: TSource ): TResult; /** * @see assign */ assign<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2 ): TResult; /** * @see assign */ assign<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3 ): TResult; /** * @see assign */ assign<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}> ( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): TResult; /** * @see _.assign */ assign<TObject extends {}>(object: TObject): TObject; /** * @see _.assign */ assign<TObject extends {}, TResult extends {}>( object: TObject, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.assign */ assign<TSource extends {}, TResult extends {}>( source: TSource ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2 ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.assign */ assign(): LoDashImplicitObjectWrapper<T>; /** * @see _.assign */ assign<TResult extends {}>(...otherArgs: any[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.assign */ assign<TSource extends {}, TResult extends {}>( source: TSource ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2 ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ assign<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.assign */ assign(): LoDashExplicitObjectWrapper<T>; /** * @see _.assign */ assign<TResult extends {}>(...otherArgs: any[]): LoDashExplicitObjectWrapper<TResult>; } //_.assignWith interface AssignCustomizer { (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; } interface LoDashStatic { /** * This method is like `_.assign` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ assignWith<TObject extends {}, TSource extends {}, TResult extends {}>( object: TObject, source: TSource, customizer: AssignCustomizer ): TResult; /** * @see assignWith */ assignWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): TResult; /** * @see assignWith */ assignWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): TResult; /** * @see assignWith */ assignWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}> ( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): TResult; /** * @see _.assignWith */ assignWith<TObject extends {}>(object: TObject): TObject; /** * @see _.assignWith */ assignWith<TObject extends {}, TResult extends {}>( object: TObject, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.assignWith */ assignWith<TSource extends {}, TResult extends {}>( source: TSource, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.assignWith */ assignWith(): LoDashImplicitObjectWrapper<T>; /** * @see _.assignWith */ assignWith<TResult extends {}>(...otherArgs: any[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.assignWith */ assignWith<TSource extends {}, TResult extends {}>( source: TSource, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignWith */ assignWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.assignWith */ assignWith(): LoDashExplicitObjectWrapper<T>; /** * @see _.assignWith */ assignWith<TResult extends {}>(...otherArgs: any[]): LoDashExplicitObjectWrapper<TResult>; } //_.assignIn interface LoDashStatic { /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.b = 2; * } * * function Bar() { * this.d = 4; * } * * Foo.prototype.c = 3; * Bar.prototype.e = 5; * * _.assignIn({ 'a': 1 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } */ assignIn<TObject extends {}, TSource extends {}, TResult extends {}>( object: TObject, source: TSource ): TResult; /** * @see assignIn */ assignIn<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2 ): TResult; /** * @see assignIn */ assignIn<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3 ): TResult; /** * @see assignIn */ assignIn<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}> ( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): TResult; /** * @see _.assignIn */ assignIn<TObject extends {}>(object: TObject): TObject; /** * @see _.assignIn */ assignIn<TObject extends {}, TResult extends {}>( object: TObject, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.assignIn */ assignIn<TSource extends {}, TResult extends {}>( source: TSource ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2 ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.assignIn */ assignIn(): LoDashImplicitObjectWrapper<T>; /** * @see _.assignIn */ assignIn<TResult extends {}>(...otherArgs: any[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.assignIn */ assignIn<TSource extends {}, TResult extends {}>( source: TSource ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2 ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignIn */ assignIn<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.assignIn */ assignIn(): LoDashExplicitObjectWrapper<T>; /** * @see _.assignIn */ assignIn<TResult extends {}>(...otherArgs: any[]): LoDashExplicitObjectWrapper<TResult>; } //_.assignInWith interface AssignCustomizer { (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; } interface LoDashStatic { /** * This method is like `_.assignIn` except that it accepts `customizer` which * is invoked to produce the assigned values. If `customizer` returns `undefined` * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @alias extendWith * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ assignInWith<TObject extends {}, TSource extends {}, TResult extends {}>( object: TObject, source: TSource, customizer: AssignCustomizer ): TResult; /** * @see assignInWith */ assignInWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): TResult; /** * @see assignInWith */ assignInWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): TResult; /** * @see assignInWith */ assignInWith<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}> ( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): TResult; /** * @see _.assignInWith */ assignInWith<TObject extends {}>(object: TObject): TObject; /** * @see _.assignInWith */ assignInWith<TObject extends {}, TResult extends {}>( object: TObject, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.assignInWith */ assignInWith<TSource extends {}, TResult extends {}>( source: TSource, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.assignInWith */ assignInWith(): LoDashImplicitObjectWrapper<T>; /** * @see _.assignInWith */ assignInWith<TResult extends {}>(...otherArgs: any[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.assignInWith */ assignInWith<TSource extends {}, TResult extends {}>( source: TSource, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assignInWith */ assignInWith<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.assignInWith */ assignInWith(): LoDashExplicitObjectWrapper<T>; /** * @see _.assignInWith */ assignInWith<TResult extends {}>(...otherArgs: any[]): LoDashExplicitObjectWrapper<TResult>; } //_.create interface LoDashStatic { /** * Creates an object that inherits from the given prototype object. If a properties object is provided its own * enumerable properties are assigned to the created object. * * @param prototype The object to inherit from. * @param properties The properties to assign to the object. * @return Returns the new object. */ create<T extends Object, U extends Object>( prototype: T, properties?: U ): T & U; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.create */ create<U extends Object>(properties?: U): LoDashImplicitObjectWrapper<T & U>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.create */ create<U extends Object>(properties?: U): LoDashExplicitObjectWrapper<T & U>; } //_.defaults interface LoDashStatic { /** * Assigns own enumerable properties of source object(s) to the destination object for all destination * properties that resolve to undefined. Once a property is set, additional values of the same property are * ignored. * * Note: This method mutates object. * * @param object The destination object. * @param sources The source objects. * @return The destination object. */ defaults<Obj extends {}, TResult extends {}>( object: Obj, ...sources: {}[] ): TResult; /** * @see _.defaults */ defaults<Obj extends {}, S1 extends {}, TResult extends {}>( object: Obj, source1: S1, ...sources: {}[] ): TResult; /** * @see _.defaults */ defaults<Obj extends {}, S1 extends {}, S2 extends {}, TResult extends {}>( object: Obj, source1: S1, source2: S2, ...sources: {}[] ): TResult; /** * @see _.defaults */ defaults<Obj extends {}, S1 extends {}, S2 extends {}, S3 extends {}, TResult extends {}>( object: Obj, source1: S1, source2: S2, source3: S3, ...sources: {}[] ): TResult; /** * @see _.defaults */ defaults<Obj extends {}, S1 extends {}, S2 extends {}, S3 extends {}, S4 extends {}, TResult extends {}>( object: Obj, source1: S1, source2: S2, source3: S3, source4: S4, ...sources: {}[] ): TResult; /** * @see _.defaults */ defaults<TResult extends {}>( object: {}, ...sources: {}[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.defaults */ defaults<S1 extends {}, TResult extends {}>( source1: S1, ...sources: {}[] ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, TResult extends {}>( source1: S1, source2: S2, ...sources: {}[] ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, S3 extends {}, TResult extends {}>( source1: S1, source2: S2, source3: S3, ...sources: {}[] ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, S3 extends {}, S4 extends {}, TResult extends {}>( source1: S1, source2: S2, source3: S3, source4: S4, ...sources: {}[] ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults(): LoDashImplicitObjectWrapper<T>; /** * @see _.defaults */ defaults<TResult>(...sources: {}[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.defaults */ defaults<S1 extends {}, TResult extends {}>( source1: S1, ...sources: {}[] ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, TResult extends {}>( source1: S1, source2: S2, ...sources: {}[] ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, S3 extends {}, TResult extends {}>( source1: S1, source2: S2, source3: S3, ...sources: {}[] ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults<S1 extends {}, S2 extends {}, S3 extends {}, S4 extends {}, TResult extends {}>( source1: S1, source2: S2, source3: S3, source4: S4, ...sources: {}[] ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.defaults */ defaults(): LoDashExplicitObjectWrapper<T>; /** * @see _.defaults */ defaults<TResult>(...sources: {}[]): LoDashExplicitObjectWrapper<TResult>; } //_.defaultsDeep interface LoDashStatic { /** * This method is like _.defaults except that it recursively assigns default properties. * @param object The destination object. * @param sources The source objects. * @return Returns object. **/ defaultsDeep<T, TResult>( object: T, ...sources: any[]): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.defaultsDeep **/ defaultsDeep<TResult>(...sources: any[]): LoDashImplicitObjectWrapper<TResult> } //_.extend interface LoDashStatic { /** * @see assign */ extend<TObject extends {}, TSource extends {}, TResult extends {}>( object: TObject, source: TSource, customizer?: AssignCustomizer ): TResult; /** * @see assign */ extend<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, customizer?: AssignCustomizer ): TResult; /** * @see assign */ extend<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer?: AssignCustomizer ): TResult; /** * @see assign */ extend<TObject extends {}, TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}> ( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer?: AssignCustomizer ): TResult; /** * @see _.assign */ extend<TObject extends {}>(object: TObject): TObject; /** * @see _.assign */ extend<TObject extends {}, TResult extends {}>( object: TObject, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.assign */ extend<TSource extends {}, TResult extends {}>( source: TSource, customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.assign */ extend(): LoDashImplicitObjectWrapper<T>; /** * @see _.assign */ extend<TResult extends {}>(...otherArgs: any[]): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.assign */ extend<TSource extends {}, TResult extends {}>( source: TSource, customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see assign */ extend<TSource1 extends {}, TSource2 extends {}, TSource3 extends {}, TSource4 extends {}, TResult extends {}>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.assign */ extend(): LoDashExplicitObjectWrapper<T>; /** * @see _.assign */ extend<TResult extends {}>(...otherArgs: any[]): LoDashExplicitObjectWrapper<TResult>; } //_.findKey interface LoDashStatic { /** * This method is like _.find except that it returns the key of the first element predicate returns truthy for * instead of the element itself. * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param object The object to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the key of the matched element, else undefined. */ findKey<TValues, TObject>( object: TObject, predicate?: DictionaryIterator<TValues, boolean> ): string; /** * @see _.findKey */ findKey<TObject>( object: TObject, predicate?: ObjectIterator<any, boolean> ): string; /** * @see _.findKey */ findKey<TObject>( object: TObject, predicate?: string ): string; /** * @see _.findKey */ findKey<TWhere extends Dictionary<any>, TObject>( object: TObject, predicate?: TWhere ): string; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.findKey */ findKey<TValues>( predicate?: DictionaryIterator<TValues, boolean> ): string; /** * @see _.findKey */ findKey( predicate?: ObjectIterator<any, boolean> ): string; /** * @see _.findKey */ findKey( predicate?: string ): string; /** * @see _.findKey */ findKey<TWhere extends Dictionary<any>>( predicate?: TWhere ): string; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.findKey */ findKey<TValues>( predicate?: DictionaryIterator<TValues, boolean> ): LoDashExplicitWrapper<string>; /** * @see _.findKey */ findKey( predicate?: ObjectIterator<any, boolean> ): LoDashExplicitWrapper<string>; /** * @see _.findKey */ findKey( predicate?: string ): LoDashExplicitWrapper<string>; /** * @see _.findKey */ findKey<TWhere extends Dictionary<any>>( predicate?: TWhere ): LoDashExplicitWrapper<string>; } //_.findLastKey interface LoDashStatic { /** * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. * * If a property name is provided for predicate the created _.property style callback returns the property * value of the given element. * * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for * elements that have a matching property value, else false. * * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * * @param object The object to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. * @return Returns the key of the matched element, else undefined. */ findLastKey<TValues, TObject>( object: TObject, predicate?: DictionaryIterator<TValues, boolean> ): string; /** * @see _.findLastKey */ findLastKey<TObject>( object: TObject, predicate?: ObjectIterator<any, boolean> ): string; /** * @see _.findLastKey */ findLastKey<TObject>( object: TObject, predicate?: string ): string; /** * @see _.findLastKey */ findLastKey<TWhere extends Dictionary<any>, TObject>( object: TObject, predicate?: TWhere ): string; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.findLastKey */ findLastKey<TValues>( predicate?: DictionaryIterator<TValues, boolean> ): string; /** * @see _.findLastKey */ findLastKey( predicate?: ObjectIterator<any, boolean> ): string; /** * @see _.findLastKey */ findLastKey( predicate?: string ): string; /** * @see _.findLastKey */ findLastKey<TWhere extends Dictionary<any>>( predicate?: TWhere ): string; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.findLastKey */ findLastKey<TValues>( predicate?: DictionaryIterator<TValues, boolean> ): LoDashExplicitWrapper<string>; /** * @see _.findLastKey */ findLastKey( predicate?: ObjectIterator<any, boolean> ): LoDashExplicitWrapper<string>; /** * @see _.findLastKey */ findLastKey( predicate?: string ): LoDashExplicitWrapper<string>; /** * @see _.findLastKey */ findLastKey<TWhere extends Dictionary<any>>( predicate?: TWhere ): LoDashExplicitWrapper<string>; } //_.forIn interface LoDashStatic { /** * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may * exit iteration early by explicitly returning false. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns object. */ forIn<T>( object: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forIn */ forIn<T extends {}>( object: T, iteratee?: ObjectIterator<any, any> ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forIn */ forIn<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forIn */ forIn<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashExplicitObjectWrapper<T>; } //_.forInRight interface LoDashStatic { /** * This method is like _.forIn except that it iterates over properties of object in the opposite order. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns object. */ forInRight<T>( object: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forInRight */ forInRight<T extends {}>( object: T, iteratee?: ObjectIterator<any, any> ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forInRight */ forInRight<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forInRight */ forInRight<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashExplicitObjectWrapper<T>; } //_.forOwn interface LoDashStatic { /** * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit * iteration early by explicitly returning false. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns object. */ forOwn<T>( object: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forOwn */ forOwn<T extends {}>( object: T, iteratee?: ObjectIterator<any, any> ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forOwn */ forOwn<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forOwn */ forOwn<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashExplicitObjectWrapper<T>; } //_.forOwnRight interface LoDashStatic { /** * This method is like _.forOwn except that it iterates over properties of object in the opposite order. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns object. */ forOwnRight<T>( object: Dictionary<T>, iteratee?: DictionaryIterator<T, any> ): Dictionary<T>; /** * @see _.forOwnRight */ forOwnRight<T extends {}>( object: T, iteratee?: ObjectIterator<any, any> ): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.forOwnRight */ forOwnRight<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashImplicitObjectWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.forOwnRight */ forOwnRight<TValue>( iteratee?: DictionaryIterator<TValue, any> ): _.LoDashExplicitObjectWrapper<T>; } //_.functions interface LoDashStatic { /** * Creates an array of function property names from own enumerable properties * of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functions(new Foo); * // => ['a', 'b'] */ functions<T extends {}>(object: any): string[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.functions */ functions(): _.LoDashImplicitArrayWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.functions */ functions(): _.LoDashExplicitArrayWrapper<string>; } //_.functionsIn interface LoDashStatic { /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functionsIn(new Foo); * // => ['a', 'b', 'c'] */ functionsIn<T extends {}>(object: any): string[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.functionsIn */ functionsIn(): _.LoDashImplicitArrayWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.functionsIn */ functionsIn(): _.LoDashExplicitArrayWrapper<string>; } //_.get interface LoDashStatic { /** * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used * in its place. * * @param object The object to query. * @param path The path of the property to get. * @param defaultValue The value returned if the resolved value is undefined. * @return Returns the resolved value. */ get<TObject, TResult>( object: TObject, path: StringRepresentable|StringRepresentable[], defaultValue?: TResult ): TResult; /** * @see _.get */ get<TResult>( object: any, path: StringRepresentable|StringRepresentable[], defaultValue?: TResult ): TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.get */ get<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult ): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.get */ get<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.get */ get<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult ): TResult; } interface LoDashExplicitWrapper<T> { /** * @see _.get */ get<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.get */ get<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.get */ get<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } //_.has interface LoDashStatic { /** * Checks if `path` is a direct property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': { 'c': 3 } } }; * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b.c'); * // => true * * _.has(object, ['a', 'b', 'c']); * // => true * * _.has(other, 'a'); * // => false */ has<T extends {}>( object: T, path: StringRepresentable|StringRepresentable[] ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.has */ has(path: StringRepresentable|StringRepresentable[]): boolean; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.has */ has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper<boolean>; } //_.hasIn interface LoDashStatic { /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b.c'); * // => true * * _.hasIn(object, ['a', 'b', 'c']); * // => true * * _.hasIn(object, 'b'); * // => false */ hasIn<T extends {}>( object: T, path: StringRepresentable|StringRepresentable[] ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.hasIn */ hasIn(path: StringRepresentable|StringRepresentable[]): boolean; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.hasIn */ hasIn(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper<boolean>; } //_.invert interface LoDashStatic { /** * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, * subsequent values overwrite property assignments of previous values unless multiValue is true. * * @param object The object to invert. * @param multiValue Allow multiple values per key. * @return Returns the new inverted object. */ invert<T extends {}, TResult extends {}>( object: T, multiValue?: boolean ): TResult; /** * @see _.invert */ invert<TResult extends {}>( object: Object, multiValue?: boolean ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.invert */ invert<TResult extends {}>(multiValue?: boolean): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.invert */ invert<TResult extends {}>(multiValue?: boolean): LoDashExplicitObjectWrapper<TResult>; } //_.inverBy interface InvertByIterator<T> { (value: T): any; } interface LoDashStatic { /** * This method is like _.invert except that the inverted object is generated from the results of running each * element of object through iteratee. The corresponding inverted value of each inverted key is an array of * keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value). * * @param object The object to invert. * @param interatee The iteratee invoked per element. * @return Returns the new inverted object. */ invertBy( object: Object, interatee?: InvertByIterator<any>|string ): Dictionary<string[]>; /** * @see _.invertBy */ invertBy<T>( object: _.Dictionary<T>|_.NumericDictionary<T>, interatee?: InvertByIterator<T>|string ): Dictionary<string[]>; /** * @see _.invertBy */ invertBy<W>( object: Object, interatee?: W ): Dictionary<string[]>; /** * @see _.invertBy */ invertBy<T, W>( object: _.Dictionary<T>, interatee?: W ): Dictionary<string[]>; } interface LoDashImplicitWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<any> ): LoDashImplicitObjectWrapper<Dictionary<string[]>>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<T>|string ): LoDashImplicitObjectWrapper<Dictionary<string[]>>; /** * @see _.invertBy */ invertBy<W>( interatee?: W ): LoDashImplicitObjectWrapper<Dictionary<string[]>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<any>|string ): LoDashImplicitObjectWrapper<Dictionary<string[]>>; /** * @see _.invertBy */ invertBy<W>( interatee?: W ): LoDashImplicitObjectWrapper<Dictionary<string[]>>; } interface LoDashExplicitWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<any> ): LoDashExplicitObjectWrapper<Dictionary<string[]>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<T>|string ): LoDashExplicitObjectWrapper<Dictionary<string[]>>; /** * @see _.invertBy */ invertBy<W>( interatee?: W ): LoDashExplicitObjectWrapper<Dictionary<string[]>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.invertBy */ invertBy( interatee?: InvertByIterator<any>|string ): LoDashExplicitObjectWrapper<Dictionary<string[]>>; /** * @see _.invertBy */ invertBy<W>( interatee?: W ): LoDashExplicitObjectWrapper<Dictionary<string[]>>; } //_.keys interface LoDashStatic { /** * Creates an array of the own enumerable property names of object. * * Note: Non-object values are coerced to objects. See the ES spec for more details. * * @param object The object to query. * @return Returns the array of property names. */ keys(object?: any): string[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.keys */ keys(): LoDashImplicitArrayWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.keys */ keys(): LoDashExplicitArrayWrapper<string>; } //_.keysIn interface LoDashStatic { /** * Creates an array of the own and inherited enumerable property names of object. * * Note: Non-object values are coerced to objects. * * @param object The object to query. * @return An array of property names. */ keysIn(object?: any): string[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.keysIn */ keysIn(): LoDashImplicitArrayWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.keysIn */ keysIn(): LoDashExplicitArrayWrapper<string>; } //_.mapKeys interface LoDashStatic { /** * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated * by running each own enumerable property of object through iteratee. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. * @return Returns the new mapped object. */ mapKeys<T, TKey>( object: List<T>, iteratee?: ListIterator<T, TKey> ): Dictionary<T>; /** * @see _.mapKeys */ mapKeys<T, TKey>( object: Dictionary<T>, iteratee?: DictionaryIterator<T, TKey> ): Dictionary<T>; /** * @see _.mapKeys */ mapKeys<T, TObject extends {}>( object: List<T>|Dictionary<T>, iteratee?: TObject ): Dictionary<T>; /** * @see _.mapKeys */ mapKeys<T>( object: List<T>|Dictionary<T>, iteratee?: string ): Dictionary<T>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.mapKeys */ mapKeys<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.mapKeys */ mapKeys<TObject extends {}>( iteratee?: TObject ): LoDashImplicitObjectWrapper<Dictionary<T>>; /** * @see _.mapKeys */ mapKeys( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<T>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.mapKeys */ mapKeys<TResult, TKey>( iteratee?: ListIterator<TResult, TKey>|DictionaryIterator<TResult, TKey> ): LoDashImplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapKeys */ mapKeys<TResult, TObject extends {}>( iteratee?: TObject ): LoDashImplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapKeys */ mapKeys<TResult>( iteratee?: string ): LoDashImplicitObjectWrapper<Dictionary<TResult>>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.mapKeys */ mapKeys<TKey>( iteratee?: ListIterator<T, TKey> ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.mapKeys */ mapKeys<TObject extends {}>( iteratee?: TObject ): LoDashExplicitObjectWrapper<Dictionary<T>>; /** * @see _.mapKeys */ mapKeys( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<T>>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.mapKeys */ mapKeys<TResult, TKey>( iteratee?: ListIterator<TResult, TKey>|DictionaryIterator<TResult, TKey> ): LoDashExplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapKeys */ mapKeys<TResult, TObject extends {}>( iteratee?: TObject ): LoDashExplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapKeys */ mapKeys<TResult>( iteratee?: string ): LoDashExplicitObjectWrapper<Dictionary<TResult>>; } //_.mapValues interface LoDashStatic { /** * Creates an object with the same keys as object and values generated by running each own * enumerable property of object through iteratee. The iteratee function is bound to thisArg * and invoked with three arguments: (value, key, object). * * If a property name is provided iteratee the created "_.property" style callback returns * the property value of the given element. * * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns * true for elements that have a matching property value, else false;. * * If an object is provided for iteratee the created "_.matches" style callback returns true * for elements that have the properties of the given object, else false. * * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. * @param {Object} [thisArg] The `this` binding of `iteratee`. * @return {Object} Returns the new mapped object. */ mapValues<T, TResult>(obj: Dictionary<T>, callback: ObjectIterator<T, TResult>): Dictionary<TResult>; mapValues<T>(obj: Dictionary<T>, where: Dictionary<T>): Dictionary<boolean>; mapValues<T, TMapped>(obj: T, pluck: string): TMapped; mapValues<T>(obj: T, callback: ObjectIterator<any, any>): T; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.mapValues * TValue is the type of the property values of T. * TResult is the type output by the ObjectIterator function */ mapValues<TValue, TResult>(callback: ObjectIterator<TValue, TResult>): LoDashImplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapValues * TResult is the type of the property specified by pluck. * T should be a Dictionary<Dictionary<TResult>> */ mapValues<TResult>(pluck: string): LoDashImplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapValues * TResult is the type of the properties of each object in the values of T * T should be a Dictionary<Dictionary<TResult>> */ mapValues<TResult>(where: Dictionary<TResult>): LoDashImplicitArrayWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.mapValues * TValue is the type of the property values of T. * TResult is the type output by the ObjectIterator function */ mapValues<TValue, TResult>(callback: ObjectIterator<TValue, TResult>): LoDashExplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapValues * TResult is the type of the property specified by pluck. * T should be a Dictionary<Dictionary<TResult>> */ mapValues<TResult>(pluck: string): LoDashExplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.mapValues * TResult is the type of the properties of each object in the values of T * T should be a Dictionary<Dictionary<TResult>> */ mapValues<TResult>(where: Dictionary<TResult>): LoDashExplicitObjectWrapper<boolean>; } //_.merge interface LoDashStatic { /** * Recursively merges own and inherited enumerable properties of source * objects into the destination object, skipping source properties that resolve * to `undefined`. Array and plain object properties are merged recursively. * Other objects and value types are overridden by assignment. Source objects * are applied from left to right. Subsequent sources overwrite property * assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var users = { * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] * }; * * var ages = { * 'data': [{ 'age': 36 }, { 'age': 40 }] * }; * * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } */ merge<TObject, TSource>( object: TObject, source: TSource ): TObject & TSource; /** * @see _.merge */ merge<TObject, TSource1, TSource2>( object: TObject, source1: TSource1, source2: TSource2 ): TObject & TSource1 & TSource2; /** * @see _.merge */ merge<TObject, TSource1, TSource2, TSource3>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3 ): TObject & TSource1 & TSource2 & TSource3; /** * @see _.merge */ merge<TObject, TSource1, TSource2, TSource3, TSource4>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.merge */ merge<TResult>( object: any, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.merge */ merge<TSource>( source: TSource ): LoDashImplicitObjectWrapper<T & TSource>; /** * @see _.merge */ merge<TSource1, TSource2>( source1: TSource1, source2: TSource2 ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2>; /** * @see _.merge */ merge<TSource1, TSource2, TSource3>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2 & TSource3>; /** * @see _.merge */ merge<TSource1, TSource2, TSource3, TSource4>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4 ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2 & TSource3 & TSource4>; /** * @see _.merge */ merge<TResult>( ...otherArgs: any[] ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.merge */ merge<TSource>( source: TSource ): LoDashExplicitObjectWrapper<T & TSource>; /** * @see _.merge */ merge<TSource1, TSource2>( source1: TSource1, source2: TSource2 ): LoDashExplicitObjectWrapper<T & TSource1 & TSource2>; /** * @see _.merge */ merge<TSource1, TSource2, TSource3>( source1: TSource1, source2: TSource2, source3: TSource3 ): LoDashExplicitObjectWrapper<T & TSource1 & TSource2 & TSource3>; /** * @see _.merge */ merge<TSource1, TSource2, TSource3, TSource4>( ): LoDashExplicitObjectWrapper<T & TSource1 & TSource2 & TSource3 & TSource4>; /** * @see _.merge */ merge<TResult>( ...otherArgs: any[] ): LoDashExplicitObjectWrapper<TResult>; } //_.mergeWith interface MergeWithCustomizer { (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; } interface LoDashStatic { /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined` merging is handled by the * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} customizer The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * if (_.isArray(objValue)) { * return objValue.concat(srcValue); * } * } * * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * * _.merge(object, other, customizer); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } */ mergeWith<TObject, TSource>( object: TObject, source: TSource, customizer: MergeWithCustomizer ): TObject & TSource; /** * @see _.mergeWith */ mergeWith<TObject, TSource1, TSource2>( object: TObject, source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer ): TObject & TSource1 & TSource2; /** * @see _.mergeWith */ mergeWith<TObject, TSource1, TSource2, TSource3>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer ): TObject & TSource1 & TSource2 & TSource3; /** * @see _.mergeWith */ mergeWith<TObject, TSource1, TSource2, TSource3, TSource4>( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.mergeWith */ mergeWith<TResult>( object: any, ...otherArgs: any[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.mergeWith */ mergeWith<TSource>( source: TSource, customizer: MergeWithCustomizer ): LoDashImplicitObjectWrapper<T & TSource>; /** * @see _.mergeWith */ mergeWith<TSource1, TSource2>( source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2>; /** * @see _.mergeWith */ mergeWith<TSource1, TSource2, TSource3>( source1: TSource1, source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2 & TSource3>; /** * @see _.mergeWith */ mergeWith<TSource1, TSource2, TSource3, TSource4>( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer ): LoDashImplicitObjectWrapper<T & TSource1 & TSource2 & TSource3 & TSource4>; /** * @see _.mergeWith */ mergeWith<TResult>( ...otherArgs: any[] ): LoDashImplicitObjectWrapper<TResult>; } //_.omit interface LoDashStatic { /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to omit, specified * individually or in arrays.. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ omit<TResult extends {}, T extends {}>( object: T, ...predicate: (StringRepresentable|StringRepresentable[])[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.omit */ omit<TResult extends {}>( ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.omit */ omit<TResult extends {}>( ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashExplicitObjectWrapper<TResult>; } //_.omitBy interface LoDashStatic { /** * The opposite of `_.pickBy`; this method creates an object composed of the * own and inherited enumerable properties of `object` that `predicate` * doesn't return truthy for. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ omitBy<TResult extends {}, T extends {}>( object: T, predicate: ObjectIterator<any, boolean> ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.omitBy */ omitBy<TResult extends {}>( predicate: ObjectIterator<any, boolean> ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.omitBy */ omitBy<TResult extends {}>( predicate: ObjectIterator<any, boolean> ): LoDashExplicitObjectWrapper<TResult>; } //_.pick interface LoDashStatic { /** * Creates an object composed of the picked `object` properties. * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [props] The property names to pick, specified * individually or in arrays. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ pick<TResult extends {}, T extends {}>( object: T, ...predicate: (StringRepresentable|StringRepresentable[])[] ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.pick */ pick<TResult extends {}>( ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.pick */ pick<TResult extends {}>( ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashExplicitObjectWrapper<TResult>; } //_.pickBy interface LoDashStatic { /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with one argument: (value). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ pickBy<TResult extends {}, T extends {}>( object: T, predicate?: ObjectIterator<any, boolean> ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.pickBy */ pickBy<TResult extends {}>( predicate?: ObjectIterator<any, boolean> ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.pickBy */ pickBy<TResult extends {}>( predicate?: ObjectIterator<any, boolean> ): LoDashExplicitObjectWrapper<TResult>; } //_.result interface LoDashStatic { /** * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding * of its parent object and its result is returned. * * @param object The object to query. * @param path The path of the property to resolve. * @param defaultValue The value returned if the resolved value is undefined. * @return Returns the resolved value. */ result<TObject, TResult>( object: TObject, path: StringRepresentable|StringRepresentable[], defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; /** * @see _.result */ result<TResult>( object: any, path: StringRepresentable|StringRepresentable[], defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.result */ result<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.result */ result<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.result */ result<TResult>( path: StringRepresentable|StringRepresentable[], defaultValue?: TResult|((...args: any[]) => TResult) ): TResult; } interface LoDashExplicitWrapper<T> { /** * @see _.result */ result<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.result */ result<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.result */ result<TResultWrapper>( path: StringRepresentable|StringRepresentable[], defaultValue?: any ): TResultWrapper; } //_.set interface LoDashStatic { /** * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for * missing index properties while objects are created for all other missing properties. Use _.setWith to * customize path creation. * * @param object The object to modify. * @param path The path of the property to set. * @param value The value to set. * @return Returns object. */ set<TResult>( object: Object, path: StringRepresentable|StringRepresentable[], value: any ): TResult; /** * @see _.set */ set<V, TResult>( object: Object, path: StringRepresentable|StringRepresentable[], value: V ): TResult; /** * @see _.set */ set<O, V, TResult>( object: O, path: StringRepresentable|StringRepresentable[], value: V ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.set */ set<TResult>( path: StringRepresentable|StringRepresentable[], value: any ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.set */ set<V, TResult>( path: StringRepresentable|StringRepresentable[], value: V ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.set */ set<TResult>( path: StringRepresentable|StringRepresentable[], value: any ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.set */ set<V, TResult>( path: StringRepresentable|StringRepresentable[], value: V ): LoDashExplicitObjectWrapper<TResult>; } //_.setWith interface SetWithCustomizer<T> { (nsValue: any, key: string, nsObject: T): any; } interface LoDashStatic { /** * This method is like _.set except that it accepts customizer which is invoked to produce the objects of * path. If customizer returns undefined path creation is handled by the method instead. The customizer is * invoked with three arguments: (nsValue, key, nsObject). * * @param object The object to modify. * @param path The path of the property to set. * @param value The value to set. * @parem customizer The function to customize assigned values. * @return Returns object. */ setWith<TResult>( object: Object, path: StringRepresentable|StringRepresentable[], value: any, customizer?: SetWithCustomizer<Object> ): TResult; /** * @see _.setWith */ setWith<V, TResult>( object: Object, path: StringRepresentable|StringRepresentable[], value: V, customizer?: SetWithCustomizer<Object> ): TResult; /** * @see _.setWith */ setWith<O, V, TResult>( object: O, path: StringRepresentable|StringRepresentable[], value: V, customizer?: SetWithCustomizer<O> ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.setWith */ setWith<TResult>( path: StringRepresentable|StringRepresentable[], value: any, customizer?: SetWithCustomizer<T> ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.setWith */ setWith<V, TResult>( path: StringRepresentable|StringRepresentable[], value: V, customizer?: SetWithCustomizer<T> ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.setWith */ setWith<TResult>( path: StringRepresentable|StringRepresentable[], value: any, customizer?: SetWithCustomizer<T> ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.setWith */ setWith<V, TResult>( path: StringRepresentable|StringRepresentable[], value: V, customizer?: SetWithCustomizer<T> ): LoDashExplicitObjectWrapper<TResult>; } //_.toPairs interface LoDashStatic { /** * Creates an array of own enumerable key-value pairs for object. * * @param object The object to query. * @return Returns the new array of key-value pairs. */ toPairs<T extends {}>(object?: T): any[][]; toPairs<T extends {}, TResult>(object?: T): TResult[][]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.toPairs */ toPairs<TResult>(): LoDashImplicitArrayWrapper<TResult[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.toPairs */ toPairs<TResult>(): LoDashExplicitArrayWrapper<TResult[]>; } //_.toPairsIn interface LoDashStatic { /** * Creates an array of own and inherited enumerable key-value pairs for object. * * @param object The object to query. * @return Returns the new array of key-value pairs. */ toPairsIn<T extends {}>(object?: T): any[][]; toPairsIn<T extends {}, TResult>(object?: T): TResult[][]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.toPairsIn */ toPairsIn<TResult>(): LoDashImplicitArrayWrapper<TResult[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.toPairsIn */ toPairsIn<TResult>(): LoDashExplicitArrayWrapper<TResult[]>; } //_.transform interface LoDashStatic { /** * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of * running each of its own enumerable properties through iteratee, with each invocation potentially mutating * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. * * @param object The object to iterate over. * @param iteratee The function invoked per iteration. * @param accumulator The custom accumulator value. * @param thisArg The this binding of iteratee. * @return Returns the accumulated value. */ transform<T, TResult>( object: T[], iteratee?: MemoVoidArrayIterator<T, TResult[]>, accumulator?: TResult[] ): TResult[]; /** * @see _.transform */ transform<T, TResult>( object: T[], iteratee?: MemoVoidArrayIterator<T, Dictionary<TResult>>, accumulator?: Dictionary<TResult> ): Dictionary<TResult>; /** * @see _.transform */ transform<T, TResult>( object: Dictionary<T>, iteratee?: MemoVoidDictionaryIterator<T, Dictionary<TResult>>, accumulator?: Dictionary<TResult> ): Dictionary<TResult>; /** * @see _.transform */ transform<T, TResult>( object: Dictionary<T>, iteratee?: MemoVoidDictionaryIterator<T, TResult[]>, accumulator?: TResult[] ): TResult[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.transform */ transform<TResult>( iteratee?: MemoVoidArrayIterator<T, TResult[]>, accumulator?: TResult[] ): LoDashImplicitArrayWrapper<TResult>; /** * @see _.transform */ transform<TResult>( iteratee?: MemoVoidArrayIterator<T, Dictionary<TResult>>, accumulator?: Dictionary<TResult> ): LoDashImplicitObjectWrapper<Dictionary<TResult>>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.transform */ transform<T, TResult>( iteratee?: MemoVoidDictionaryIterator<T, Dictionary<TResult>>, accumulator?: Dictionary<TResult> ): LoDashImplicitObjectWrapper<Dictionary<TResult>>; /** * @see _.transform */ transform<T, TResult>( iteratee?: MemoVoidDictionaryIterator<T, TResult[]>, accumulator?: TResult[] ): LoDashImplicitArrayWrapper<TResult>; } //_.unset interface LoDashStatic { /** * Removes the property at path of object. * * Note: This method mutates object. * * @param object The object to modify. * @param path The path of the property to unset. * @return Returns true if the property is deleted, else false. */ unset<T>( object: T, path: StringRepresentable|StringRepresentable[] ): boolean; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.unset */ unset(path: StringRepresentable|StringRepresentable[]): LoDashImplicitWrapper<boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.unset */ unset(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper<boolean>; } //_.update interface LoDashStatic { /** * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to * customize path creation. The updater is invoked with one argument: (value). * * @param object The object to modify. * @param path The path of the property to set. * @param updater The function to produce the updated value. * @return Returns object. */ update<TResult>( object: Object, path: StringRepresentable|StringRepresentable[], updater: Function ): TResult; /** * @see _.update */ update<U extends Function, TResult>( object: Object, path: StringRepresentable|StringRepresentable[], updater: U ): TResult; /** * @see _.update */ update<O extends {}, TResult>( object: O, path: StringRepresentable|StringRepresentable[], updater: Function ): TResult; /** * @see _.update */ update<O, U extends Function, TResult>( object: O, path: StringRepresentable|StringRepresentable[], updater: U ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.update */ update<TResult>( path: StringRepresentable|StringRepresentable[], updater: any ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.update */ update<U extends Function, TResult>( path: StringRepresentable|StringRepresentable[], updater: U ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.update */ update<TResult>( path: StringRepresentable|StringRepresentable[], updater: any ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.update */ update<U extends Function, TResult>( path: StringRepresentable|StringRepresentable[], updater: U ): LoDashExplicitObjectWrapper<TResult>; } //_.values interface LoDashStatic { /** * Creates an array of the own enumerable property values of object. * * @param object The object to query. * @return Returns an array of property values. */ values<T>(object?: any): T[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.values */ values<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.values */ values<T>(): LoDashExplicitArrayWrapper<T>; } //_.valuesIn interface LoDashStatic { /** * Creates an array of the own and inherited enumerable property values of object. * * @param object The object to query. * @return Returns the array of property values. */ valuesIn<T>(object?: any): T[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.valuesIn */ valuesIn<T>(): LoDashImplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.valuesIn */ valuesIn<T>(): LoDashExplicitArrayWrapper<T>; } /********** * String * **********/ //_.camelCase interface LoDashStatic { /** * Converts string to camel case. * * @param string The string to convert. * @return Returns the camel cased string. */ camelCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.camelCase */ camelCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.camelCase */ camelCase(): LoDashExplicitWrapper<string>; } //_.capitalize interface LoDashStatic { /** * Converts the first character of string to upper case and the remaining to lower case. * * @param string The string to capitalize. * @return Returns the capitalized string. */ capitalize(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.capitalize */ capitalize(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.capitalize */ capitalize(): LoDashExplicitWrapper<string>; } //_.deburr interface LoDashStatic { /** * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining * diacritical marks. * * @param string The string to deburr. * @return Returns the deburred string. */ deburr(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.deburr */ deburr(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.deburr */ deburr(): LoDashExplicitWrapper<string>; } //_.endsWith interface LoDashStatic { /** * Checks if string ends with the given target string. * * @param string The string to search. * @param target The string to search for. * @param position The position to search from. * @return Returns true if string ends with target, else false. */ endsWith( string?: string, target?: string, position?: number ): boolean; } interface LoDashImplicitWrapper<T> { /** * @see _.endsWith */ endsWith( target?: string, position?: number ): boolean; } interface LoDashExplicitWrapper<T> { /** * @see _.endsWith */ endsWith( target?: string, position?: number ): LoDashExplicitWrapper<boolean>; } // _.escape interface LoDashStatic { /** * Converts the characters "&", "<", ">", '"', "'", and "`" in string to their corresponding HTML entities. * * Note: No other characters are escaped. To escape additional characters use a third-party library like he. * * hough the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s * article (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of attribute values or HTML comments. See #59, * #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. * * When working with HTML you should always quote attribute values to reduce XSS vectors. * * @param string The string to escape. * @return Returns the escaped string. */ escape(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.escape */ escape(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.escape */ escape(): LoDashExplicitWrapper<string>; } // _.escapeRegExp interface LoDashStatic { /** * Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", * "{", "}", and "|" in string. * * @param string The string to escape. * @return Returns the escaped string. */ escapeRegExp(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.escapeRegExp */ escapeRegExp(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.escapeRegExp */ escapeRegExp(): LoDashExplicitWrapper<string>; } //_.kebabCase interface LoDashStatic { /** * Converts string to kebab case. * * @param string The string to convert. * @return Returns the kebab cased string. */ kebabCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.kebabCase */ kebabCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.kebabCase */ kebabCase(): LoDashExplicitWrapper<string>; } //_.lowerCase interface LoDashStatic { /** * Converts `string`, as space separated words, to lower case. * * @param string The string to convert. * @return Returns the lower cased string. */ lowerCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.lowerCase */ lowerCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.lowerCase */ lowerCase(): LoDashExplicitWrapper<string>; } //_.lowerFirst interface LoDashStatic { /** * Converts the first character of `string` to lower case. * * @param string The string to convert. * @return Returns the converted string. */ lowerFirst(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.lowerFirst */ lowerFirst(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.lowerFirst */ lowerFirst(): LoDashExplicitWrapper<string>; } //_.pad interface LoDashStatic { /** * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if * they can’t be evenly divided by length. * * @param string The string to pad. * @param length The padding length. * @param chars The string used as padding. * @return Returns the padded string. */ pad( string?: string, length?: number, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.pad */ pad( length?: number, chars?: string ): string; } interface LoDashExplicitWrapper<T> { /** * @see _.pad */ pad( length?: number, chars?: string ): LoDashExplicitWrapper<string>; } //_.padEnd interface LoDashStatic { /** * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed * length. * * @param string The string to pad. * @param length The padding length. * @param chars The string used as padding. * @return Returns the padded string. */ padEnd( string?: string, length?: number, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.padEnd */ padEnd( length?: number, chars?: string ): string; } interface LoDashExplicitWrapper<T> { /** * @see _.padEnd */ padEnd( length?: number, chars?: string ): LoDashExplicitWrapper<string>; } //_.padStart interface LoDashStatic { /** * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed * length. * * @param string The string to pad. * @param length The padding length. * @param chars The string used as padding. * @return Returns the padded string. */ padStart( string?: string, length?: number, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.padStart */ padStart( length?: number, chars?: string ): string; } interface LoDashExplicitWrapper<T> { /** * @see _.padStart */ padStart( length?: number, chars?: string ): LoDashExplicitWrapper<string>; } //_.parseInt interface LoDashStatic { /** * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used * unless value is a hexadecimal, in which case a radix of 16 is used. * * Note: This method aligns with the ES5 implementation of parseInt. * * @param string The string to convert. * @param radix The radix to interpret value by. * @return Returns the converted integer. */ parseInt( string: string, radix?: number ): number; } interface LoDashImplicitWrapper<T> { /** * @see _.parseInt */ parseInt(radix?: number): number; } interface LoDashExplicitWrapper<T> { /** * @see _.parseInt */ parseInt(radix?: number): LoDashExplicitWrapper<number>; } //_.repeat interface LoDashStatic { /** * Repeats the given string n times. * * @param string The string to repeat. * @param n The number of times to repeat the string. * @return Returns the repeated string. */ repeat( string?: string, n?: number ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.repeat */ repeat(n?: number): string; } interface LoDashExplicitWrapper<T> { /** * @see _.repeat */ repeat(n?: number): LoDashExplicitWrapper<string>; } //_.replace interface LoDashStatic { /** * Replaces matches for pattern in string with replacement. * * Note: This method is based on String#replace. * * @param string * @param pattern * @param replacement * @return Returns the modified string. */ replace( string: string, pattern: RegExp|string, replacement: Function|string ): string; /** * @see _.replace */ replace( pattern?: RegExp|string, replacement?: Function|string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.replace */ replace( pattern?: RegExp|string, replacement?: Function|string ): string; /** * @see _.replace */ replace( replacement?: Function|string ): string; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.replace */ replace( pattern?: RegExp|string, replacement?: Function|string ): string; /** * @see _.replace */ replace( replacement?: Function|string ): string; } interface LoDashExplicitWrapper<T> { /** * @see _.replace */ replace( pattern?: RegExp|string, replacement?: Function|string ): LoDashExplicitWrapper<string>; /** * @see _.replace */ replace( replacement?: Function|string ): LoDashExplicitWrapper<string>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.replace */ replace( pattern?: RegExp|string, replacement?: Function|string ): LoDashExplicitWrapper<string>; /** * @see _.replace */ replace( replacement?: Function|string ): LoDashExplicitWrapper<string>; } //_.snakeCase interface LoDashStatic { /** * Converts string to snake case. * * @param string The string to convert. * @return Returns the snake cased string. */ snakeCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.snakeCase */ snakeCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.snakeCase */ snakeCase(): LoDashExplicitWrapper<string>; } //_.split interface LoDashStatic { /** * Splits string by separator. * * Note: This method is based on String#split. * * @param string * @param separator * @param limit * @return Returns the new array of string segments. */ split( string: string, separator?: RegExp|string, limit?: number ): string[]; } interface LoDashImplicitWrapper<T> { /** * @see _.split */ split( separator?: RegExp|string, limit?: number ): LoDashImplicitArrayWrapper<string>; } interface LoDashExplicitWrapper<T> { /** * @see _.split */ split( separator?: RegExp|string, limit?: number ): LoDashExplicitArrayWrapper<string>; } //_.startCase interface LoDashStatic { /** * Converts string to start case. * * @param string The string to convert. * @return Returns the start cased string. */ startCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.startCase */ startCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.startCase */ startCase(): LoDashExplicitWrapper<string>; } //_.startsWith interface LoDashStatic { /** * Checks if string starts with the given target string. * * @param string The string to search. * @param target The string to search for. * @param position The position to search from. * @return Returns true if string starts with target, else false. */ startsWith( string?: string, target?: string, position?: number ): boolean; } interface LoDashImplicitWrapper<T> { /** * @see _.startsWith */ startsWith( target?: string, position?: number ): boolean; } interface LoDashExplicitWrapper<T> { /** * @see _.startsWith */ startsWith( target?: string, position?: number ): LoDashExplicitWrapper<boolean>; } //_.template interface TemplateOptions extends TemplateSettings { /** * The sourceURL of the template's compiled source. */ sourceURL?: string; } interface TemplateExecutor { (data?: Object): string; source: string; } interface LoDashStatic { /** * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" * delimiters. Data properties may be accessed as free variables in the template. If a setting object is * provided it takes precedence over _.templateSettings values. * * Note: In the development build _.template utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier * debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @param string The template string. * @param options The options object. * @param options.escape The HTML "escape" delimiter. * @param options.evaluate The "evaluate" delimiter. * @param options.imports An object to import into the template as free variables. * @param options.interpolate The "interpolate" delimiter. * @param options.sourceURL The sourceURL of the template's compiled source. * @param options.variable The data object variable name. * @return Returns the compiled template function. */ template( string: string, options?: TemplateOptions ): TemplateExecutor; } interface LoDashImplicitWrapper<T> { /** * @see _.template */ template(options?: TemplateOptions): TemplateExecutor; } interface LoDashExplicitWrapper<T> { /** * @see _.template */ template(options?: TemplateOptions): LoDashExplicitObjectWrapper<TemplateExecutor>; } //_.toLower interface LoDashStatic { /** * Converts `string`, as a whole, to lower case. * * @param string The string to convert. * @return Returns the lower cased string. */ toLower(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.toLower */ toLower(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.toLower */ toLower(): LoDashExplicitWrapper<string>; } //_.toUpper interface LoDashStatic { /** * Converts `string`, as a whole, to upper case. * * @param string The string to convert. * @return Returns the upper cased string. */ toUpper(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.toUpper */ toUpper(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.toUpper */ toUpper(): LoDashExplicitWrapper<string>; } //_.trim interface LoDashStatic { /** * Removes leading and trailing whitespace or specified characters from string. * * @param string The string to trim. * @param chars The characters to trim. * @return Returns the trimmed string. */ trim( string?: string, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.trim */ trim(chars?: string): string; } interface LoDashExplicitWrapper<T> { /** * @see _.trim */ trim(chars?: string): LoDashExplicitWrapper<string>; } //_.trimEnd interface LoDashStatic { /** * Removes trailing whitespace or specified characters from string. * * @param string The string to trim. * @param chars The characters to trim. * @return Returns the trimmed string. */ trimEnd( string?: string, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.trimEnd */ trimEnd(chars?: string): string; } interface LoDashExplicitWrapper<T> { /** * @see _.trimEnd */ trimEnd(chars?: string): LoDashExplicitWrapper<string>; } //_.trimStart interface LoDashStatic { /** * Removes leading whitespace or specified characters from string. * * @param string The string to trim. * @param chars The characters to trim. * @return Returns the trimmed string. */ trimStart( string?: string, chars?: string ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.trimStart */ trimStart(chars?: string): string; } interface LoDashExplicitWrapper<T> { /** * @see _.trimStart */ trimStart(chars?: string): LoDashExplicitWrapper<string>; } //_.truncate interface TruncateOptions { /** The maximum string length. */ length?: number; /** The string to indicate text is omitted. */ omission?: string; /** The separator pattern to truncate to. */ separator?: string|RegExp; } interface LoDashStatic { /** * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated * string are replaced with the omission string which defaults to "…". * * @param string The string to truncate. * @param options The options object or maximum string length. * @return Returns the truncated string. */ truncate( string?: string, options?: TruncateOptions ): string; } interface LoDashImplicitWrapper<T> { /** * @see _.truncate */ truncate(options?: TruncateOptions): string; } interface LoDashExplicitWrapper<T> { /** * @see _.truncate */ truncate(options?: TruncateOptions): LoDashExplicitWrapper<string>; } //_.unescape interface LoDashStatic { /** * The inverse of _.escape; this method converts the HTML entities &amp;, &lt;, &gt;, &quot;, &#39;, and &#96; * in string to their corresponding characters. * * Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library * like he. * * @param string The string to unescape. * @return Returns the unescaped string. */ unescape(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.unescape */ unescape(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.unescape */ unescape(): LoDashExplicitWrapper<string>; } //_.upperCase interface LoDashStatic { /** * Converts `string`, as space separated words, to upper case. * * @param string The string to convert. * @return Returns the upper cased string. */ upperCase(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.upperCase */ upperCase(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.upperCase */ upperCase(): LoDashExplicitWrapper<string>; } //_.upperFirst interface LoDashStatic { /** * Converts the first character of `string` to upper case. * * @param string The string to convert. * @return Returns the converted string. */ upperFirst(string?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.upperFirst */ upperFirst(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.upperFirst */ upperFirst(): LoDashExplicitWrapper<string>; } //_.words interface LoDashStatic { /** * Splits `string` into an array of its words. * * @param string The string to inspect. * @param pattern The pattern to match words. * @return Returns the words of `string`. */ words( string?: string, pattern?: string|RegExp ): string[]; } interface LoDashImplicitWrapper<T> { /** * @see _.words */ words(pattern?: string|RegExp): string[]; } interface LoDashExplicitWrapper<T> { /** * @see _.words */ words(pattern?: string|RegExp): LoDashExplicitArrayWrapper<string>; } /*********** * Utility * ***********/ //_.attempt interface LoDashStatic { /** * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments * are provided to func when it’s invoked. * * @param func The function to attempt. * @return Returns the func result or error object. */ attempt<TResult>(func: (...args: any[]) => TResult, ...args: any[]): TResult|Error; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.attempt */ attempt<TResult>(...args: any[]): TResult|Error; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.attempt */ attempt<TResult>(...args: any[]): LoDashExplicitObjectWrapper<TResult|Error>; } //_.constant interface LoDashStatic { /** * Creates a function that returns value. * * @param value The value to return from the new function. * @return Returns the new function. */ constant<T>(value: T): () => T; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.constant */ constant<TResult>(): LoDashImplicitObjectWrapper<() => TResult>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.constant */ constant<TResult>(): LoDashExplicitObjectWrapper<() => TResult>; } //_.identity interface LoDashStatic { /** * This method returns the first argument provided to it. * * @param value Any value. * @return Returns value. */ identity<T>(value?: T): T; } interface LoDashImplicitWrapper<T> { /** * @see _.identity */ identity(): T; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.identity */ identity(): T[]; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.identity */ identity(): T; } interface LoDashExplicitWrapper<T> { /** * @see _.identity */ identity(): LoDashExplicitWrapper<T>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.identity */ identity(): LoDashExplicitArrayWrapper<T>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.identity */ identity(): LoDashExplicitObjectWrapper<T>; } //_.iteratee interface LoDashStatic { /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name the created callback returns the * property value for a given element. If `func` is an object the created * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. * * @static * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. * @returns {Function} Returns the callback. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // create custom iteratee shorthands * _.iteratee = _.wrap(_.iteratee, function(callback, func) { * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); * return !p ? callback(func) : function(object) { * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); * }; * }); * * _.filter(users, 'age > 36'); * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee<TResult>( func: Function ): (...args: any[]) => TResult; /** * @see _.iteratee */ iteratee<TResult>( func: string ): (object: any) => TResult; /** * @see _.iteratee */ iteratee( func: Object ): (object: any) => boolean; /** * @see _.iteratee */ iteratee<TResult>(): (value: TResult) => TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.iteratee */ iteratee<TResult>(): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.iteratee */ iteratee(): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** * @see _.iteratee */ iteratee<TResult>(): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.iteratee */ iteratee<TResult>(): LoDashExplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.iteratee */ iteratee(): LoDashExplicitObjectWrapper<(object: any) => boolean>; /** * @see _.iteratee */ iteratee<TResult>(): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; } //_.matches interface LoDashStatic { /** * Creates a function that performs a deep comparison between a given object and source, returning true if the * given object has equivalent property values, else false. * * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own * or inherited property value see _.matchesProperty. * * @param source The object of property values to match. * @return Returns the new function. */ matches<T>(source: T): (value: any) => boolean; /** * @see _.matches */ matches<T, V>(source: T): (value: V) => boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.matches */ matches<V>(): LoDashImplicitObjectWrapper<(value: V) => boolean>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.matches */ matches<V>(): LoDashExplicitObjectWrapper<(value: V) => boolean>; } //_.matchesProperty interface LoDashStatic { /** * Creates a function that compares the property value of path on a given object to value. * * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and * strings. Objects are compared by their own, not inherited, enumerable properties. * * @param path The path of the property to get. * @param srcValue The value to match. * @return Returns the new function. */ matchesProperty<T>( path: StringRepresentable|StringRepresentable[], srcValue: T ): (value: any) => boolean; /** * @see _.matchesProperty */ matchesProperty<T, V>( path: StringRepresentable|StringRepresentable[], srcValue: T ): (value: V) => boolean; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.matchesProperty */ matchesProperty<SrcValue>( srcValue: SrcValue ): LoDashImplicitObjectWrapper<(value: any) => boolean>; /** * @see _.matchesProperty */ matchesProperty<SrcValue, Value>( srcValue: SrcValue ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.matchesProperty */ matchesProperty<SrcValue>( srcValue: SrcValue ): LoDashExplicitObjectWrapper<(value: any) => boolean>; /** * @see _.matchesProperty */ matchesProperty<SrcValue, Value>( srcValue: SrcValue ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; } //_.method interface LoDashStatic { /** * Creates a function that invokes the method at path on a given object. Any additional arguments are provided * to the invoked method. * * @param path The path of the method to invoke. * @param args The arguments to invoke the method with. * @return Returns the new function. */ method<TObject, TResult>( path: string|StringRepresentable[], ...args: any[] ): (object: TObject) => TResult; /** * @see _.method */ method<TResult>( path: string|StringRepresentable[], ...args: any[] ): (object: any) => TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.method */ method<TObject, TResult>(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; /** * @see _.method */ method<TResult>(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.method */ method<TObject, TResult>(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; /** * @see _.method */ method<TResult>(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.method */ method<TObject, TResult>(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; /** * @see _.method */ method<TResult>(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.method */ method<TObject, TResult>(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; /** * @see _.method */ method<TResult>(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; } //_.methodOf interface LoDashStatic { /** * The opposite of _.method; this method creates a function that invokes the method at a given path on object. * Any additional arguments are provided to the invoked method. * * @param object The object to query. * @param args The arguments to invoke the method with. * @return Returns the new function. */ methodOf<TObject extends {}, TResult>( object: TObject, ...args: any[] ): (path: StringRepresentable|StringRepresentable[]) => TResult; /** * @see _.methodOf */ methodOf<TResult>( object: {}, ...args: any[] ): (path: StringRepresentable|StringRepresentable[]) => TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.methodOf */ methodOf<TResult>( ...args: any[] ): LoDashImplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.methodOf */ methodOf<TResult>( ...args: any[] ): LoDashExplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; } //_.mixin interface MixinOptions { chain?: boolean; } interface LoDashStatic { /** * Adds all own enumerable function properties of a source object to the destination object. If object is a * function then methods are added to its prototype as well. * * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying * the original. * * @param object The destination object. * @param source The object of functions to add. * @param options The options object. * @param options.chain Specify whether the functions added are chainable. * @return Returns object. */ mixin<TResult, TObject>( object: TObject, source: Dictionary<Function>, options?: MixinOptions ): TResult; /** * @see _.mixin */ mixin<TResult>( source: Dictionary<Function>, options?: MixinOptions ): TResult; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.mixin */ mixin<TResult>( source: Dictionary<Function>, options?: MixinOptions ): LoDashImplicitObjectWrapper<TResult>; /** * @see _.mixin */ mixin<TResult>( options?: MixinOptions ): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.mixin */ mixin<TResult>( source: Dictionary<Function>, options?: MixinOptions ): LoDashExplicitObjectWrapper<TResult>; /** * @see _.mixin */ mixin<TResult>( options?: MixinOptions ): LoDashExplicitObjectWrapper<TResult>; } //_.noConflict interface LoDashStatic { /** * Reverts the _ variable to its previous value and returns a reference to the lodash function. * * @return Returns the lodash function. */ noConflict(): typeof _; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.noConflict */ noConflict(): typeof _; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.noConflict */ noConflict(): LoDashExplicitObjectWrapper<typeof _>; } //_.noop interface LoDashStatic { /** * A no-operation function that returns undefined regardless of the arguments it receives. * * @return undefined */ noop(...args: any[]): void; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.noop */ noop(...args: any[]): void; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.noop */ noop(...args: any[]): _.LoDashExplicitWrapper<void>; } //_.nthArg interface LoDashStatic { /** * Creates a function that returns its nth argument. * * @param n The index of the argument to return. * @return Returns the new function. */ nthArg<TResult extends Function>(n?: number): TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.nthArg */ nthArg<TResult extends Function>(): LoDashImplicitObjectWrapper<TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.nthArg */ nthArg<TResult extends Function>(): LoDashExplicitObjectWrapper<TResult>; } //_.over interface LoDashStatic { /** * Creates a function that invokes iteratees with the arguments provided to the created function and returns * their results. * * @param iteratees The iteratees to invoke. * @return Returns the new function. */ over<TResult>(...iteratees: (Function|Function[])[]): (...args: any[]) => TResult[]; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.over */ over<TResult>(...iteratees: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => TResult[]>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.over */ over<TResult>(...iteratees: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => TResult[]>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.over */ over<TResult>(...iteratees: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => TResult[]>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.over */ over<TResult>(...iteratees: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => TResult[]>; } //_.overEvery interface LoDashStatic { /** * Creates a function that checks if all of the predicates return truthy when invoked with the arguments * provided to the created function. * * @param predicates The predicates to check. * @return Returns the new function. */ overEvery(...predicates: (Function|Function[])[]): (...args: any[]) => boolean; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.overEvery */ overEvery(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.overEvery */ overEvery(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.overEvery */ overEvery(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.overEvery */ overEvery(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; } //_.overSome interface LoDashStatic { /** * Creates a function that checks if any of the predicates return truthy when invoked with the arguments * provided to the created function. * * @param predicates The predicates to check. * @return Returns the new function. */ overSome(...predicates: (Function|Function[])[]): (...args: any[]) => boolean; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.overSome */ overSome(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.overSome */ overSome(...predicates: (Function|Function[])[]): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.overSome */ overSome(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.overSome */ overSome(...predicates: (Function|Function[])[]): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; } //_.property interface LoDashStatic { /** * Creates a function that returns the property value at path on a given object. * * @param path The path of the property to get. * @return Returns the new function. */ property<TObj, TResult>(path: StringRepresentable|StringRepresentable[]): (obj: TObj) => TResult; } interface LoDashImplicitWrapper<T> { /** * @see _.property */ property<TObj, TResult>(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; } interface LoDashImplicitArrayWrapper<T> { /** * @see _.property */ property<TObj, TResult>(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; } interface LoDashExplicitWrapper<T> { /** * @see _.property */ property<TObj, TResult>(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; } interface LoDashExplicitArrayWrapper<T> { /** * @see _.property */ property<TObj, TResult>(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; } //_.propertyOf interface LoDashStatic { /** * The opposite of _.property; this method creates a function that returns the property value at a given path * on object. * * @param object The object to query. * @return Returns the new function. */ propertyOf<T extends {}>(object: T): (path: string|string[]) => any; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.propertyOf */ propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; } interface LoDashExplicitObjectWrapper<T> { /** * @see _.propertyOf */ propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; } //_.range interface LoDashStatic { /** * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length * range is created unless a negative step is specified. * * @param start The start of the range. * @param end The end of the range. * @param step The value to increment or decrement by. * @return Returns a new range array. */ range( start: number, end: number, step?: number ): number[]; /** * @see _.range */ range( end: number, step?: number ): number[]; } interface LoDashImplicitWrapper<T> { /** * @see _.range */ range( end?: number, step?: number ): LoDashImplicitArrayWrapper<number>; } interface LoDashExplicitWrapper<T> { /** * @see _.range */ range( end?: number, step?: number ): LoDashExplicitArrayWrapper<number>; } //_.rangeRight interface LoDashStatic { /** * This method is like `_.range` except that it populates values in * descending order. * * @static * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the new array of numbers. * @example * * _.rangeRight(4); * // => [3, 2, 1, 0] * * _.rangeRight(-4); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 5); * // => [4, 3, 2, 1] * * _.rangeRight(0, 20, 5); * // => [15, 10, 5, 0] * * _.rangeRight(0, -4, -1); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 4, 0); * // => [1, 1, 1] * * _.rangeRight(0); * // => [] */ rangeRight( start: number, end: number, step?: number ): number[]; /** * @see _.rangeRight */ rangeRight( end: number, step?: number ): number[]; } interface LoDashImplicitWrapper<T> { /** * @see _.rangeRight */ rangeRight( end?: number, step?: number ): LoDashImplicitArrayWrapper<number>; } interface LoDashExplicitWrapper<T> { /** * @see _.rangeRight */ rangeRight( end?: number, step?: number ): LoDashExplicitArrayWrapper<number>; } //_.runInContext interface LoDashStatic { /** * Create a new pristine lodash function using the given context object. * * @param context The context object. * @return Returns a new lodash function. */ runInContext(context?: Object): typeof _; } interface LoDashImplicitObjectWrapper<T> { /** * @see _.runInContext */ runInContext(): typeof _; } //_.times interface LoDashStatic { /** * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee * is invoked with one argument; (index). * * @param n The number of times to invoke iteratee. * @param iteratee The function invoked per iteration. * @return Returns the array of results. */ times<TResult>( n: number, iteratee: (num: number) => TResult ): TResult[]; /** * @see _.times */ times(n: number): number[]; } interface LoDashImplicitWrapper<T> { /** * @see _.times */ times<TResult>( iteratee: (num: number) => TResult ): TResult[]; /** * @see _.times */ times(): number[]; } interface LoDashExplicitWrapper<T> { /** * @see _.times */ times<TResult>( iteratee: (num: number) => TResult ): LoDashExplicitArrayWrapper<TResult>; /** * @see _.times */ times(): LoDashExplicitArrayWrapper<number>; } //_.toPath interface LoDashStatic { /** * Converts `value` to a property path array. * * @static * @memberOf _ * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. * @example * * _.toPath('a.b.c'); * // => ['a', 'b', 'c'] * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] * * var path = ['a', 'b', 'c'], * newPath = _.toPath(path); * * console.log(newPath); * // => ['a', 'b', 'c'] * * console.log(path === newPath); * // => false */ toPath(value: any): string[]; } interface LoDashImplicitWrapperBase<T, TWrapper> { /** * @see _.toPath */ toPath(): LoDashImplicitWrapper<string[]>; } interface LoDashExplicitWrapperBase<T, TWrapper> { /** * @see _.toPath */ toPath(): LoDashExplicitWrapper<string[]>; } //_.uniqueId interface LoDashStatic { /** * Generates a unique ID. If prefix is provided the ID is appended to it. * * @param prefix The value to prefix the ID with. * @return Returns the unique ID. */ uniqueId(prefix?: string): string; } interface LoDashImplicitWrapper<T> { /** * @see _.uniqueId */ uniqueId(): string; } interface LoDashExplicitWrapper<T> { /** * @see _.uniqueId */ uniqueId(): LoDashExplicitWrapper<string>; } interface ListIterator<T, TResult> { (value: T, index: number, collection: List<T>): TResult; } interface DictionaryIterator<T, TResult> { (value: T, key?: string, collection?: Dictionary<T>): TResult; } interface NumericDictionaryIterator<T, TResult> { (value: T, key?: number, collection?: Dictionary<T>): TResult; } interface ObjectIterator<T, TResult> { (element: T, key?: string, collection?: any): TResult; } interface StringIterator<TResult> { (char: string, index?: number, string?: string): TResult; } interface MemoVoidIterator<T, TResult> { (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; } interface MemoIterator<T, TResult> { (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; } interface MemoVoidArrayIterator<T, TResult> { (acc: TResult, curr: T, index?: number, arr?: T[]): void; } interface MemoVoidDictionaryIterator<T, TResult> { (acc: TResult, curr: T, key?: string, dict?: Dictionary<T>): void; } //interface Collection<T> {} // Common interface between Arrays and jQuery objects interface List<T> { [index: number]: T; length: number; } interface Dictionary<T> { [index: string]: T; } interface NumericDictionary<T> { [index: number]: T; } interface StringRepresentable { toString(): string; } interface Cancelable { cancel(): void; } } // Named exports declare module "lodash/after" { const after: typeof _.after; export = after; } declare module "lodash/ary" { const ary: typeof _.ary; export = ary; } declare module "lodash/assign" { const assign: typeof _.assign; export = assign; } declare module "lodash/assignIn" { const assignIn: typeof _.assignIn; export = assignIn; } declare module "lodash/assignInWith" { const assignInWith: typeof _.assignInWith; export = assignInWith; } declare module "lodash/assignWith" { const assignWith: typeof _.assignWith; export = assignWith; } declare module "lodash/at" { const at: typeof _.at; export = at; } declare module "lodash/before" { const before: typeof _.before; export = before; } declare module "lodash/bind" { const bind: typeof _.bind; export = bind; } declare module "lodash/bindAll" { const bindAll: typeof _.bindAll; export = bindAll; } declare module "lodash/bindKey" { const bindKey: typeof _.bindKey; export = bindKey; } declare module "lodash/castArray" { const castArray: typeof _.castArray; export = castArray; } declare module "lodash/chain" { const chain: typeof _.chain; export = chain; } declare module "lodash/chunk" { const chunk: typeof _.chunk; export = chunk; } declare module "lodash/compact" { const compact: typeof _.compact; export = compact; } declare module "lodash/concat" { const concat: typeof _.concat; export = concat; } /** * uncoment it if definition exists */ /* declare module "lodash/cond" { const cond: typeof _.cond; export = cond; } */ /** * uncoment it if definition exists */ /* declare module "lodash/conforms" { const conforms: typeof _.conforms; export = conforms; } */ declare module "lodash/constant" { const constant: typeof _.constant; export = constant; } declare module "lodash/countBy" { const countBy: typeof _.countBy; export = countBy; } declare module "lodash/create" { const create: typeof _.create; export = create; } declare module "lodash/curry" { const curry: typeof _.curry; export = curry; } declare module "lodash/curryRight" { const curryRight: typeof _.curryRight; export = curryRight; } declare module "lodash/debounce" { const debounce: typeof _.debounce; export = debounce; } declare module "lodash/defaults" { const defaults: typeof _.defaults; export = defaults; } declare module "lodash/defaultsDeep" { const defaultsDeep: typeof _.defaultsDeep; export = defaultsDeep; } declare module "lodash/defer" { const defer: typeof _.defer; export = defer; } declare module "lodash/delay" { const delay: typeof _.delay; export = delay; } declare module "lodash/difference" { const difference: typeof _.difference; export = difference; } declare module "lodash/differenceBy" { const differenceBy: typeof _.differenceBy; export = differenceBy; } declare module "lodash/differenceWith" { const differenceWith: typeof _.differenceWith; export = differenceWith; } declare module "lodash/drop" { const drop: typeof _.drop; export = drop; } declare module "lodash/dropRight" { const dropRight: typeof _.dropRight; export = dropRight; } declare module "lodash/dropRightWhile" { const dropRightWhile: typeof _.dropRightWhile; export = dropRightWhile; } declare module "lodash/dropWhile" { const dropWhile: typeof _.dropWhile; export = dropWhile; } declare module "lodash/fill" { const fill: typeof _.fill; export = fill; } declare module "lodash/filter" { const filter: typeof _.filter; export = filter; } declare module "lodash/flatMap" { const flatMap: typeof _.flatMap; export = flatMap; } /** * uncoment it if definition exists */ /* declare module "lodash/flatMapDeep" { const flatMapDeep: typeof _.flatMapDeep; export = flatMapDeep; } */ /** * uncoment it if definition exists */ /* declare module "lodash/flatMapDepth" { const flatMapDepth: typeof _.flatMapDepth; export = flatMapDepth; } */ declare module "lodash/flatten" { const flatten: typeof _.flatten; export = flatten; } declare module "lodash/flattenDeep" { const flattenDeep: typeof _.flattenDeep; export = flattenDeep; } /** * uncoment it if definition exists */ /* declare module "lodash/flattenDepth" { const flattenDepth: typeof _.flattenDepth; export = flattenDepth; } */ declare module "lodash/flip" { const flip: typeof _.flip; export = flip; } declare module "lodash/flow" { const flow: typeof _.flow; export = flow; } declare module "lodash/flowRight" { const flowRight: typeof _.flowRight; export = flowRight; } declare module "lodash/fromPairs" { const fromPairs: typeof _.fromPairs; export = fromPairs; } declare module "lodash/functions" { const functions: typeof _.functions; export = functions; } declare module "lodash/functionsIn" { const functionsIn: typeof _.functionsIn; export = functionsIn; } declare module "lodash/groupBy" { const groupBy: typeof _.groupBy; export = groupBy; } declare module "lodash/initial" { const initial: typeof _.initial; export = initial; } declare module "lodash/intersection" { const intersection: typeof _.intersection; export = intersection; } declare module "lodash/intersectionBy" { const intersectionBy: typeof _.intersectionBy; export = intersectionBy; } declare module "lodash/intersectionWith" { const intersectionWith: typeof _.intersectionWith; export = intersectionWith; } declare module "lodash/invert" { const invert: typeof _.invert; export = invert; } declare module "lodash/invertBy" { const invertBy: typeof _.invertBy; export = invertBy; } declare module "lodash/invokeMap" { const invokeMap: typeof _.invokeMap; export = invokeMap; } declare module "lodash/iteratee" { const iteratee: typeof _.iteratee; export = iteratee; } declare module "lodash/keyBy" { const keyBy: typeof _.keyBy; export = keyBy; } declare module "lodash/keys" { const keys: typeof _.keys; export = keys; } declare module "lodash/keysIn" { const keysIn: typeof _.keysIn; export = keysIn; } declare module "lodash/map" { const map: typeof _.map; export = map; } declare module "lodash/mapKeys" { const mapKeys: typeof _.mapKeys; export = mapKeys; } declare module "lodash/mapValues" { const mapValues: typeof _.mapValues; export = mapValues; } declare module "lodash/matches" { const matches: typeof _.matches; export = matches; } declare module "lodash/matchesProperty" { const matchesProperty: typeof _.matchesProperty; export = matchesProperty; } declare module "lodash/memoize" { const memoize: typeof _.memoize; export = memoize; } declare module "lodash/merge" { const merge: typeof _.merge; export = merge; } declare module "lodash/mergeWith" { const mergeWith: typeof _.mergeWith; export = mergeWith; } declare module "lodash/method" { const method: typeof _.method; export = method; } declare module "lodash/methodOf" { const methodOf: typeof _.methodOf; export = methodOf; } declare module "lodash/mixin" { const mixin: typeof _.mixin; export = mixin; } declare module "lodash/negate" { const negate: typeof _.negate; export = negate; } declare module "lodash/nthArg" { const nthArg: typeof _.nthArg; export = nthArg; } declare module "lodash/omit" { const omit: typeof _.omit; export = omit; } declare module "lodash/omitBy" { const omitBy: typeof _.omitBy; export = omitBy; } declare module "lodash/once" { const once: typeof _.once; export = once; } declare module "lodash/orderBy" { const orderBy: typeof _.orderBy; export = orderBy; } declare module "lodash/over" { const over: typeof _.over; export = over; } declare module "lodash/overArgs" { const overArgs: typeof _.overArgs; export = overArgs; } declare module "lodash/overEvery" { const overEvery: typeof _.overEvery; export = overEvery; } declare module "lodash/overSome" { const overSome: typeof _.overSome; export = overSome; } declare module "lodash/partial" { const partial: typeof _.partial; export = partial; } declare module "lodash/partialRight" { const partialRight: typeof _.partialRight; export = partialRight; } declare module "lodash/partition" { const partition: typeof _.partition; export = partition; } declare module "lodash/pick" { const pick: typeof _.pick; export = pick; } declare module "lodash/pickBy" { const pickBy: typeof _.pickBy; export = pickBy; } declare module "lodash/property" { const property: typeof _.property; export = property; } declare module "lodash/propertyOf" { const propertyOf: typeof _.propertyOf; export = propertyOf; } declare module "lodash/pull" { const pull: typeof _.pull; export = pull; } declare module "lodash/pullAll" { const pullAll: typeof _.pullAll; export = pullAll; } declare module "lodash/pullAllBy" { const pullAllBy: typeof _.pullAllBy; export = pullAllBy; } /** * uncoment it if definition exists */ /* declare module "lodash/pullAllWith" { const pullAllWith: typeof _.pullAllWith; export = pullAllWith; } */ declare module "lodash/pullAt" { const pullAt: typeof _.pullAt; export = pullAt; } declare module "lodash/range" { const range: typeof _.range; export = range; } declare module "lodash/rangeRight" { const rangeRight: typeof _.rangeRight; export = rangeRight; } declare module "lodash/rearg" { const rearg: typeof _.rearg; export = rearg; } declare module "lodash/reject" { const reject: typeof _.reject; export = reject; } declare module "lodash/remove" { const remove: typeof _.remove; export = remove; } declare module "lodash/rest" { const rest: typeof _.rest; export = rest; } declare module "lodash/reverse" { const reverse: typeof _.reverse; export = reverse; } declare module "lodash/sampleSize" { const sampleSize: typeof _.sampleSize; export = sampleSize; } declare module "lodash/set" { const set: typeof _.set; export = set; } declare module "lodash/setWith" { const setWith: typeof _.setWith; export = setWith; } declare module "lodash/shuffle" { const shuffle: typeof _.shuffle; export = shuffle; } declare module "lodash/slice" { const slice: typeof _.slice; export = slice; } declare module "lodash/sortBy" { const sortBy: typeof _.sortBy; export = sortBy; } declare module "lodash/sortedUniq" { const sortedUniq: typeof _.sortedUniq; export = sortedUniq; } declare module "lodash/sortedUniqBy" { const sortedUniqBy: typeof _.sortedUniqBy; export = sortedUniqBy; } declare module "lodash/split" { const split: typeof _.split; export = split; } declare module "lodash/spread" { const spread: typeof _.spread; export = spread; } declare module "lodash/tail" { const tail: typeof _.tail; export = tail; } declare module "lodash/take" { const take: typeof _.take; export = take; } declare module "lodash/takeRight" { const takeRight: typeof _.takeRight; export = takeRight; } declare module "lodash/takeRightWhile" { const takeRightWhile: typeof _.takeRightWhile; export = takeRightWhile; } declare module "lodash/takeWhile" { const takeWhile: typeof _.takeWhile; export = takeWhile; } declare module "lodash/tap" { const tap: typeof _.tap; export = tap; } declare module "lodash/throttle" { const throttle: typeof _.throttle; export = throttle; } declare module "lodash/thru" { const thru: typeof _.thru; export = thru; } declare module "lodash/toArray" { const toArray: typeof _.toArray; export = toArray; } declare module "lodash/toPairs" { const toPairs: typeof _.toPairs; export = toPairs; } declare module "lodash/toPairsIn" { const toPairsIn: typeof _.toPairsIn; export = toPairsIn; } declare module "lodash/toPath" { const toPath: typeof _.toPath; export = toPath; } declare module "lodash/toPlainObject" { const toPlainObject: typeof _.toPlainObject; export = toPlainObject; } declare module "lodash/transform" { const transform: typeof _.transform; export = transform; } declare module "lodash/unary" { const unary: typeof _.unary; export = unary; } declare module "lodash/union" { const union: typeof _.union; export = union; } declare module "lodash/unionBy" { const unionBy: typeof _.unionBy; export = unionBy; } declare module "lodash/unionWith" { const unionWith: typeof _.unionWith; export = unionWith; } declare module "lodash/uniq" { const uniq: typeof _.uniq; export = uniq; } declare module "lodash/uniqBy" { const uniqBy: typeof _.uniqBy; export = uniqBy; } declare module "lodash/uniqWith" { const uniqWith: typeof _.uniqWith; export = uniqWith; } declare module "lodash/unset" { const unset: typeof _.unset; export = unset; } declare module "lodash/unzip" { const unzip: typeof _.unzip; export = unzip; } declare module "lodash/unzipWith" { const unzipWith: typeof _.unzipWith; export = unzipWith; } declare module "lodash/update" { const update: typeof _.update; export = update; } /** * uncoment it if definition exists */ /* declare module "lodash/updateWith" { const updateWith: typeof _.updateWith; export = updateWith; } */ declare module "lodash/values" { const values: typeof _.values; export = values; } declare module "lodash/valuesIn" { const valuesIn: typeof _.valuesIn; export = valuesIn; } declare module "lodash/without" { const without: typeof _.without; export = without; } declare module "lodash/words" { const words: typeof _.words; export = words; } declare module "lodash/wrap" { const wrap: typeof _.wrap; export = wrap; } declare module "lodash/xor" { const xor: typeof _.xor; export = xor; } declare module "lodash/xorBy" { const xorBy: typeof _.xorBy; export = xorBy; } declare module "lodash/xorWith" { const xorWith: typeof _.xorWith; export = xorWith; } declare module "lodash/zip" { const zip: typeof _.zip; export = zip; } declare module "lodash/zipObject" { const zipObject: typeof _.zipObject; export = zipObject; } /** * uncoment it if definition exists */ /* declare module "lodash/zipObjectDeep" { const zipObjectDeep: typeof _.zipObjectDeep; export = zipObjectDeep; } */ declare module "lodash/zipWith" { const zipWith: typeof _.zipWith; export = zipWith; } /** * uncoment it if definition exists */ /* declare module "lodash/entries" { const entries: typeof _.entries; export = entries; } */ /** * uncoment it if definition exists */ /* declare module "lodash/entriesIn" { const entriesIn: typeof _.entriesIn; export = entriesIn; } */ declare module "lodash/extend" { const extend: typeof _.extend; export = extend; } /** * uncoment it if definition exists */ /* declare module "lodash/extendWith" { const extendWith: typeof _.extendWith; export = extendWith; } */ declare module "lodash/add" { const add: typeof _.add; export = add; } declare module "lodash/attempt" { const attempt: typeof _.attempt; export = attempt; } declare module "lodash/camelCase" { const camelCase: typeof _.camelCase; export = camelCase; } declare module "lodash/capitalize" { const capitalize: typeof _.capitalize; export = capitalize; } declare module "lodash/ceil" { const ceil: typeof _.ceil; export = ceil; } declare module "lodash/clamp" { const clamp: typeof _.clamp; export = clamp; } declare module "lodash/clone" { const clone: typeof _.clone; export = clone; } declare module "lodash/cloneDeep" { const cloneDeep: typeof _.cloneDeep; export = cloneDeep; } declare module "lodash/cloneDeepWith" { const cloneDeepWith: typeof _.cloneDeepWith; export = cloneDeepWith; } declare module "lodash/cloneWith" { const cloneWith: typeof _.cloneWith; export = cloneWith; } declare module "lodash/deburr" { const deburr: typeof _.deburr; export = deburr; } /** * uncoment it if definition exists */ /* declare module "lodash/divide" { const divide: typeof _.divide; export = divide; } */ declare module "lodash/endsWith" { const endsWith: typeof _.endsWith; export = endsWith; } declare module "lodash/eq" { const eq: typeof _.eq; export = eq; } declare module "lodash/escape" { const escape: typeof _.escape; export = escape; } declare module "lodash/escapeRegExp" { const escapeRegExp: typeof _.escapeRegExp; export = escapeRegExp; } declare module "lodash/every" { const every: typeof _.every; export = every; } declare module "lodash/find" { const find: typeof _.find; export = find; } declare module "lodash/findIndex" { const findIndex: typeof _.findIndex; export = findIndex; } declare module "lodash/findKey" { const findKey: typeof _.findKey; export = findKey; } declare module "lodash/findLast" { const findLast: typeof _.findLast; export = findLast; } declare module "lodash/findLastIndex" { const findLastIndex: typeof _.findLastIndex; export = findLastIndex; } declare module "lodash/findLastKey" { const findLastKey: typeof _.findLastKey; export = findLastKey; } declare module "lodash/floor" { const floor: typeof _.floor; export = floor; } declare module "lodash/forEach" { const forEach: typeof _.forEach; export = forEach; } declare module "lodash/forEachRight" { const forEachRight: typeof _.forEachRight; export = forEachRight; } declare module "lodash/forIn" { const forIn: typeof _.forIn; export = forIn; } declare module "lodash/forInRight" { const forInRight: typeof _.forInRight; export = forInRight; } declare module "lodash/forOwn" { const forOwn: typeof _.forOwn; export = forOwn; } declare module "lodash/forOwnRight" { const forOwnRight: typeof _.forOwnRight; export = forOwnRight; } declare module "lodash/get" { const get: typeof _.get; export = get; } declare module "lodash/gt" { const gt: typeof _.gt; export = gt; } declare module "lodash/gte" { const gte: typeof _.gte; export = gte; } declare module "lodash/has" { const has: typeof _.has; export = has; } declare module "lodash/hasIn" { const hasIn: typeof _.hasIn; export = hasIn; } declare module "lodash/head" { const head: typeof _.head; export = head; } declare module "lodash/identity" { const identity: typeof _.identity; export = identity; } declare module "lodash/includes" { const includes: typeof _.includes; export = includes; } declare module "lodash/indexOf" { const indexOf: typeof _.indexOf; export = indexOf; } declare module "lodash/inRange" { const inRange: typeof _.inRange; export = inRange; } declare module "lodash/invoke" { const invoke: typeof _.invoke; export = invoke; } declare module "lodash/isArguments" { const isArguments: typeof _.isArguments; export = isArguments; } declare module "lodash/isArray" { const isArray: typeof _.isArray; export = isArray; } declare module "lodash/isArrayBuffer" { const isArrayBuffer: typeof _.isArrayBuffer; export = isArrayBuffer; } declare module "lodash/isArrayLike" { const isArrayLike: typeof _.isArrayLike; export = isArrayLike; } declare module "lodash/isArrayLikeObject" { const isArrayLikeObject: typeof _.isArrayLikeObject; export = isArrayLikeObject; } declare module "lodash/isBoolean" { const isBoolean: typeof _.isBoolean; export = isBoolean; } declare module "lodash/isBuffer" { const isBuffer: typeof _.isBuffer; export = isBuffer; } declare module "lodash/isDate" { const isDate: typeof _.isDate; export = isDate; } declare module "lodash/isElement" { const isElement: typeof _.isElement; export = isElement; } declare module "lodash/isEmpty" { const isEmpty: typeof _.isEmpty; export = isEmpty; } declare module "lodash/isEqual" { const isEqual: typeof _.isEqual; export = isEqual; } declare module "lodash/isEqualWith" { const isEqualWith: typeof _.isEqualWith; export = isEqualWith; } declare module "lodash/isError" { const isError: typeof _.isError; export = isError; } declare module "lodash/isFinite" { const isFinite: typeof _.isFinite; export = isFinite; } declare module "lodash/isFunction" { const isFunction: typeof _.isFunction; export = isFunction; } declare module "lodash/isInteger" { const isInteger: typeof _.isInteger; export = isInteger; } declare module "lodash/isLength" { const isLength: typeof _.isLength; export = isLength; } declare module "lodash/isMap" { const isMap: typeof _.isMap; export = isMap; } declare module "lodash/isMatch" { const isMatch: typeof _.isMatch; export = isMatch; } declare module "lodash/isMatchWith" { const isMatchWith: typeof _.isMatchWith; export = isMatchWith; } declare module "lodash/isNaN" { const isNaN: typeof _.isNaN; export = isNaN; } declare module "lodash/isNative" { const isNative: typeof _.isNative; export = isNative; } declare module "lodash/isNil" { const isNil: typeof _.isNil; export = isNil; } declare module "lodash/isNull" { const isNull: typeof _.isNull; export = isNull; } declare module "lodash/isNumber" { const isNumber: typeof _.isNumber; export = isNumber; } declare module "lodash/isObject" { const isObject: typeof _.isObject; export = isObject; } declare module "lodash/isObjectLike" { const isObjectLike: typeof _.isObjectLike; export = isObjectLike; } declare module "lodash/isPlainObject" { const isPlainObject: typeof _.isPlainObject; export = isPlainObject; } declare module "lodash/isRegExp" { const isRegExp: typeof _.isRegExp; export = isRegExp; } declare module "lodash/isSafeInteger" { const isSafeInteger: typeof _.isSafeInteger; export = isSafeInteger; } declare module "lodash/isSet" { const isSet: typeof _.isSet; export = isSet; } declare module "lodash/isString" { const isString: typeof _.isString; export = isString; } declare module "lodash/isSymbol" { const isSymbol: typeof _.isSymbol; export = isSymbol; } declare module "lodash/isTypedArray" { const isTypedArray: typeof _.isTypedArray; export = isTypedArray; } declare module "lodash/isUndefined" { const isUndefined: typeof _.isUndefined; export = isUndefined; } declare module "lodash/isWeakMap" { const isWeakMap: typeof _.isWeakMap; export = isWeakMap; } declare module "lodash/isWeakSet" { const isWeakSet: typeof _.isWeakSet; export = isWeakSet; } declare module "lodash/join" { const join: typeof _.join; export = join; } declare module "lodash/kebabCase" { const kebabCase: typeof _.kebabCase; export = kebabCase; } declare module "lodash/last" { const last: typeof _.last; export = last; } declare module "lodash/lastIndexOf" { const lastIndexOf: typeof _.lastIndexOf; export = lastIndexOf; } declare module "lodash/lowerCase" { const lowerCase: typeof _.lowerCase; export = lowerCase; } declare module "lodash/lowerFirst" { const lowerFirst: typeof _.lowerFirst; export = lowerFirst; } declare module "lodash/lt" { const lt: typeof _.lt; export = lt; } declare module "lodash/lte" { const lte: typeof _.lte; export = lte; } declare module "lodash/max" { const max: typeof _.max; export = max; } declare module "lodash/maxBy" { const maxBy: typeof _.maxBy; export = maxBy; } declare module "lodash/mean" { const mean: typeof _.mean; export = mean; } /** * uncoment it if definition exists */ /* declare module "lodash/meanBy" { const meanBy: typeof _.meanBy; export = meanBy; } */ declare module "lodash/min" { const min: typeof _.min; export = min; } declare module "lodash/minBy" { const minBy: typeof _.minBy; export = minBy; } /** * uncoment it if definition exists */ /* declare module "lodash/multiply" { const multiply: typeof _.multiply; export = multiply; } */ /** * uncoment it if definition exists */ /* declare module "lodash/nth" { const nth: typeof _.nth; export = nth; } */ declare module "lodash/noConflict" { const noConflict: typeof _.noConflict; export = noConflict; } declare module "lodash/noop" { const noop: typeof _.noop; export = noop; } declare module "lodash/now" { const now: typeof _.now; export = now; } declare module "lodash/pad" { const pad: typeof _.pad; export = pad; } declare module "lodash/padEnd" { const padEnd: typeof _.padEnd; export = padEnd; } declare module "lodash/padStart" { const padStart: typeof _.padStart; export = padStart; } declare module "lodash/parseInt" { const parseInt: typeof _.parseInt; export = parseInt; } declare module "lodash/random" { const random: typeof _.random; export = random; } declare module "lodash/reduce" { const reduce: typeof _.reduce; export = reduce; } declare module "lodash/reduceRight" { const reduceRight: typeof _.reduceRight; export = reduceRight; } declare module "lodash/repeat" { const repeat: typeof _.repeat; export = repeat; } declare module "lodash/replace" { const replace: typeof _.replace; export = replace; } declare module "lodash/result" { const result: typeof _.result; export = result; } declare module "lodash/round" { const round: typeof _.round; export = round; } declare module "lodash/runInContext" { const runInContext: typeof _.runInContext; export = runInContext; } declare module "lodash/sample" { const sample: typeof _.sample; export = sample; } declare module "lodash/size" { const size: typeof _.size; export = size; } declare module "lodash/snakeCase" { const snakeCase: typeof _.snakeCase; export = snakeCase; } declare module "lodash/some" { const some: typeof _.some; export = some; } declare module "lodash/sortedIndex" { const sortedIndex: typeof _.sortedIndex; export = sortedIndex; } declare module "lodash/sortedIndexBy" { const sortedIndexBy: typeof _.sortedIndexBy; export = sortedIndexBy; } declare module "lodash/sortedIndexOf" { const sortedIndexOf: typeof _.sortedIndexOf; export = sortedIndexOf; } declare module "lodash/sortedLastIndex" { const sortedLastIndex: typeof _.sortedLastIndex; export = sortedLastIndex; } declare module "lodash/sortedLastIndexBy" { const sortedLastIndexBy: typeof _.sortedLastIndexBy; export = sortedLastIndexBy; } declare module "lodash/sortedLastIndexOf" { const sortedLastIndexOf: typeof _.sortedLastIndexOf; export = sortedLastIndexOf; } declare module "lodash/startCase" { const startCase: typeof _.startCase; export = startCase; } declare module "lodash/startsWith" { const startsWith: typeof _.startsWith; export = startsWith; } declare module "lodash/subtract" { const subtract: typeof _.subtract; export = subtract; } declare module "lodash/sum" { const sum: typeof _.sum; export = sum; } declare module "lodash/sumBy" { const sumBy: typeof _.sumBy; export = sumBy; } declare module "lodash/template" { const template: typeof _.template; export = template; } declare module "lodash/times" { const times: typeof _.times; export = times; } declare module "lodash/toInteger" { const toInteger: typeof _.toInteger; export = toInteger; } declare module "lodash/toLength" { const toLength: typeof _.toLength; export = toLength; } declare module "lodash/toLower" { const toLower: typeof _.toLower; export = toLower; } declare module "lodash/toNumber" { const toNumber: typeof _.toNumber; export = toNumber; } declare module "lodash/toSafeInteger" { const toSafeInteger: typeof _.toSafeInteger; export = toSafeInteger; } declare module "lodash/toString" { const toString: typeof _.toString; export = toString; } declare module "lodash/toUpper" { const toUpper: typeof _.toUpper; export = toUpper; } declare module "lodash/trim" { const trim: typeof _.trim; export = trim; } declare module "lodash/trimEnd" { const trimEnd: typeof _.trimEnd; export = trimEnd; } declare module "lodash/trimStart" { const trimStart: typeof _.trimStart; export = trimStart; } declare module "lodash/truncate" { const truncate: typeof _.truncate; export = truncate; } declare module "lodash/unescape" { const unescape: typeof _.unescape; export = unescape; } declare module "lodash/uniqueId" { const uniqueId: typeof _.uniqueId; export = uniqueId; } declare module "lodash/upperCase" { const upperCase: typeof _.upperCase; export = upperCase; } declare module "lodash/upperFirst" { const upperFirst: typeof _.upperFirst; export = upperFirst; } declare module "lodash/each" { const each: typeof _.each; export = each; } declare module "lodash/eachRight" { const eachRight: typeof _.eachRight; export = eachRight; } declare module "lodash/first" { const first: typeof _.first; export = first; } declare module "lodash/fp" { export = _; } declare module "lodash" { export = _; } // Backward compatibility with --target es5 interface Set<T> {} interface Map<K, V> {} interface WeakSet<T> {} interface WeakMap<K, V> {}
sumbad/calendarium
typings/globals/lodash/index.d.ts
TypeScript
isc
547,077
var sendError = require('../../util/send-error'); // Create a new todo module.exports = function (options) { // Shorter reference to data store var store = options.store; return function (req, res) { var todo = store.todos.filter(function (t) { return t.id === req.params.id; })[0]; // No todo with that id if (!todo) { return sendError(res, 404, 'Todo not found'); } // Verify that user exists var user = store.users.filter(function (u) { return u.id === req.params.userId; })[0]; if (!user) { return sendError(res, 400, 'User not found: ' + req.params.userId); } // Set values todo.assignedTo = user.id; // Save data to store store.users.splice(store.users.indexOf(user), 1, user); // Respond res.status(200).json(todo); }; };
wesleytodd/express-todo-api
handlers/todos/assign.js
JavaScript
isc
784
var pi = require('./src/pi'); function run() { pi.send(parseInt(process.argv[2], 10)); setTimeout(run(), 2000); } run();
LucioFranco/bota2015
single.js
JavaScript
isc
128
'use strict' const net = require('net') const assert = require('assert') const eventList = require('../src/event-list') const tcpEmitterServer = require('../src/index') const { net: netUtils, payload: payloadUtils } = require('./utils') describe('TCP Emitter Server Tests:', function () { describe('Scenario: Creating a new TCP Emitter server:', function () { describe('When creating a new TCP Emitter server:', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { serverInst = tcpEmitterServer() }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) it('should return new instance of `net.Server`', function () { assert.ok(serverInst instanceof net.Server) }) }) }) describe('Scenario: Subscribing to an event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter client will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with a connected TCP Emitter client,', function () { /** * TCP Emitter client that will be subscribing to an event. * @type {net.Socket} */ let clientInst = null beforeEach(function () { // Create the TCP Emitter client and connect it with the TCP Emitter // server for this test. return netUtils.createTCPEmitterClient(serverInst.address()) .then(client => { clientInst = client }) }) afterEach(function () { return netUtils.closeTCPEmitterClient(clientInst) }) describe('when the TCP Emitter client subscribes to an event:', function () { /** * Event which the TCP Emitter client will be subscribing to. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' }) it('should emit TCP Emitter Subscribe Event with the TCP Emitter client & Event name', function (done) { serverInst.on(eventList.subscribe, (socket, eventName) => { // Assert that the emitted event name is the same as the event // name which the TCP Emitter client subscribed to. assert.strictEqual(event, eventName) // Assert that socket is of type 'net.Socket'. assert.ok(socket instanceof net.Socket) done() }) // Subscribe to an event. clientInst.write(payloadUtils.createSubscribe({ event })) }) }) }) }) }) describe('Scenario: Subscribing to an already subscribed event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter client will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with a connected TCP Emitter client,', function () { /** * TCP Emitter client that will be subscribing to an event. * @type {net.Socket} */ let clientInst = null beforeEach(function () { // Create the TCP Emitter client and connect it with the TCP Emitter // server for this test. return netUtils.createTCPEmitterClient(serverInst.address()) .then(client => { clientInst = client }) }) afterEach(function () { return netUtils.closeTCPEmitterClient(clientInst) }) describe('that is subscribed to an event,', function () { /** * Event which the TCP Emitter client will be subscribing to. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' return clientInst.write(payloadUtils.createSubscribe({ event })) }) describe('when re-subscribing to the same event:', function () { it('should not emit TCP Emitter Subscribe Event', function (done) { global.setTimeout(done, 500) serverInst.on(eventList.subscribe, data => { assert.fail('TCP Emitter server should not emit TCP Emitter ' + 'Subscribe Event if the TCP Emitter client requests to ' + 'subscribe to an event that it is already subscribed to') done() }) // Subscribe to an event which the TCP Emitter client is already // subscribed to. clientInst.write(payloadUtils.createSubscribe({ event })) }) }) }) }) }) }) describe('Scenario: Unsubscribing from an event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter client will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with a connected TCP Emitter client,', function () { /** * TCP Emitter client that will be unsubscribing from an event. * @type {net.Socket} */ let clientInst = null beforeEach(function () { // Create the TCP Emitter client and connect it with the TCP Emitter // server for this test. return netUtils.createTCPEmitterClient(serverInst.address()) .then(client => { clientInst = client }) }) afterEach(function () { return netUtils.closeTCPEmitterClient(clientInst) }) describe('that is subscribed to an event,', function () { /** * Event which the TCP Emitter client will be unsubscribing from. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' return clientInst.write(payloadUtils.createSubscribe({ event })) }) describe('when the TCP Emitter client unsubscribes from an event:', function () { it('should emit TCP Emitter Unsubscribe Event with the TCP Emitter client & Event name', function (done) { serverInst.on(eventList.unsubscribe, (socket, eventName) => { // Assert that the emitted event name is the same as the event // name which the TCP Emitter client subscribed to. assert.strictEqual(event, eventName) // Assert that socket is of type 'net.Socket'. assert.ok(socket instanceof net.Socket) done() }) // Subscribe to an event. return clientInst.write(payloadUtils.createUnsubscribe({ event })) }) }) }) }) }) }) describe('Scenario: Unsubscribing from an unsubscribed event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter client will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with a connected TCP Emitter client,', function () { /** * TCP Emitter client that will be subscribing to an event. * @type {net.Socket} */ let clientInst = null beforeEach(function () { // Create the TCP Emitter client and connect it with the TCP Emitter // server for this test. return netUtils.createTCPEmitterClient(serverInst.address()) .then(client => { clientInst = client }) }) afterEach(function () { return netUtils.closeTCPEmitterClient(clientInst) }) describe('when the TCP Emitter client request to unsubscribes from an event that it is not subscribed to:', function () { /** * Event which the TCP Emitter client will be unsubscribing from. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' }) it('should not emit TCP Emitter Unsubscribe Event', function (done) { global.setTimeout(done, 500) serverInst.on(eventList.unsubscribe, data => { assert.fail('TCP Emitter server should not emit TCP Emitter ' + 'Unsubscribe Event if the TCP Emitter client requests to ' + 'unsubscribe from an event that it is not subscribed to') done() }) // Unsubscribe from an event that the TCP Emitter client is not // subscribed to. clientInst.write(payloadUtils.createUnsubscribe({ event })) }) }) }) }) }) describe('Scenario: Broadcasting to an event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter client will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with a connected TCP Emitter client,', function () { /** * TCP Emitter client that will be broadcasting to an event. * @type {net.Socket} */ let clientInst = null beforeEach(function () { // Create the TCP Emitter client and connect it with the TCP Emitter // server for this test. return netUtils.createTCPEmitterClient(serverInst.address()) .then(client => { clientInst = client }) }) afterEach(function () { return netUtils.closeTCPEmitterClient(clientInst) }) describe('when the TCP Emitter client broadcasts to an event:', function () { /** * Event which the TCP Emitter client will be broadcasting to. * @type {string} */ let event = null /** * Arguments that will be broadcasted. * @type {Array.<*>} */ let args = null beforeEach(function () { event = 'event-name' args = [ 1, '2', true, { name: 'luca' } ] }) it('should emit TCP Emitter Broadcast Event with the TCP Emitter client, Event name & Arguments', function (done) { // When an assertion fails in a EventEmitter, it will by default // emit the 'error' event with the error object. If there are no // listeners to the 'error' event it will throw the Error to the // process. // // Such implementation is expected when dealing with syncrhonous // processes, however since the Broadcast process uses Promises so // that it emits the TCP Emitter Broadcast Event once all the event // listeners (TCP Emitter clients) have been notified, when the // 'error' event is emitted, apart from the assertion error it will // also show the UnhandledPromiseRejectionWarning warning. // // This is why we are listening for the error event in this test // case. serverInst.on('error', done) serverInst.on(eventList.broadcast, (socket, eventName, broadcastedArgs) => { // Assert that the emitted event name is the same as the event // name which the TCP Emitter client broadcasted to. assert.strictEqual(event, eventName) // Assert that socket is of type 'net.Socket'. assert.ok(socket instanceof net.Socket) // Assert that the emitted arguments are the same as the // broadcasted arguments. assert.deepStrictEqual(args, broadcastedArgs) done() }) // Broadcast to an event. clientInst.write(payloadUtils.createBroadcast({ event, args })) }) }) }) }) }) describe('Scenario: Subscribing & broadcasting to an event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter Server which the TCP Emitter clients will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with multiple connected TCP Emitter clients,', function () { /** * TCP Emitter client that will be receiving the payload. * @type {net.Socket} */ let receiverOne = null /** * TCP Emitter client that will be receiving the payload. * @type {net.Socket} */ let receiverTwo = null /** * TCP Emitter client that will be subscribed to another event. * @type {net.Socket} */ let otherClient = null /** * TCP Emitter client that will be broadcasting the payload. * @type {net.Socket} */ let broadcaster = null beforeEach(function () { // Create the TCP Emitter clients and connect them with the TCP // Emitter server for this test. return Promise.all([ netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()) ]).then(clients => { receiverOne = clients[0] receiverTwo = clients[1] otherClient = clients[2] broadcaster = clients[3] }) }) afterEach(function () { return Promise.all([ netUtils.closeTCPEmitterClient(receiverOne), netUtils.closeTCPEmitterClient(receiverTwo), netUtils.closeTCPEmitterClient(otherClient), netUtils.closeTCPEmitterClient(broadcaster) ]) }) describe('that are subscribed to an event,', function () { /** * Name of the event which the TCP Emitter clients will be subscribing * & broadcasting to. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' // Subscribe the TCP Emitter clients. return Promise.all([ netUtils.write(receiverOne, payloadUtils.createSubscribe({ event })), netUtils.write(receiverTwo, payloadUtils.createSubscribe({ event })), netUtils.write(broadcaster, payloadUtils.createSubscribe({ event })), netUtils.write(otherClient, payloadUtils.createSubscribe({ event: 'other' })) ]) }) describe('when a TCP Emitter client broadcasts to an event:', function () { /** * Arguments that will be broadcasted. * @type {Array.<*>} */ let args = null beforeEach(function () { args = [ 1, '2', true, { name: 'luca' } ] }) it('should broadcast the payload to the listeners of the event', function (done) { // Wait for any data sent by the TCP Emitter server. Promise.all([ netUtils.waitForData(receiverOne), netUtils.waitForData(receiverTwo) ]).then(dataArray => { dataArray.forEach(data => { // Parse the data retrieved from TCP Emitter server. const payloads = payloadUtils.parsePayload({ data }) // Assert that only one payload was received. assert.strictEqual(payloads.length, 1) // Assert 'event' attribute. assert.strictEqual(event, payloads[0].event) // Assert 'args' attribute assert.deepStrictEqual(args, payloads[0].args) }) // Finalize test. done() }).catch(done) // Broadcast payload to the event which the receiver TCP Emitter // client is subscriibed to. broadcaster.write(payloadUtils.createBroadcast({ event, args })) }) it('should not broadcast the payload to the TCP Emitter client from where the broadcast originated from', function (done) { // Wait 500ms for any data sent by TCP Emitter Server before // assuming the test case is successful. global.setTimeout(done, 500) // Wait for any data sent by the TCP Emitter server. netUtils.waitForData(broadcaster).then(() => { // TCP Emitter clients that broadcasted to the event should not // be notified by the TCP Emitter server. assert.fail('TCP Emitter clients that broadcasted to the ' + 'should not be notified') }).catch(done) // Broadcast payload to the event which the receiver TCP Emitter // client is subscriibed to. broadcaster.write(payloadUtils.createBroadcast({ event, args })) }) it('should not broadcast the payload to the TCP Emitter clients that are not subscribed to the event the broadcast was made for', function (done) { // Wait 500ms for any data sent by TCP Emitter Server before // assuming the test case is successful. global.setTimeout(done, 500) // Wait for any data sent by the TCP Emitter server. netUtils.waitForData(otherClient).then(() => { // TCP Emitter clients which are not subscribed to the event // which the broadcast was made to, should not be notified. assert.fail('TCP Emitter client which is not subscribed to ' + 'the event the broadcast was made to, should not be notified') }).catch(done) // Broadcast payload to the event which the receiver TCP Emitter // client is subscriibed to. broadcaster.write(payloadUtils.createBroadcast({ event, args })) }) }) }) }) }) }) describe('Scenario: Unsubscribing from & broadcasting to an event:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter server which the TCP Emitter clients whill be // connecting return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with multiple connected TCP Emitter clients,', function () { /** * TCP Emitter client that will be receiving the payload. * @type {net.Socket} */ let receiver = null /** * TCP Emitter client that will be broadcasting the payload. * @type {net.Socket} */ let broadcaster = null /** * TCP Emitter client that will be unsubscribing from an event. * @type {net.Socket} */ let unsubscriber = null beforeEach(function () { // Create the TCP Emitter clients and connect them with the TCP // Emitter server for this test. return Promise.all([ netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()) ]).then(clients => { receiver = clients[0] broadcaster = clients[1] unsubscriber = clients[2] }) }) afterEach(function () { return Promise.all([ netUtils.closeTCPEmitterClient(receiver), netUtils.closeTCPEmitterClient(broadcaster), netUtils.closeTCPEmitterClient(unsubscriber) ]) }) describe('that are subscribed to an event,', function () { /** * Name of the event which the TCP Emitter clients will be subscribing * & broadcasting to. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' // Subscribe the TCP Emitter clients return Promise.all([ netUtils.write(receiver, payloadUtils.createSubscribe({ event })), netUtils.write(unsubscriber, payloadUtils.createSubscribe({ event })) ]) }) describe('and a TCP Emitter client unsubscribes from an event,', function () { beforeEach(function () { return netUtils.write(unsubscriber, payloadUtils.createUnsubscribe({ event })) }) describe('when a TCP Emitter client broadcasts to an event:', function () { /** * Arguments that will be broadcasted. * @type {Array.<*>} */ let args = null beforeEach(function () { args = [ 1, '2', true, { name: 'luca' } ] }) it('should broadcast the payload to the listeners of the event', function (done) { // Wait for any data sent by the TCP Emitter server. netUtils.waitForData(receiver).then((data) => { // Parse the data retrieved from TCP Emitter server. const payloads = payloadUtils.parsePayload({ data }) // Assert that only one payload was received. assert.strictEqual(payloads.length, 1) // Assert 'event' attribute. assert.strictEqual(event, payloads[0].event) // Assert 'args' attribute assert.deepStrictEqual(args, payloads[0].args) // Finalize test. done() }).catch(done) // Broadcast payload to the event which the TCP Emitter clients // have subscribed to. broadcaster.write(payloadUtils.createBroadcast({ event, args })) }) it('should not broadcast the payload to the TCP Emitter client that unsubscribed from the event', function (done) { // Wait 500ms for any data sent by TCP Emitter Server before // assuming the test case is successful. global.setTimeout(done, 500) // Wait for any data sent by the TCP Emitter server. netUtils.waitForData(unsubscriber).then(() => { // The TCP Emitter client which broadcasted the event should not // be notified by the TCP Emitter server. assert.fail('TCP Emitter client that unsubscribed from an ' + 'event should not be notified') }).catch(done) // Broadcast payload to the event which the TCP Emitter clients // have subscribed to. broadcaster.write(payloadUtils.createBroadcast({ event })) }) }) }) }) }) }) }) describe('Scenario: Broadcasting multiple payloads with a single TCP request:', function () { describe('Given a TCP Emitter server,', function () { /** * TCP Emitter server. * @type {Object} */ let serverInst = null beforeEach(function () { // Create the TCP Emitter Server which the TCP Emitter clients will be // connecting to. return netUtils.createTCPEmitterServer().then(server => { serverInst = server }) }) afterEach(function () { return netUtils.closeTCPEmitterServer(serverInst) }) describe('with multiple connected TCP Emitter clients', function () { /** * TCP Emitter client that will be receiving the payload. * @type {net.Socket} */ let receiver = null /** * TCP Emitter client that will be broadcasting the payload. * @type {net.Socket} */ let broadcaster = null beforeEach(function () { // Create the TCP Emitter clients and connect them with the TCP // Emitter server for this test. return Promise.all([ netUtils.createTCPEmitterClient(serverInst.address()), netUtils.createTCPEmitterClient(serverInst.address()) ]).then(clients => { receiver = clients[0] broadcaster = clients[1] }) }) afterEach(function () { return Promise.all([ netUtils.closeTCPEmitterClient(receiver), netUtils.closeTCPEmitterClient(broadcaster) ]) }) describe('and one of which is subscribed to an event,', function () { /** * Name of the event which the TCP Emitter clients will be subscribing * & broadcasting to. * @type {string} */ let event = null beforeEach(function () { event = 'event-name' // Subscribe the TCP Emitter client which will serve as the // receiver. return netUtils.write(receiver, payloadUtils.createSubscribe({ event })) }) describe('when broadcasting multiple payloads with a single TCP request:', function () { /** * Arguments that will be broadcasted in the first payload. * @type {Array.<*>} */ let argsOne = null /** * Arguments that will be broadcasted in the second payload. * @type {Array.<*>} */ let argsTwo = null beforeEach(function () { argsOne = [ 1, '2', true, { name: 'luca' } ] argsTwo = [ 2, '3', false, { surname: 'tabone' } ] }) it('should broadcast all the payloads to the listeners of the event accordingly', function (done) { // Wait for any data sent by the TCP Emitter server. netUtils.waitForData(receiver).then(data => { // Parse the data retrieved from TCP Emitter server. const payloads = payloadUtils.parsePayload({ data }) // Assert that two payload was received. assert.strictEqual(payloads.length, 2) assert.deepStrictEqual(event, payloads[0].event) assert.deepStrictEqual(event, payloads[1].event) assert.deepStrictEqual(argsOne, payloads[0].args) assert.deepStrictEqual(argsTwo, payloads[1].args) done() }).catch(done) // Broadcast the first payload at the event which the receiver // TCP Emitter client is subscriibed to. broadcaster.write(payloadUtils .createBroadcast({ event, args: argsOne })) // Broadcast the second payload at the event which the receiver // TCP Emitter client is subscriibed to. broadcaster.write(payloadUtils .createBroadcast({ event, args: argsTwo })) }) }) }) }) }) }) })
tcp-emitter/server
test/tcp-emitter-server-test.js
JavaScript
isc
29,571
#!/usr/bin/env python3 def __safe_call(f, a): """Call a function and capture all exceptions.""" try: return f(a) except Exception as e: return "{}@{}({})".format(a.__class__.__name__, id(a), e) def __safe_error(msg, a, b): """Generate the error message for assert_XX without causing an error.""" return "{} ({}) {} {} ({})".format( __safe_call(str, a), __safe_call(repr, a), msg, __safe_call(str, b), __safe_call(repr, b), ) def assert_eq(a, b, msg=None): """Assert equal with better error message.""" assert a == b, msg or __safe_error("!=", a, b) def assert_not_in(needle, haystack, msg=None): """Assert equal with better error message.""" assert needle not in haystack, msg or __safe_error( "already in", needle, haystack ) def assert_is(a, b): """Assert is with better error message.""" assert a is b, __safe_error("is not", a, b) def assert_type( obj, cls, msg="{obj} ({obj!r}) should be a {cls}, not {objcls}" ): """Raise a type error if obj is not an instance of cls.""" if not isinstance(obj, cls): raise TypeError(msg.format(obj=obj, objcls=type(obj), cls=cls)) def assert_type_or_none(obj, classes): """Raise a type error if obj is not an instance of cls or None.""" if obj is not None: assert_type(obj, classes) def assert_len_eq(lists): """Check all lists in a list are equal length""" # Sanity check max_len = max(len(p) for p in lists) for i, p in enumerate(lists): assert len( p ) == max_len, "Length check failed!\nl[{}] has {} elements != {} ({!r})\n{!r}".format( i, len(p), max_len, p, lists )
SymbiFlow/symbiflow-arch-defs
utils/lib/asserts.py
Python
isc
1,746
export default { isMobile(window) { return window.innerWidth <= 420 }, generateTranslation(current, columnCount, elWidth, increment) { var position = current.position var value = current.value if (increment) { if (position < columnCount-1) { position = position + 1 } } else if (position > 0) { position = position - 1 } value = position ? `-${elWidth * position}px`: '0px' return { position: position, value: value } }, browserPrefix(attr, value) { var object = {} object[`-webkit-${attr}`] = value object[`-moz-${attr}`] = value object[`-o-${attr}`] = value return object }, stripeHeight() { const PRODUCT_HEADER_CLASS = 'product__header-menu' let bodyHeight = document.body.getBoundingClientRect().height let headerHeight = document.getElementsByClassName(PRODUCT_HEADER_CLASS)[0].getBoundingClientRect().height return bodyHeight - headerHeight } }
sprintly/sprintly-kanban
app/views/pages/helpers.js
JavaScript
isc
987
import React from 'react'; import { render } from 'react-dom'; import $ from 'jquery'; import IconAuthorAttrib from './subComponents/iconAuthorAttrib' import site_footer_switch from './helpers/site_footer_switch' export default class Foot extends React.Component { render(){ // console.log(this.props, 'was this.props in foot'); let resumeIconSrc = "./assets/icons/interface.svg" let portraitIconSrc = "./assets/icons/circle.svg" // let footStyle = let localListStyle = { listStyle: "none", // border: "1px solid black", paddingLeft: "0" } let localTextSize = { fontSize: "calc(5px + .3vh)", paddingLeft: "1px" } let iconAttrib; if(this.props.selectedLayout==="twitterMimic"){ iconAttrib = <div id="attribCollection" style={localTextSize} > <ul style={localListStyle}> <li><IconAuthorAttrib {...this.props} iconImg={resumeIconSrc} iconAuthorLink={"https://smashicons.com/"} /></li> <li><IconAuthorAttrib {...this.props} iconImg={portraitIconSrc} iconAuthorLink={"http://www.freepik.com/"} /></li> </ul> both authors found at <a href="https://www.flaticon.com">www.flaticon.com</a> </div> } else { iconAttrib = <div id="iconAttribNotNeeded"></div> } return( <div id="footContainer" style={site_footer_switch(this.props)} > {/*<div><a>webform to send me e-mails without giving out my email address?</a></div>*/} {iconAttrib} </div> ) } }
MelanistOnca/Pers
public/js/foot.js
JavaScript
isc
1,660
import React, { Component } from "react"; import { autobind } from "core-decorators"; import { DiscoverAddressesFormHeader as DiscoverAddressesHeader, DiscoverAddressesFormBody } from "./Form"; @autobind class DiscoverAddressesBody extends Component { constructor(props) { super(props); this.state = this.getInitialState(); } componentWillUnmount() { this.resetState(); } getInitialState() { return { passPhrase: "", hasAttemptedDiscover: false }; } render() { const { passPhrase, hasAttemptedDiscover } = this.state; const { onSetPassPhrase, onDiscoverAddresses, onKeyDown } = this; return ( <DiscoverAddressesFormBody {...{ ...this.props, passPhrase, hasAttemptedDiscover, onSetPassPhrase, onDiscoverAddresses, onKeyDown }} /> ); } resetState() { this.setState(this.getInitialState()); } onSetPassPhrase(passPhrase) { this.setState({ passPhrase }); } onDiscoverAddresses() { if (!this.state.passPhrase) { return this.setState({ hasAttemptedDiscover: true }); } this.props.onDiscoverAddresses(this.state.passPhrase); this.resetState(); } onKeyDown(e) { if(e.keyCode == 13) { // Enter key e.preventDefault(); this.onDiscoverAddresses(); } } } export { DiscoverAddressesHeader, DiscoverAddressesBody };
oktapodia/decrediton-appveyor-test
app/components/views/GetStartedPage/DiscoverAddresses/index.js
JavaScript
isc
1,439
'use strict'; module.exports = function(err, req, res, next) { let statusCode = err.statusCode || 500; let message = err.message || 'doh!'; let stack = err.stack || ''; res.status(statusCode).json({ message: message, stack: stack }); }
joerx/proto-ci
app/modules/api/error-handler.js
JavaScript
isc
256
// adopted from: https://github.com/fshost/node-dir // Copyright (c) 2012 Nathan Cartwright <fshost@yahoo.com> (MIT) var fs = require('fs') var path = require('path') var mm = require('../glob/minimatch') /** * merge two objects by extending target object with source object * @param target object to merge * @param source object to merge * @param {Boolean} [modify] whether to modify the target * @returns {Object} extended object */ function extend(target, source, modify) { var result = target ? modify ? target : extend({}, target, true) : {}; if (!source) return result; for (var key in source) { if (source.hasOwnProperty(key) && source[key] !== undefined) { result[key] = source[key]; } } return result; } /** * determine if a string is contained within an array or matches a regular expression * @param {String} str string to match * @param {Array|Regex} match array or regular expression to match against * @returns {Boolean} whether there is a match */ function matches(str, match) { if (Array.isArray(match)) { var l = match.length; for (var s = 0; s < l; s++) { if (mm(str, match[s])) { return true; } } return false; } return match.test(str); } /** * read files and call a function with the contents of each file * @param {String} dir path of dir containing the files to be read * @param {String} encoding file encoding (default is 'utf8') * @param {Object} options options hash for encoding, recursive, and match/exclude * @param {Function(error, string)} callback callback for each files content * @param {Function(error)} complete fn to call when finished */ function readFilesStream(dir, options, callback, complete) { if (typeof options === 'function') { complete = callback; callback = options; options = {}; } if (typeof options === 'string') options = { encoding: options }; options = extend({ recursive: true, encoding: 'utf8', doneOnErr: true }, options); var files = []; var done = function (err) { if (typeof complete === 'function') { if (err) return complete(err); complete(null, files); } }; fs.readdir(dir, function (err, list) { if (err) { if (options.doneOnErr === true) { if (err.code === 'EACCES') return done(); return done(err); } } var i = 0; if (options.reverse === true || (typeof options.sort == 'string' && (/reverse|desc/i).test(options.sort))) { list = list.reverse(); } else if (options.sort !== false) list = list.sort(); (function next() { var filename = list[i++]; if (!filename) return done(null, files); var file = path.join(dir, filename); fs.stat(file, function (err, stat) { if (err && options.doneOnErr === true) return done(err); if (stat && stat.isDirectory()) { if (options.recursive) { if (options.matchDir && !matches(filename, options.matchDir)) return next(); if (options.excludeDir && matches(filename, options.excludeDir)) return next(); readFilesStream(file, options, callback, function (err, sfiles) { if (err && options.doneOnErr === true) return done(err); files = files.concat(sfiles); next(); }); } else next(); } else if (stat && stat.isFile()) { if (options.match && !matches(filename, options.match)) return next(); if (options.exclude && matches(filename, options.exclude)) return next(); if (options.filter && !options.filter(filename)) return next(); if (options.shortName) files.push(filename); else files.push(file); var stream = fs.createReadStream(file); stream.setEncoding(options.encoding); stream.on('error', function (err) { if (options.doneOnErr === true) return done(err); next(); }); if (callback.length > 3) if (options.shortName) callback(null, stream, filename, next); else callback(null, stream, file, next); else callback(null, stream, next); } else { next(); } }); })(); }); } module.exports = readFilesStream;
akileez/toolz
src/stream/read-file-stream.js
JavaScript
isc
4,333
// Copyright 2012 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Defined when linking against shared lib on Windows. #if defined(USING_V8_SHARED) && !defined(V8_SHARED) #define V8_SHARED #endif #ifdef COMPRESS_STARTUP_DATA_BZ2 #include <bzlib.h> #endif #include <errno.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #ifdef V8_SHARED #include <assert.h> #endif // V8_SHARED #ifndef V8_SHARED #include <algorithm> #endif // !V8_SHARED #ifdef V8_SHARED #include "include/v8-testing.h" #endif // V8_SHARED #if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE) #include "src/gdb-jit.h" #endif #ifdef ENABLE_VTUNE_JIT_INTERFACE #include "src/third_party/vtune/v8-vtune.h" #endif #include "src/d8.h" #include "include/libplatform/libplatform.h" #ifndef V8_SHARED #include "src/api.h" #include "src/base/cpu.h" #include "src/base/logging.h" #include "src/base/platform/platform.h" #include "src/base/sys-info.h" #include "src/basic-block-profiler.h" #include "src/d8-debug.h" #include "src/debug.h" #include "src/natives.h" #include "src/v8.h" #endif // !V8_SHARED #if !defined(_WIN32) && !defined(_WIN64) #include <unistd.h> // NOLINT #else #include <windows.h> // NOLINT #if defined(_MSC_VER) #include <crtdbg.h> // NOLINT #endif // defined(_MSC_VER) #endif // !defined(_WIN32) && !defined(_WIN64) #ifndef DCHECK #define DCHECK(condition) assert(condition) #endif namespace v8 { static Handle<Value> Throw(Isolate* isolate, const char* message) { return isolate->ThrowException(String::NewFromUtf8(isolate, message)); } class PerIsolateData { public: explicit PerIsolateData(Isolate* isolate) : isolate_(isolate), realms_(NULL) { HandleScope scope(isolate); isolate->SetData(0, this); } ~PerIsolateData() { isolate_->SetData(0, NULL); // Not really needed, just to be sure... } inline static PerIsolateData* Get(Isolate* isolate) { return reinterpret_cast<PerIsolateData*>(isolate->GetData(0)); } class RealmScope { public: explicit RealmScope(PerIsolateData* data); ~RealmScope(); private: PerIsolateData* data_; }; private: friend class Shell; friend class RealmScope; Isolate* isolate_; int realm_count_; int realm_current_; int realm_switch_; Persistent<Context>* realms_; Persistent<Value> realm_shared_; int RealmIndexOrThrow(const v8::FunctionCallbackInfo<v8::Value>& args, int arg_offset); int RealmFind(Handle<Context> context); }; LineEditor *LineEditor::current_ = NULL; LineEditor::LineEditor(Type type, const char* name) : type_(type), name_(name) { if (current_ == NULL || current_->type_ < type) current_ = this; } class DumbLineEditor: public LineEditor { public: explicit DumbLineEditor(Isolate* isolate) : LineEditor(LineEditor::DUMB, "dumb"), isolate_(isolate) { } virtual Handle<String> Prompt(const char* prompt); private: Isolate* isolate_; }; Handle<String> DumbLineEditor::Prompt(const char* prompt) { printf("%s", prompt); #if defined(__native_client__) // Native Client libc is used to being embedded in Chrome and // has trouble recognizing when to flush. fflush(stdout); #endif return Shell::ReadFromStdin(isolate_); } #ifndef V8_SHARED CounterMap* Shell::counter_map_; base::OS::MemoryMappedFile* Shell::counters_file_ = NULL; CounterCollection Shell::local_counters_; CounterCollection* Shell::counters_ = &local_counters_; base::Mutex Shell::context_mutex_; const base::TimeTicks Shell::kInitialTicks = base::TimeTicks::HighResolutionNow(); Persistent<Context> Shell::utility_context_; #endif // !V8_SHARED Persistent<Context> Shell::evaluation_context_; ShellOptions Shell::options; const char* Shell::kPrompt = "d8> "; #ifndef V8_SHARED const int MB = 1024 * 1024; bool CounterMap::Match(void* key1, void* key2) { const char* name1 = reinterpret_cast<const char*>(key1); const char* name2 = reinterpret_cast<const char*>(key2); return strcmp(name1, name2) == 0; } #endif // !V8_SHARED // Converts a V8 value to a C string. const char* Shell::ToCString(const v8::String::Utf8Value& value) { return *value ? *value : "<string conversion failed>"; } // Compile a string within the current v8 context. Local<UnboundScript> Shell::CompileString( Isolate* isolate, Local<String> source, Local<Value> name, v8::ScriptCompiler::CompileOptions compile_options) { ScriptOrigin origin(name); ScriptCompiler::Source script_source(source, origin); Local<UnboundScript> script = ScriptCompiler::CompileUnbound(isolate, &script_source, compile_options); // Was caching requested & successful? Then compile again, now with cache. if (script_source.GetCachedData()) { if (compile_options == ScriptCompiler::kProduceCodeCache) { compile_options = ScriptCompiler::kConsumeCodeCache; } else if (compile_options == ScriptCompiler::kProduceParserCache) { compile_options = ScriptCompiler::kConsumeParserCache; } else { DCHECK(false); // A new compile option? } ScriptCompiler::Source cached_source( source, origin, new v8::ScriptCompiler::CachedData( script_source.GetCachedData()->data, script_source.GetCachedData()->length, v8::ScriptCompiler::CachedData::BufferNotOwned)); script = ScriptCompiler::CompileUnbound(isolate, &cached_source, compile_options); } return script; } // Executes a string within the current v8 context. bool Shell::ExecuteString(Isolate* isolate, Handle<String> source, Handle<Value> name, bool print_result, bool report_exceptions) { #ifndef V8_SHARED bool FLAG_debugger = i::FLAG_debugger; #else bool FLAG_debugger = false; #endif // !V8_SHARED HandleScope handle_scope(isolate); TryCatch try_catch; options.script_executed = true; if (FLAG_debugger) { // When debugging make exceptions appear to be uncaught. try_catch.SetVerbose(true); } Handle<UnboundScript> script = Shell::CompileString(isolate, source, name, options.compile_options); if (script.IsEmpty()) { // Print errors that happened during compilation. if (report_exceptions && !FLAG_debugger) ReportException(isolate, &try_catch); return false; } else { PerIsolateData* data = PerIsolateData::Get(isolate); Local<Context> realm = Local<Context>::New(isolate, data->realms_[data->realm_current_]); realm->Enter(); Handle<Value> result = script->BindToCurrentContext()->Run(); realm->Exit(); data->realm_current_ = data->realm_switch_; if (result.IsEmpty()) { DCHECK(try_catch.HasCaught()); // Print errors that happened during execution. if (report_exceptions && !FLAG_debugger) ReportException(isolate, &try_catch); return false; } else { DCHECK(!try_catch.HasCaught()); if (print_result) { #if !defined(V8_SHARED) if (options.test_shell) { #endif if (!result->IsUndefined()) { // If all went well and the result wasn't undefined then print // the returned value. v8::String::Utf8Value str(result); fwrite(*str, sizeof(**str), str.length(), stdout); printf("\n"); } #if !defined(V8_SHARED) } else { v8::TryCatch try_catch; v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, utility_context_); v8::Context::Scope context_scope(context); Handle<Object> global = context->Global(); Handle<Value> fun = global->Get(String::NewFromUtf8(isolate, "Stringify")); Handle<Value> argv[1] = { result }; Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv); if (try_catch.HasCaught()) return true; v8::String::Utf8Value str(s); fwrite(*str, sizeof(**str), str.length(), stdout); printf("\n"); } #endif } return true; } } } PerIsolateData::RealmScope::RealmScope(PerIsolateData* data) : data_(data) { data_->realm_count_ = 1; data_->realm_current_ = 0; data_->realm_switch_ = 0; data_->realms_ = new Persistent<Context>[1]; data_->realms_[0].Reset(data_->isolate_, data_->isolate_->GetEnteredContext()); } PerIsolateData::RealmScope::~RealmScope() { // Drop realms to avoid keeping them alive. for (int i = 0; i < data_->realm_count_; ++i) data_->realms_[i].Reset(); delete[] data_->realms_; if (!data_->realm_shared_.IsEmpty()) data_->realm_shared_.Reset(); } int PerIsolateData::RealmFind(Handle<Context> context) { for (int i = 0; i < realm_count_; ++i) { if (realms_[i] == context) return i; } return -1; } int PerIsolateData::RealmIndexOrThrow( const v8::FunctionCallbackInfo<v8::Value>& args, int arg_offset) { if (args.Length() < arg_offset || !args[arg_offset]->IsNumber()) { Throw(args.GetIsolate(), "Invalid argument"); return -1; } int index = args[arg_offset]->Int32Value(); if (index < 0 || index >= realm_count_ || realms_[index].IsEmpty()) { Throw(args.GetIsolate(), "Invalid realm index"); return -1; } return index; } #ifndef V8_SHARED // performance.now() returns a time stamp as double, measured in milliseconds. // When FLAG_verify_predictable mode is enabled it returns current value // of Heap::allocations_count(). void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) { if (i::FLAG_verify_predictable) { Isolate* v8_isolate = args.GetIsolate(); i::Heap* heap = reinterpret_cast<i::Isolate*>(v8_isolate)->heap(); args.GetReturnValue().Set(heap->synthetic_time()); } else { base::TimeDelta delta = base::TimeTicks::HighResolutionNow() - kInitialTicks; args.GetReturnValue().Set(delta.InMillisecondsF()); } } #endif // !V8_SHARED // Realm.current() returns the index of the currently active realm. void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); int index = data->RealmFind(isolate->GetEnteredContext()); if (index == -1) return; args.GetReturnValue().Set(index); } // Realm.owner(o) returns the index of the realm that created o. void Shell::RealmOwner(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); if (args.Length() < 1 || !args[0]->IsObject()) { Throw(args.GetIsolate(), "Invalid argument"); return; } int index = data->RealmFind(args[0]->ToObject()->CreationContext()); if (index == -1) return; args.GetReturnValue().Set(index); } // Realm.global(i) returns the global object of realm i. // (Note that properties of global objects cannot be read/written cross-realm.) void Shell::RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) { PerIsolateData* data = PerIsolateData::Get(args.GetIsolate()); int index = data->RealmIndexOrThrow(args, 0); if (index == -1) return; args.GetReturnValue().Set( Local<Context>::New(args.GetIsolate(), data->realms_[index])->Global()); } // Realm.create() creates a new realm and returns its index. void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); Persistent<Context>* old_realms = data->realms_; int index = data->realm_count_; data->realms_ = new Persistent<Context>[++data->realm_count_]; for (int i = 0; i < index; ++i) { data->realms_[i].Reset(isolate, old_realms[i]); } delete[] old_realms; Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); data->realms_[index].Reset( isolate, Context::New(isolate, NULL, global_template)); args.GetReturnValue().Set(index); } // Realm.dispose(i) disposes the reference to the realm i. void Shell::RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); int index = data->RealmIndexOrThrow(args, 0); if (index == -1) return; if (index == 0 || index == data->realm_current_ || index == data->realm_switch_) { Throw(args.GetIsolate(), "Invalid realm index"); return; } data->realms_[index].Reset(); } // Realm.switch(i) switches to the realm i for consecutive interactive inputs. void Shell::RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); int index = data->RealmIndexOrThrow(args, 0); if (index == -1) return; data->realm_switch_ = index; } // Realm.eval(i, s) evaluates s in realm i and returns the result. void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) { Isolate* isolate = args.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); int index = data->RealmIndexOrThrow(args, 0); if (index == -1) return; if (args.Length() < 2 || !args[1]->IsString()) { Throw(args.GetIsolate(), "Invalid argument"); return; } ScriptCompiler::Source script_source(args[1]->ToString()); Handle<UnboundScript> script = ScriptCompiler::CompileUnbound( isolate, &script_source); if (script.IsEmpty()) return; Local<Context> realm = Local<Context>::New(isolate, data->realms_[index]); realm->Enter(); Handle<Value> result = script->BindToCurrentContext()->Run(); realm->Exit(); args.GetReturnValue().Set(result); } // Realm.shared is an accessor for a single shared value across realms. void Shell::RealmSharedGet(Local<String> property, const PropertyCallbackInfo<Value>& info) { Isolate* isolate = info.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); if (data->realm_shared_.IsEmpty()) return; info.GetReturnValue().Set(data->realm_shared_); } void Shell::RealmSharedSet(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info) { Isolate* isolate = info.GetIsolate(); PerIsolateData* data = PerIsolateData::Get(isolate); data->realm_shared_.Reset(isolate, value); } void Shell::Print(const v8::FunctionCallbackInfo<v8::Value>& args) { Write(args); printf("\n"); fflush(stdout); } void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) { for (int i = 0; i < args.Length(); i++) { HandleScope handle_scope(args.GetIsolate()); if (i != 0) { printf(" "); } // Explicitly catch potential exceptions in toString(). v8::TryCatch try_catch; Handle<String> str_obj = args[i]->ToString(); if (try_catch.HasCaught()) { try_catch.ReThrow(); return; } v8::String::Utf8Value str(str_obj); int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); if (n != str.length()) { printf("Error in fwrite\n"); Exit(1); } } } void Shell::Read(const v8::FunctionCallbackInfo<v8::Value>& args) { String::Utf8Value file(args[0]); if (*file == NULL) { Throw(args.GetIsolate(), "Error loading file"); return; } Handle<String> source = ReadFile(args.GetIsolate(), *file); if (source.IsEmpty()) { Throw(args.GetIsolate(), "Error loading file"); return; } args.GetReturnValue().Set(source); } Handle<String> Shell::ReadFromStdin(Isolate* isolate) { static const int kBufferSize = 256; char buffer[kBufferSize]; Handle<String> accumulator = String::NewFromUtf8(isolate, ""); int length; while (true) { // Continue reading if the line ends with an escape '\\' or the line has // not been fully read into the buffer yet (does not end with '\n'). // If fgets gets an error, just give up. char* input = NULL; input = fgets(buffer, kBufferSize, stdin); if (input == NULL) return Handle<String>(); length = static_cast<int>(strlen(buffer)); if (length == 0) { return accumulator; } else if (buffer[length-1] != '\n') { accumulator = String::Concat( accumulator, String::NewFromUtf8(isolate, buffer, String::kNormalString, length)); } else if (length > 1 && buffer[length-2] == '\\') { buffer[length-2] = '\n'; accumulator = String::Concat( accumulator, String::NewFromUtf8(isolate, buffer, String::kNormalString, length - 1)); } else { return String::Concat( accumulator, String::NewFromUtf8(isolate, buffer, String::kNormalString, length - 1)); } } } void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) { for (int i = 0; i < args.Length(); i++) { HandleScope handle_scope(args.GetIsolate()); String::Utf8Value file(args[i]); if (*file == NULL) { Throw(args.GetIsolate(), "Error loading file"); return; } Handle<String> source = ReadFile(args.GetIsolate(), *file); if (source.IsEmpty()) { Throw(args.GetIsolate(), "Error loading file"); return; } if (!ExecuteString(args.GetIsolate(), source, String::NewFromUtf8(args.GetIsolate(), *file), false, true)) { Throw(args.GetIsolate(), "Error executing file"); return; } } } void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { int exit_code = args[0]->Int32Value(); OnExit(); exit(exit_code); } void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set( String::NewFromUtf8(args.GetIsolate(), V8::GetVersion())); } void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { HandleScope handle_scope(isolate); #ifndef V8_SHARED Handle<Context> utility_context; bool enter_context = !isolate->InContext(); if (enter_context) { utility_context = Local<Context>::New(isolate, utility_context_); utility_context->Enter(); } #endif // !V8_SHARED v8::String::Utf8Value exception(try_catch->Exception()); const char* exception_string = ToCString(exception); Handle<Message> message = try_catch->Message(); if (message.IsEmpty()) { // V8 didn't provide any extra information about this error; just // print the exception. printf("%s\n", exception_string); } else { // Print (filename):(line number): (message). v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); const char* filename_string = ToCString(filename); int linenum = message->GetLineNumber(); printf("%s:%i: %s\n", filename_string, linenum, exception_string); // Print line of source code. v8::String::Utf8Value sourceline(message->GetSourceLine()); const char* sourceline_string = ToCString(sourceline); printf("%s\n", sourceline_string); // Print wavy underline (GetUnderline is deprecated). int start = message->GetStartColumn(); for (int i = 0; i < start; i++) { printf(" "); } int end = message->GetEndColumn(); for (int i = start; i < end; i++) { printf("^"); } printf("\n"); v8::String::Utf8Value stack_trace(try_catch->StackTrace()); if (stack_trace.length() > 0) { const char* stack_trace_string = ToCString(stack_trace); printf("%s\n", stack_trace_string); } } printf("\n"); #ifndef V8_SHARED if (enter_context) utility_context->Exit(); #endif // !V8_SHARED } #ifndef V8_SHARED Handle<Array> Shell::GetCompletions(Isolate* isolate, Handle<String> text, Handle<String> full) { EscapableHandleScope handle_scope(isolate); v8::Local<v8::Context> utility_context = v8::Local<v8::Context>::New(isolate, utility_context_); v8::Context::Scope context_scope(utility_context); Handle<Object> global = utility_context->Global(); Local<Value> fun = global->Get(String::NewFromUtf8(isolate, "GetCompletions")); static const int kArgc = 3; v8::Local<v8::Context> evaluation_context = v8::Local<v8::Context>::New(isolate, evaluation_context_); Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full }; Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv); return handle_scope.Escape(Local<Array>::Cast(val)); } Local<Object> Shell::DebugMessageDetails(Isolate* isolate, Handle<String> message) { EscapableHandleScope handle_scope(isolate); v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, utility_context_); v8::Context::Scope context_scope(context); Handle<Object> global = context->Global(); Handle<Value> fun = global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails")); static const int kArgc = 1; Handle<Value> argv[kArgc] = { message }; Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); return handle_scope.Escape(Local<Object>(Handle<Object>::Cast(val))); } Local<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate, Handle<String> command) { EscapableHandleScope handle_scope(isolate); v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, utility_context_); v8::Context::Scope context_scope(context); Handle<Object> global = context->Global(); Handle<Value> fun = global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest")); static const int kArgc = 1; Handle<Value> argv[kArgc] = { command }; Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); return handle_scope.Escape(Local<Value>(val)); } int32_t* Counter::Bind(const char* name, bool is_histogram) { int i; for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) name_[i] = static_cast<char>(name[i]); name_[i] = '\0'; is_histogram_ = is_histogram; return ptr(); } void Counter::AddSample(int32_t sample) { count_++; sample_total_ += sample; } CounterCollection::CounterCollection() { magic_number_ = 0xDEADFACE; max_counters_ = kMaxCounters; max_name_size_ = Counter::kMaxNameSize; counters_in_use_ = 0; } Counter* CounterCollection::GetNextCounter() { if (counters_in_use_ == kMaxCounters) return NULL; return &counters_[counters_in_use_++]; } void Shell::MapCounters(v8::Isolate* isolate, const char* name) { counters_file_ = base::OS::MemoryMappedFile::create( name, sizeof(CounterCollection), &local_counters_); void* memory = (counters_file_ == NULL) ? NULL : counters_file_->memory(); if (memory == NULL) { printf("Could not map counters file %s\n", name); Exit(1); } counters_ = static_cast<CounterCollection*>(memory); isolate->SetCounterFunction(LookupCounter); isolate->SetCreateHistogramFunction(CreateHistogram); isolate->SetAddHistogramSampleFunction(AddHistogramSample); } int CounterMap::Hash(const char* name) { int h = 0; int c; while ((c = *name++) != 0) { h += h << 5; h += c; } return h; } Counter* Shell::GetCounter(const char* name, bool is_histogram) { Counter* counter = counter_map_->Lookup(name); if (counter == NULL) { counter = counters_->GetNextCounter(); if (counter != NULL) { counter_map_->Set(name, counter); counter->Bind(name, is_histogram); } } else { DCHECK(counter->is_histogram() == is_histogram); } return counter; } int* Shell::LookupCounter(const char* name) { Counter* counter = GetCounter(name, false); if (counter != NULL) { return counter->ptr(); } else { return NULL; } } void* Shell::CreateHistogram(const char* name, int min, int max, size_t buckets) { return GetCounter(name, true); } void Shell::AddHistogramSample(void* histogram, int sample) { Counter* counter = reinterpret_cast<Counter*>(histogram); counter->AddSample(sample); } void Shell::InstallUtilityScript(Isolate* isolate) { HandleScope scope(isolate); // If we use the utility context, we have to set the security tokens so that // utility, evaluation and debug context can all access each other. v8::Local<v8::Context> utility_context = v8::Local<v8::Context>::New(isolate, utility_context_); v8::Local<v8::Context> evaluation_context = v8::Local<v8::Context>::New(isolate, evaluation_context_); utility_context->SetSecurityToken(Undefined(isolate)); evaluation_context->SetSecurityToken(Undefined(isolate)); v8::Context::Scope context_scope(utility_context); if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); // Install the debugger object in the utility scope i::Debug* debug = reinterpret_cast<i::Isolate*>(isolate)->debug(); debug->Load(); i::Handle<i::Context> debug_context = debug->debug_context(); i::Handle<i::JSObject> js_debug = i::Handle<i::JSObject>(debug_context->global_object()); utility_context->Global()->Set(String::NewFromUtf8(isolate, "$debug"), Utils::ToLocal(js_debug)); debug_context->set_security_token( reinterpret_cast<i::Isolate*>(isolate)->heap()->undefined_value()); // Run the d8 shell utility script in the utility context int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); i::Vector<const char> shell_source = i::NativesCollection<i::D8>::GetRawScriptSource(source_index); i::Vector<const char> shell_source_name = i::NativesCollection<i::D8>::GetScriptName(source_index); Handle<String> source = String::NewFromUtf8(isolate, shell_source.start(), String::kNormalString, shell_source.length()); Handle<String> name = String::NewFromUtf8(isolate, shell_source_name.start(), String::kNormalString, shell_source_name.length()); ScriptOrigin origin(name); Handle<Script> script = Script::Compile(source, &origin); script->Run(); // Mark the d8 shell script as native to avoid it showing up as normal source // in the debugger. i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); i::Handle<i::Script> script_object = compiled_script->IsJSFunction() ? i::Handle<i::Script>(i::Script::cast( i::JSFunction::cast(*compiled_script)->shared()->script())) : i::Handle<i::Script>(i::Script::cast( i::SharedFunctionInfo::cast(*compiled_script)->script())); script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); // Start the in-process debugger if requested. if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent); } #endif // !V8_SHARED #ifdef COMPRESS_STARTUP_DATA_BZ2 class BZip2Decompressor : public v8::StartupDataDecompressor { public: virtual ~BZip2Decompressor() { } protected: virtual int DecompressData(char* raw_data, int* raw_data_size, const char* compressed_data, int compressed_data_size) { DCHECK_EQ(v8::StartupData::kBZip2, v8::V8::GetCompressedStartupDataAlgorithm()); unsigned int decompressed_size = *raw_data_size; int result = BZ2_bzBuffToBuffDecompress(raw_data, &decompressed_size, const_cast<char*>(compressed_data), compressed_data_size, 0, 1); if (result == BZ_OK) { *raw_data_size = decompressed_size; } return result; } }; #endif Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); global_template->Set(String::NewFromUtf8(isolate, "print"), FunctionTemplate::New(isolate, Print)); global_template->Set(String::NewFromUtf8(isolate, "write"), FunctionTemplate::New(isolate, Write)); global_template->Set(String::NewFromUtf8(isolate, "read"), FunctionTemplate::New(isolate, Read)); global_template->Set(String::NewFromUtf8(isolate, "readbuffer"), FunctionTemplate::New(isolate, ReadBuffer)); global_template->Set(String::NewFromUtf8(isolate, "readline"), FunctionTemplate::New(isolate, ReadLine)); global_template->Set(String::NewFromUtf8(isolate, "load"), FunctionTemplate::New(isolate, Load)); global_template->Set(String::NewFromUtf8(isolate, "quit"), FunctionTemplate::New(isolate, Quit)); global_template->Set(String::NewFromUtf8(isolate, "version"), FunctionTemplate::New(isolate, Version)); // Bind the Realm object. Handle<ObjectTemplate> realm_template = ObjectTemplate::New(isolate); realm_template->Set(String::NewFromUtf8(isolate, "current"), FunctionTemplate::New(isolate, RealmCurrent)); realm_template->Set(String::NewFromUtf8(isolate, "owner"), FunctionTemplate::New(isolate, RealmOwner)); realm_template->Set(String::NewFromUtf8(isolate, "global"), FunctionTemplate::New(isolate, RealmGlobal)); realm_template->Set(String::NewFromUtf8(isolate, "create"), FunctionTemplate::New(isolate, RealmCreate)); realm_template->Set(String::NewFromUtf8(isolate, "dispose"), FunctionTemplate::New(isolate, RealmDispose)); realm_template->Set(String::NewFromUtf8(isolate, "switch"), FunctionTemplate::New(isolate, RealmSwitch)); realm_template->Set(String::NewFromUtf8(isolate, "eval"), FunctionTemplate::New(isolate, RealmEval)); realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"), RealmSharedGet, RealmSharedSet); global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template); #ifndef V8_SHARED Handle<ObjectTemplate> performance_template = ObjectTemplate::New(isolate); performance_template->Set(String::NewFromUtf8(isolate, "now"), FunctionTemplate::New(isolate, PerformanceNow)); global_template->Set(String::NewFromUtf8(isolate, "performance"), performance_template); #endif // !V8_SHARED Handle<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); AddOSMethods(isolate, os_templ); global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ); return global_template; } void Shell::Initialize(Isolate* isolate) { #ifdef COMPRESS_STARTUP_DATA_BZ2 BZip2Decompressor startup_data_decompressor; int bz2_result = startup_data_decompressor.Decompress(); if (bz2_result != BZ_OK) { fprintf(stderr, "bzip error code: %d\n", bz2_result); Exit(1); } #endif #ifndef V8_SHARED Shell::counter_map_ = new CounterMap(); // Set up counters if (i::StrLength(i::FLAG_map_counters) != 0) MapCounters(isolate, i::FLAG_map_counters); if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) { isolate->SetCounterFunction(LookupCounter); isolate->SetCreateHistogramFunction(CreateHistogram); isolate->SetAddHistogramSampleFunction(AddHistogramSample); } #endif // !V8_SHARED } void Shell::InitializeDebugger(Isolate* isolate) { if (options.test_shell) return; #ifndef V8_SHARED HandleScope scope(isolate); Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); utility_context_.Reset(isolate, Context::New(isolate, NULL, global_template)); #endif // !V8_SHARED } Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { #ifndef V8_SHARED // This needs to be a critical section since this is not thread-safe base::LockGuard<base::Mutex> lock_guard(&context_mutex_); #endif // !V8_SHARED // Initialize the global objects Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); EscapableHandleScope handle_scope(isolate); Local<Context> context = Context::New(isolate, NULL, global_template); DCHECK(!context.IsEmpty()); Context::Scope scope(context); #ifndef V8_SHARED i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory(); i::JSArguments js_args = i::FLAG_js_arguments; i::Handle<i::FixedArray> arguments_array = factory->NewFixedArray(js_args.argc); for (int j = 0; j < js_args.argc; j++) { i::Handle<i::String> arg = factory->NewStringFromUtf8(i::CStrVector(js_args[j])).ToHandleChecked(); arguments_array->set(j, *arg); } i::Handle<i::JSArray> arguments_jsarray = factory->NewJSArrayWithElements(arguments_array); context->Global()->Set(String::NewFromUtf8(isolate, "arguments"), Utils::ToLocal(arguments_jsarray)); #endif // !V8_SHARED return handle_scope.Escape(context); } void Shell::Exit(int exit_code) { // Use _exit instead of exit to avoid races between isolate // threads and static destructors. fflush(stdout); fflush(stderr); _exit(exit_code); } #ifndef V8_SHARED struct CounterAndKey { Counter* counter; const char* key; }; inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) { return strcmp(lhs.key, rhs.key) < 0; } #endif // !V8_SHARED void Shell::OnExit() { LineEditor* line_editor = LineEditor::Get(); if (line_editor) line_editor->Close(); #ifndef V8_SHARED if (i::FLAG_dump_counters) { int number_of_counters = 0; for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { number_of_counters++; } CounterAndKey* counters = new CounterAndKey[number_of_counters]; int j = 0; for (CounterMap::Iterator i(counter_map_); i.More(); i.Next(), j++) { counters[j].counter = i.CurrentValue(); counters[j].key = i.CurrentKey(); } std::sort(counters, counters + number_of_counters); printf("+----------------------------------------------------------------+" "-------------+\n"); printf("| Name |" " Value |\n"); printf("+----------------------------------------------------------------+" "-------------+\n"); for (j = 0; j < number_of_counters; j++) { Counter* counter = counters[j].counter; const char* key = counters[j].key; if (counter->is_histogram()) { printf("| c:%-60s | %11i |\n", key, counter->count()); printf("| t:%-60s | %11i |\n", key, counter->sample_total()); } else { printf("| %-62s | %11i |\n", key, counter->count()); } } printf("+----------------------------------------------------------------+" "-------------+\n"); delete [] counters; } delete counters_file_; delete counter_map_; #endif // !V8_SHARED } static FILE* FOpen(const char* path, const char* mode) { #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) FILE* result; if (fopen_s(&result, path, mode) == 0) { return result; } else { return NULL; } #else FILE* file = fopen(path, mode); if (file == NULL) return NULL; struct stat file_stat; if (fstat(fileno(file), &file_stat) != 0) return NULL; bool is_regular_file = ((file_stat.st_mode & S_IFREG) != 0); if (is_regular_file) return file; fclose(file); return NULL; #endif } static char* ReadChars(Isolate* isolate, const char* name, int* size_out) { FILE* file = FOpen(name, "rb"); if (file == NULL) return NULL; fseek(file, 0, SEEK_END); int size = ftell(file); rewind(file); char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); *size_out = size; return chars; } struct DataAndPersistent { uint8_t* data; Persistent<ArrayBuffer> handle; }; static void ReadBufferWeakCallback( const v8::WeakCallbackData<ArrayBuffer, DataAndPersistent>& data) { size_t byte_length = data.GetValue()->ByteLength(); data.GetIsolate()->AdjustAmountOfExternalAllocatedMemory( -static_cast<intptr_t>(byte_length)); delete[] data.GetParameter()->data; data.GetParameter()->handle.Reset(); delete data.GetParameter(); } void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) { DCHECK(sizeof(char) == sizeof(uint8_t)); // NOLINT String::Utf8Value filename(args[0]); int length; if (*filename == NULL) { Throw(args.GetIsolate(), "Error loading file"); return; } Isolate* isolate = args.GetIsolate(); DataAndPersistent* data = new DataAndPersistent; data->data = reinterpret_cast<uint8_t*>( ReadChars(args.GetIsolate(), *filename, &length)); if (data->data == NULL) { delete data; Throw(args.GetIsolate(), "Error reading file"); return; } Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data->data, length); data->handle.Reset(isolate, buffer); data->handle.SetWeak(data, ReadBufferWeakCallback); data->handle.MarkIndependent(); isolate->AdjustAmountOfExternalAllocatedMemory(length); args.GetReturnValue().Set(buffer); } // Reads a file into a v8 string. Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { int size = 0; char* chars = ReadChars(isolate, name, &size); if (chars == NULL) return Handle<String>(); Handle<String> result = String::NewFromUtf8(isolate, chars, String::kNormalString, size); delete[] chars; return result; } void Shell::RunShell(Isolate* isolate) { HandleScope outer_scope(isolate); v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, evaluation_context_); v8::Context::Scope context_scope(context); PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate)); Handle<String> name = String::NewFromUtf8(isolate, "(d8)"); LineEditor* console = LineEditor::Get(); printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name()); console->Open(isolate); while (true) { HandleScope inner_scope(isolate); Handle<String> input = console->Prompt(Shell::kPrompt); if (input.IsEmpty()) break; ExecuteString(isolate, input, name, true, true); } printf("\n"); } SourceGroup::~SourceGroup() { #ifndef V8_SHARED delete thread_; thread_ = NULL; #endif // !V8_SHARED } void SourceGroup::Execute(Isolate* isolate) { bool exception_was_thrown = false; for (int i = begin_offset_; i < end_offset_; ++i) { const char* arg = argv_[i]; if (strcmp(arg, "-e") == 0 && i + 1 < end_offset_) { // Execute argument given to -e option directly. HandleScope handle_scope(isolate); Handle<String> file_name = String::NewFromUtf8(isolate, "unnamed"); Handle<String> source = String::NewFromUtf8(isolate, argv_[i + 1]); if (!Shell::ExecuteString(isolate, source, file_name, false, true)) { exception_was_thrown = true; break; } ++i; } else if (arg[0] == '-') { // Ignore other options. They have been parsed already. } else { // Use all other arguments as names of files to load and run. HandleScope handle_scope(isolate); Handle<String> file_name = String::NewFromUtf8(isolate, arg); Handle<String> source = ReadFile(isolate, arg); if (source.IsEmpty()) { printf("Error reading '%s'\n", arg); Shell::Exit(1); } if (!Shell::ExecuteString(isolate, source, file_name, false, true)) { exception_was_thrown = true; break; } } } if (exception_was_thrown != Shell::options.expected_to_throw) { Shell::Exit(1); } } Handle<String> SourceGroup::ReadFile(Isolate* isolate, const char* name) { int size; char* chars = ReadChars(isolate, name, &size); if (chars == NULL) return Handle<String>(); Handle<String> result = String::NewFromUtf8(isolate, chars, String::kNormalString, size); delete[] chars; return result; } #ifndef V8_SHARED base::Thread::Options SourceGroup::GetThreadOptions() { // On some systems (OSX 10.6) the stack size default is 0.5Mb or less // which is not enough to parse the big literal expressions used in tests. // The stack size should be at least StackGuard::kLimitSize + some // OS-specific padding for thread startup code. 2Mbytes seems to be enough. return base::Thread::Options("IsolateThread", 2 * MB); } void SourceGroup::ExecuteInThread() { Isolate* isolate = Isolate::New(); do { next_semaphore_.Wait(); { Isolate::Scope iscope(isolate); { HandleScope scope(isolate); PerIsolateData data(isolate); Local<Context> context = Shell::CreateEvaluationContext(isolate); { Context::Scope cscope(context); PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate)); Execute(isolate); } } if (Shell::options.send_idle_notification) { const int kLongIdlePauseInMs = 1000; isolate->ContextDisposedNotification(); isolate->IdleNotification(kLongIdlePauseInMs); } if (Shell::options.invoke_weak_callbacks) { // By sending a low memory notifications, we will try hard to collect // all garbage and will therefore also invoke all weak callbacks of // actually unreachable persistent handles. isolate->LowMemoryNotification(); } } done_semaphore_.Signal(); } while (!Shell::options.last_run); isolate->Dispose(); } void SourceGroup::StartExecuteInThread() { if (thread_ == NULL) { thread_ = new IsolateThread(this); thread_->Start(); } next_semaphore_.Signal(); } void SourceGroup::WaitForThread() { if (thread_ == NULL) return; if (Shell::options.last_run) { thread_->Join(); } else { done_semaphore_.Wait(); } } #endif // !V8_SHARED void SetFlagsFromString(const char* flags) { v8::V8::SetFlagsFromString(flags, static_cast<int>(strlen(flags))); } bool Shell::SetOptions(int argc, char* argv[]) { bool logfile_per_isolate = false; for (int i = 0; i < argc; i++) { if (strcmp(argv[i], "--stress-opt") == 0) { options.stress_opt = true; argv[i] = NULL; } else if (strcmp(argv[i], "--nostress-opt") == 0) { options.stress_opt = false; argv[i] = NULL; } else if (strcmp(argv[i], "--stress-deopt") == 0) { options.stress_deopt = true; argv[i] = NULL; } else if (strcmp(argv[i], "--mock-arraybuffer-allocator") == 0) { options.mock_arraybuffer_allocator = true; argv[i] = NULL; } else if (strcmp(argv[i], "--noalways-opt") == 0) { // No support for stressing if we can't use --always-opt. options.stress_opt = false; options.stress_deopt = false; } else if (strcmp(argv[i], "--logfile-per-isolate") == 0) { logfile_per_isolate = true; argv[i] = NULL; } else if (strcmp(argv[i], "--shell") == 0) { options.interactive_shell = true; argv[i] = NULL; } else if (strcmp(argv[i], "--test") == 0) { options.test_shell = true; argv[i] = NULL; } else if (strcmp(argv[i], "--send-idle-notification") == 0) { options.send_idle_notification = true; argv[i] = NULL; } else if (strcmp(argv[i], "--invoke-weak-callbacks") == 0) { options.invoke_weak_callbacks = true; // TODO(jochen) See issue 3351 options.send_idle_notification = true; argv[i] = NULL; } else if (strcmp(argv[i], "-f") == 0) { // Ignore any -f flags for compatibility with other stand-alone // JavaScript engines. continue; } else if (strcmp(argv[i], "--isolate") == 0) { #ifdef V8_SHARED printf("D8 with shared library does not support multi-threading\n"); return false; #endif // V8_SHARED options.num_isolates++; } else if (strcmp(argv[i], "--dump-heap-constants") == 0) { #ifdef V8_SHARED printf("D8 with shared library does not support constant dumping\n"); return false; #else options.dump_heap_constants = true; argv[i] = NULL; #endif // V8_SHARED } else if (strcmp(argv[i], "--throws") == 0) { options.expected_to_throw = true; argv[i] = NULL; } else if (strncmp(argv[i], "--icu-data-file=", 16) == 0) { options.icu_data_file = argv[i] + 16; argv[i] = NULL; #ifdef V8_SHARED } else if (strcmp(argv[i], "--dump-counters") == 0) { printf("D8 with shared library does not include counters\n"); return false; } else if (strcmp(argv[i], "--debugger") == 0) { printf("Javascript debugger not included\n"); return false; #endif // V8_SHARED #ifdef V8_USE_EXTERNAL_STARTUP_DATA } else if (strncmp(argv[i], "--natives_blob=", 15) == 0) { options.natives_blob = argv[i] + 15; argv[i] = NULL; } else if (strncmp(argv[i], "--snapshot_blob=", 16) == 0) { options.snapshot_blob = argv[i] + 16; argv[i] = NULL; #endif // V8_USE_EXTERNAL_STARTUP_DATA } else if (strcmp(argv[i], "--cache") == 0 || strncmp(argv[i], "--cache=", 8) == 0) { const char* value = argv[i] + 7; if (!*value || strncmp(value, "=code", 6) == 0) { options.compile_options = v8::ScriptCompiler::kProduceCodeCache; } else if (strncmp(value, "=parse", 7) == 0) { options.compile_options = v8::ScriptCompiler::kProduceParserCache; } else if (strncmp(value, "=none", 6) == 0) { options.compile_options = v8::ScriptCompiler::kNoCompileOptions; } else { printf("Unknown option to --cache.\n"); return false; } argv[i] = NULL; } } v8::V8::SetFlagsFromCommandLine(&argc, argv, true); // Set up isolated source groups. options.isolate_sources = new SourceGroup[options.num_isolates]; SourceGroup* current = options.isolate_sources; current->Begin(argv, 1); for (int i = 1; i < argc; i++) { const char* str = argv[i]; if (strcmp(str, "--isolate") == 0) { current->End(i); current++; current->Begin(argv, i + 1); } else if (strncmp(argv[i], "--", 2) == 0) { printf("Warning: unknown flag %s.\nTry --help for options\n", argv[i]); } } current->End(argc); if (!logfile_per_isolate && options.num_isolates) { SetFlagsFromString("--nologfile_per_isolate"); } return true; } int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { #ifndef V8_SHARED for (int i = 1; i < options.num_isolates; ++i) { options.isolate_sources[i].StartExecuteInThread(); } #endif // !V8_SHARED { HandleScope scope(isolate); Local<Context> context = CreateEvaluationContext(isolate); if (options.last_run && options.use_interactive_shell()) { // Keep using the same context in the interactive shell. evaluation_context_.Reset(isolate, context); #ifndef V8_SHARED // If the interactive debugger is enabled make sure to activate // it before running the files passed on the command line. if (i::FLAG_debugger) { InstallUtilityScript(isolate); } #endif // !V8_SHARED } { Context::Scope cscope(context); PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate)); options.isolate_sources[0].Execute(isolate); } } if (options.send_idle_notification) { const int kLongIdlePauseInMs = 1000; isolate->ContextDisposedNotification(); isolate->IdleNotification(kLongIdlePauseInMs); } if (options.invoke_weak_callbacks) { // By sending a low memory notifications, we will try hard to collect all // garbage and will therefore also invoke all weak callbacks of actually // unreachable persistent handles. isolate->LowMemoryNotification(); } #ifndef V8_SHARED for (int i = 1; i < options.num_isolates; ++i) { options.isolate_sources[i].WaitForThread(); } #endif // !V8_SHARED return 0; } #ifndef V8_SHARED static void DumpHeapConstants(i::Isolate* isolate) { i::Heap* heap = isolate->heap(); // Dump the INSTANCE_TYPES table to the console. printf("# List of known V8 instance types.\n"); #define DUMP_TYPE(T) printf(" %d: \"%s\",\n", i::T, #T); printf("INSTANCE_TYPES = {\n"); INSTANCE_TYPE_LIST(DUMP_TYPE) printf("}\n"); #undef DUMP_TYPE // Dump the KNOWN_MAP table to the console. printf("\n# List of known V8 maps.\n"); #define ROOT_LIST_CASE(type, name, camel_name) \ if (n == NULL && o == heap->name()) n = #camel_name; #define STRUCT_LIST_CASE(upper_name, camel_name, name) \ if (n == NULL && o == heap->name##_map()) n = #camel_name "Map"; i::HeapObjectIterator it(heap->map_space()); printf("KNOWN_MAPS = {\n"); for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { i::Map* m = i::Map::cast(o); const char* n = NULL; intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff; int t = m->instance_type(); ROOT_LIST(ROOT_LIST_CASE) STRUCT_LIST(STRUCT_LIST_CASE) if (n == NULL) continue; printf(" 0x%05" V8PRIxPTR ": (%d, \"%s\"),\n", p, t, n); } printf("}\n"); #undef STRUCT_LIST_CASE #undef ROOT_LIST_CASE // Dump the KNOWN_OBJECTS table to the console. printf("\n# List of known V8 objects.\n"); #define ROOT_LIST_CASE(type, name, camel_name) \ if (n == NULL && o == heap->name()) n = #camel_name; i::OldSpaces spit(heap); printf("KNOWN_OBJECTS = {\n"); for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) { i::HeapObjectIterator it(s); const char* sname = AllocationSpaceName(s->identity()); for (i::Object* o = it.Next(); o != NULL; o = it.Next()) { const char* n = NULL; intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff; ROOT_LIST(ROOT_LIST_CASE) if (n == NULL) continue; printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n); } } printf("}\n"); #undef ROOT_LIST_CASE } #endif // !V8_SHARED class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t length) { void* data = AllocateUninitialized(length); return data == NULL ? data : memset(data, 0, length); } virtual void* AllocateUninitialized(size_t length) { return malloc(length); } virtual void Free(void* data, size_t) { free(data); } }; class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t) OVERRIDE { return malloc(0); } virtual void* AllocateUninitialized(size_t length) OVERRIDE { return malloc(0); } virtual void Free(void* p, size_t) OVERRIDE { free(p); } }; #ifdef V8_USE_EXTERNAL_STARTUP_DATA class StartupDataHandler { public: StartupDataHandler(const char* natives_blob, const char* snapshot_blob) { Load(natives_blob, &natives_, v8::V8::SetNativesDataBlob); Load(snapshot_blob, &snapshot_, v8::V8::SetSnapshotDataBlob); } ~StartupDataHandler() { delete[] natives_.data; delete[] snapshot_.data; } private: void Load(const char* blob_file, v8::StartupData* startup_data, void (*setter_fn)(v8::StartupData*)) { startup_data->data = NULL; startup_data->compressed_size = 0; startup_data->raw_size = 0; if (!blob_file) return; FILE* file = fopen(blob_file, "rb"); if (!file) return; fseek(file, 0, SEEK_END); startup_data->raw_size = ftell(file); rewind(file); startup_data->data = new char[startup_data->raw_size]; startup_data->compressed_size = fread( const_cast<char*>(startup_data->data), 1, startup_data->raw_size, file); fclose(file); if (startup_data->raw_size == startup_data->compressed_size) (*setter_fn)(startup_data); } v8::StartupData natives_; v8::StartupData snapshot_; // Disallow copy & assign. StartupDataHandler(const StartupDataHandler& other); void operator=(const StartupDataHandler& other); }; #endif // V8_USE_EXTERNAL_STARTUP_DATA int Shell::Main(int argc, char* argv[]) { #if (defined(_WIN32) || defined(_WIN64)) UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; UINT existing_flags = SetErrorMode(new_flags); SetErrorMode(existing_flags | new_flags); #if defined(_MSC_VER) _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _set_error_mode(_OUT_TO_STDERR); #endif // defined(_MSC_VER) #endif // defined(_WIN32) || defined(_WIN64) if (!SetOptions(argc, argv)) return 1; v8::V8::InitializeICU(options.icu_data_file); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform); v8::V8::Initialize(); #ifdef V8_USE_EXTERNAL_STARTUP_DATA StartupDataHandler startup_data(options.natives_blob, options.snapshot_blob); #endif SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); SetFlagsFromString("--redirect-code-traces-to=code.asm"); ShellArrayBufferAllocator array_buffer_allocator; MockArrayBufferAllocator mock_arraybuffer_allocator; if (options.mock_arraybuffer_allocator) { v8::V8::SetArrayBufferAllocator(&mock_arraybuffer_allocator); } else { v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); } int result = 0; Isolate::CreateParams create_params; #if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE) if (i::FLAG_gdbjit) { create_params.code_event_handler = i::GDBJITInterface::EventHandler; } #endif #ifdef ENABLE_VTUNE_JIT_INTERFACE vTune::InitializeVtuneForV8(create_params); #endif #ifndef V8_SHARED create_params.constraints.ConfigureDefaults( base::SysInfo::AmountOfPhysicalMemory(), base::SysInfo::AmountOfVirtualMemory(), base::SysInfo::NumberOfProcessors()); #endif Isolate* isolate = Isolate::New(create_params); DumbLineEditor dumb_line_editor(isolate); { Isolate::Scope scope(isolate); Initialize(isolate); PerIsolateData data(isolate); InitializeDebugger(isolate); #ifndef V8_SHARED if (options.dump_heap_constants) { DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); return 0; } #endif if (options.stress_opt || options.stress_deopt) { Testing::SetStressRunType(options.stress_opt ? Testing::kStressTypeOpt : Testing::kStressTypeDeopt); int stress_runs = Testing::GetStressRuns(); for (int i = 0; i < stress_runs && result == 0; i++) { printf("============ Stress %d/%d ============\n", i + 1, stress_runs); Testing::PrepareStressRun(i); options.last_run = (i == stress_runs - 1); result = RunMain(isolate, argc, argv); } printf("======== Full Deoptimization =======\n"); Testing::DeoptimizeAll(); #if !defined(V8_SHARED) } else if (i::FLAG_stress_runs > 0) { int stress_runs = i::FLAG_stress_runs; for (int i = 0; i < stress_runs && result == 0; i++) { printf("============ Run %d/%d ============\n", i + 1, stress_runs); options.last_run = (i == stress_runs - 1); result = RunMain(isolate, argc, argv); } #endif } else { result = RunMain(isolate, argc, argv); } // Run interactive shell if explicitly requested or if no script has been // executed, but never on --test if (options.use_interactive_shell()) { #ifndef V8_SHARED if (!i::FLAG_debugger) { InstallUtilityScript(isolate); } #endif // !V8_SHARED RunShell(isolate); } } #ifndef V8_SHARED // Dump basic block profiling data. if (i::BasicBlockProfiler* profiler = reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) { i::OFStream os(stdout); os << *profiler; } #endif // !V8_SHARED isolate->Dispose(); V8::Dispose(); V8::ShutdownPlatform(); delete platform; OnExit(); return result; } } // namespace v8 #ifndef GOOGLE3 int main(int argc, char* argv[]) { return v8::Shell::Main(argc, argv); } #endif
tempbottle/v8.rs
src/d8.cc
C++
isc
56,683
var http = require('http'); var util = require('util'); module.exports.createServer = createServer; module.exports.Server = Server; module.exports.install = install; function createServer(listener) { var server = http.createServer.apply(http, arguments); return install(server); } function Server() { http.Server.apply(this, arguments); install(this); } util.inherits(Server, http.Server); function install(server) { var conns = new Map([]); server.on('connection', function (conn) { conns.set(conn, null); conn.on('close', function () { conns.delete(conn); }); }); server.on('request', function (req, res) { var conn = req.connection; conns.set(conn, res); res.on('finish', function () { conns.set(conn, null); }); }); server.gracefulClose = function (done) { conns.forEach(function (res, conn) { if (res !== null && !res.headersSent) { debug('sending response with "Connection: close"'); res.setHeader('Connection', 'close'); } else if (res !== null) { res.on('finish', function () { setIdleTimeout(server, conn); }); } else { setIdleTimeout(server, conn); } }); return server.close.apply(server, arguments); }; debug('graceful-http-server installed'); return server; } function setIdleTimeout(server, conn) { var onTimeout = function () { debug('closing connection'); conn.destroy(); server.removeListener('request', onRequest); }; conn.setTimeout(400, onTimeout); var onRequest = function (req, res) { if (conn === req.connection) { debug('sending response with "Connection: close"'); res.setHeader('Connection', 'close'); conn.removeListener('timeout', onTimeout); server.removeListener('request', onRequest); } }; server.on('request', onRequest); } function debug(message) { // console.log.apply(console, arguments); }
AtsushiSuzuki/http-graceful-close
index.js
JavaScript
isc
2,024
const {createServer} = require('http') const {readFileSync} = require('fs') const template = readFileSync(__dirname + '/index.html') createServer((req, res) => { if (req.url === '/favicon.ico') { res.writeHead(404) res.end() } else if (req.headers.referer && req.url !== '/') { res.writeHead(302, { 'Location': 'ob:/' + req.url.replace('ob://', '') }) res.end() } else { res.end(template) } }).listen(8888)
overra/oblink
index.js
JavaScript
isc
447
require 'spec_helper' require 'time' describe Server do before(:each) do end it "should create a new instance given valid attributes" do s = Factory.build(:server) s.valid?.should be true end it "should not be valid when no hostname is given" do s = Factory.build(:server) s.hostname = nil s.valid?.should be false end it "should not be valid when no interval is given" do s = Factory.build(:server) s.interval_hours = nil s.valid?.should be false end it "should not be valid when no ssh_port is given" do s = Factory.build(:server) s.ssh_port = nil s.valid?.should be false end it "should not be valid when no keep_snapshots is given" do s = Factory.build(:server) s.keep_snapshots = nil s.valid?.should be false end it "should not accept impossible hours" do s = Factory.build(:server) s.window_start = 25 s.valid?.should be false s.window_start = 1 s.window_stop = 25 s.valid?.should be false s.window_stop = 2 s.valid?.should be true end it "should be valid when the other attributes are not given" do s = Factory.build(:server) s.connect_to = nil s.enabled = nil s.backup_server_id = nil s.valid?.should be true end it "should provide a instance method to determine valid backup servers" do s1 = Factory.build(:server, :connect_to => '127.0.0.1') s2 = Factory.build(:server) s2.connect_to = nil BackupServer.should_receive(:available_for).with(s1.connect_to) BackupServer.should_receive(:available_for).with(s2.hostname) s1.possible_backup_servers s2.possible_backup_servers end it "should provide a to_s method" do s = Factory.build(:server) s.to_s.should == s.hostname end it "should know if a backup is running" do server = Factory.build(:server) job = Factory(:backup_job, :server => server, :status => 'running', :finished => false) server.backup_running?.should be true end it "should know when a backup is already queued" do server = Factory.build(:server) job = Factory(:backup_job, :server => server, :status => 'queued') server.backup_running?.should be true end it "should not mark a backup as running when the status is not queued or running" do server = Factory.build(:server) job = Factory(:backup_job, :server => server, :status => 'OK', :finished => true) server.backup_running?.should be false end it "knows no backup is running when there are 0 backup jobs" do server = Factory.build(:server) server.backup_jobs.size.should == 0 server.backup_running?.should be false end it "should always be in the backup window when no start and end is given" do server = Factory.build(:server) server.window_start = nil server.window_stop = nil server.in_backup_window?.should be true end it "should know when it's not in the window" do server_one_hour_window = Factory.build(:server) server_one_hour_window.window_start = 1 server_one_hour_window.window_stop = 2 Time.should_receive(:new).and_return(Time.parse("03:00")) server_one_hour_window.in_backup_window?.should be false server_23_hour_window = Factory.build(:server) server_23_hour_window.window_start = 0 server_23_hour_window.window_stop = 23 Time.should_receive(:new).and_return(Time.parse("23:30")) server_23_hour_window.in_backup_window?.should be false end it "should know when it's in the window" do server = Factory.build(:server) server.window_start = 1 server.window_stop = 2 Time.should_receive(:new).and_return(Time.parse("01:30")) server.in_backup_window?.should be true server.window_start = 0 server.window_stop = 1 Time.should_receive(:new).and_return(Time.parse("00:30")) server.in_backup_window?.should be true server.window_start = 23 server.window_stop = 0 Time.should_receive(:new).and_return(Time.parse("23:30")) server.in_backup_window?.should be true end it "should handle windows that cross midnight" do server = Factory(:server) server.window_start = 22 server.window_stop = 2 next_day = Time.new.tomorrow parsed_when = Time.parse("#{next_day.strftime('%Y-%m-%d')} 01:00") Time.should_receive(:new).and_return(parsed_when) server.in_backup_window?.should be true end it "should know when its past the interval" do s = Factory.build(:server, :interval_hours => 1) j = Factory(:backup_job, :created_at => (Time.new - 3601), :server => s) s.interval_passed?.should be true s.interval_hours = 3 s.interval_passed?.should be false end it "should not backup when backups are not enabled" do s = Factory.build(:server, :enabled => false) s.should_backup?.should be false end it "should not backup when there is no backup server configured" do s = Factory.build(:server, :backup_server => nil) s.should_backup?.should be false end it "should not backup when a backup is already running" do s = Factory.build(:server) s.stub(:backup_running?).and_return true s.should_backup?.should be false end it "should not backup when its outside of the window" do s = Factory.build(:server) s.stub(:in_backup_window?).and_return false s.should_backup?.should be false end it "should not backup when the interval didnt pass" do s = Factory.build(:server) s.stub(:interval_passed?).and_return false s.should_backup?.should be false end it "should know when to backup" do s = Factory.build(:server) s.stub(:backup_running?).and_return false s.stub(:in_backup_window?).and_return true s.stub(:interval_passed?).and_return true s.should_backup?.should be true end it "should know the excludes inherited trough the profiles" do s = Factory.build(:server) # we need one server p1 = Factory.build(:profile, :name => 'linux') # profile one p2 = Factory.build(:profile, :name => 'standard') # and another one p1.excludes << Factory.build(:exclude, :path => '/') # exclude one p2.excludes << Factory.build(:exclude, :path => '/var/log') # second exclude s.profiles << p1 s.profiles << p2 s.excludes.size.should == 2 end it "should know the includes inherited trough the profiles" do s = Factory.build(:server) # we need one server p1 = Factory.build(:profile, :name => 'linux') # profile one p2 = Factory.build(:profile, :name => 'standard') # and another one p1.includes << Factory.build(:include, :path => '/') # include one p2.includes << Factory.build(:include, :path => '/var/log') # second include s.profiles << p1 s.profiles << p2 s.includes.size.should == 2 end it "should compile the list of excludes to valid rsync args" do s = Factory.build(:server) # we need one server p1 = Factory.build(:profile, :name => 'linux') # profile one p2 = Factory.build(:profile, :name => 'standard') # and another one p1.excludes << Factory.build(:exclude, :path => '/') # include one p2.excludes << Factory.build(:exclude, :path => '/var/log') # second include s.profiles << p1 s.profiles << p2 s.rsync_excludes.should == '--exclude=/ --exclude=/var/log' end it "should compile the list of includes to valid rsync args" do s = Factory.build(:server) # we need one server p1 = Factory.build(:profile, :name => 'linux') # profile one p2 = Factory.build(:profile, :name => 'standard') # and another one p1.includes << Factory.build(:include, :path => '/') # include one p2.includes << Factory.build(:include, :path => '/var/log') # second include s.profiles << p1 s.profiles << p2 s.rsync_includes.should == '--include=/ --include=/var/log' end it "should compile a list of splits in order to protect them" do s = Factory.build(:server) p1 = Factory.build(:profile, :name => 'linux') p2 = Factory.build(:profile, :name => 'standard') p1.splits << Factory.build(:split, :path => '/var/spool/mqueue') p2.splits << Factory.build(:split, :path => '/home') s.profiles << p1 s.profiles << p2 s.rsync_protects.should == "--filter='protect /var/spool/mqueue' --filter='protect /home'" end it "should compile a list of splits in order to exclude them" do s = Factory.build(:server) p1 = Factory.build(:profile, :name => 'linux') p2 = Factory.build(:profile, :name => 'standard') p1.splits << Factory.build(:split, :path => '/var/spool/mqueue') p2.splits << Factory.build(:split, :path => '/home') s.profiles << p1 s.profiles << p2 s.rsync_split_excludes.should == '--exclude=/var/spool/mqueue --exclude=/home' end it "should turn the snapshots property into a array" do s = Factory(:server, :snapshots => '1234,5678,90') s.current_snapshots.size.should == 3 s.current_snapshots[0].should == '1234' s.current_snapshots[2].should == '90' end it "should queue a backup when queue_backup is called" do s = Factory(:server) s.backup_jobs.size.should == 0 s.queue_backup s.backup_jobs.size.should == 1 s.backup_jobs.last.status.should == 'queued' end it "scheduling should not crash on servers in remove only mode" do s = Factory(:server, :remove_only => true, :keep_snapshots => 0) s.last_started.should be_nil end it "should cleanup old backupjobs" do pending "Not sure what behaviour is prefered now" server = Factory.create(:server, :keep_snapshots => 5) 6.times do Factory.create(:backup_job, :backup_server => server.backup_server, :server => server, :status => 'OK') end job = server.backup_jobs.last server.backup_jobs.size.should == 6 server.cleanup_old_jobs server.backup_jobs.size.should == 5 end it "should have a method that gets or creates an exclusive profile" do server = Factory(:server) p1 = Factory(:profile) server.profiles << p1 server.profiles.count.should == 1 p2 = server.exclusive_profile p2.exclusive.should == true server.profiles.length.should == 2 p2.save p3 = server.exclusive_profile p3.should === p2 end end
Wijnand/retcon-web
spec/models/server_spec.rb
Ruby
isc
10,201
require 'sidewalk/controller_mixins/view_templates' require 'sidewalk/app_uri' class IndexController < Sidewalk::Controller # If this was a real app, you'd probably do this include in your # ApplicationController or similar: # Look for views/foo.bar, render it with BarHandler. include Sidewalk::ControllerMixins::ViewTemplates # Actually return some content def response @links = { 'Hello, world' => Sidewalk::AppUri.new('/hello'), } render end end
fredemmott/sidewalk
examples/controllers/index_controller.rb
Ruby
isc
484
'use strict'; const XmlNode = require('./XmlNode'); /** A processing instruction within an XML document. @public */ class XmlProcessingInstruction extends XmlNode { /** @param {string} name @param {string} [content] */ constructor(name, content = '') { super(); /** Name of this processing instruction. Also sometimes referred to as the processing instruction "target". @type {string} @public */ this.name = name; /** Content of this processing instruction. @type {string} @public */ this.content = content; } get type() { return XmlNode.TYPE_PROCESSING_INSTRUCTION; } toJSON() { return Object.assign(XmlNode.prototype.toJSON.call(this), { name: this.name, content: this.content, }); } } module.exports = XmlProcessingInstruction;
rgrove/parse-xml
src/lib/XmlProcessingInstruction.js
JavaScript
isc
841
package com.computing.cloud.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.computing.cloud.dao.InstanceRepository; import com.computing.cloud.domain.Instance; import com.computing.cloud.service.InstanceService; @Service @Transactional public class InstanceServiceImpl implements InstanceService { @Autowired private InstanceRepository instanceRepository; @Override public Instance findById(Long id) { return instanceRepository.findOne(id); } @Override public List<Instance> findAll() { return (List<Instance>) instanceRepository.findAll(); } }
ralphavalon/cloud-computing-instance-management
src/main/java/com/computing/cloud/service/impl/InstanceServiceImpl.java
Java
mit
741
import auth from './authReducer' export { auth }
nattatorn-dev/expo-with-realworld
modules/Auth/reducers/index.js
JavaScript
mit
50
/*********************************************************** * Credits: * * Created By: Joe Mayo, 8/26/08 * *********************************************************/ using System; using System.Collections.Generic; using System.Globalization; using System.Text.Json; using System.Xml.Serialization; using LinqToTwitter.Common; namespace LinqToTwitter { /// <summary> /// information for a twitter user /// </summary> [XmlType(Namespace = "LinqToTwitter")] public class User { public User() {} public User(JsonElement user) { if (user.IsNull()) return; BannerSizes = new List<BannerSize>(); Categories = new List<Category>(); UserIDResponse = user.GetUlong("id").ToString(CultureInfo.InvariantCulture); ScreenNameResponse = user.GetString("screen_name"); Name = user.GetString("name"); Location = user.GetString("location"); Description = user.GetString("description"); ProfileImageUrl = user.GetString("profile_image_url"); ProfileImageUrlHttps = user.GetString("profile_image_url_https"); Url = user.GetString("url"); user.TryGetProperty("entities", out JsonElement entitiesValue); Entities = new UserEntities(entitiesValue); Protected = user.GetBool("protected"); ProfileUseBackgroundImage = user.GetBool("profile_use_background_image"); IsTranslator = user.GetBool("is_translator"); FollowersCount = user.GetInt("followers_count"); DefaultProfile = user.GetBool("default_profile"); ProfileBackgroundColor = user.GetString("profile_background_color"); LangResponse = user.GetString("lang"); ProfileTextColor = user.GetString("profile_text_color"); ProfileLinkColor = user.GetString("profile_link_color"); ProfileSidebarFillColor = user.GetString("profile_sidebar_fill_color"); ProfileSidebarBorderColor = user.GetString("profile_sidebar_border_color"); FriendsCount = user.GetInt("friends_count"); DefaultProfileImage = user.GetBool("default_profile_image"); CreatedAt = (user.GetString("created_at") ?? string.Empty).GetDate(DateTime.MinValue); FavoritesCount = user.GetInt("favourites_count"); UtcOffset = user.GetInt("utc_offset"); TimeZone = user.GetString("time_zone"); ProfileBackgroundImageUrl = user.GetString("profile_background_image_url"); ProfileBackgroundImageUrlHttps = user.GetString("profile_background_image_url_https"); ProfileBackgroundTile = user.GetBool("profile_background_tile"); ProfileBannerUrl = user.GetString("profile_banner_url"); StatusesCount = user.GetInt("statuses_count"); Notifications = user.GetBool("notifications"); GeoEnabled = user.GetBool("geo_enabled"); Verified = user.GetBool("verified"); ContributorsEnabled = user.GetBool("contributors_enabled"); Following = user.GetBool("following"); ShowAllInlineMedia = user.GetBool("show_all_inline_media"); ListedCount = user.GetInt("listed_count"); FollowRequestSent = user.GetBool("follow_request_sent"); user.TryGetProperty("status", out JsonElement statusElement); Status = new Status(statusElement); CursorMovement = new Cursors(user); Email = user.GetString("email"); } /// <summary> /// type of user request (i.e. Friends, Followers, or Show) /// </summary> public UserType? Type { get; set; } /// <summary> /// Query User ID /// </summary> public ulong UserID { get; set; } /// <summary> /// Comma-separated list of user IDs (e.g. for Lookup query) /// </summary> public string? UserIdList { get; set; } /// <summary> /// Query screen name /// </summary> public string? ScreenName { get; set; } /// <summary> /// Comma-separated list of screen names (e.g. for Lookup queries) /// </summary> public string? ScreenNameList { get; set; } /// <summary> /// Number of users to return for each page /// </summary> public int Count { get; set; } /// <summary> /// Indicator for which page to get next /// </summary> /// <remarks> /// This is not a page number, but is an indicator to /// Twitter on which page you need back. Your choices /// are Previous and Next, which you can find in the /// CursorResponse property when your response comes back. /// </remarks> public long Cursor { get; set; } /// <summary> /// Used to identify suggested users category /// </summary> public string? Slug { get; set; } /// <summary> /// Query for User Search /// </summary> public string? Query { get; set; } /// <summary> /// Add entities to results (default: true) /// </summary> public bool IncludeEntities { get; set; } /// <summary> /// Remove status from results /// </summary> public bool SkipStatus { get; set; } /// <summary> /// Query User ID /// </summary> public string? UserIDResponse { get; set; } /// <summary> /// Query screen name /// </summary> public string? ScreenNameResponse { get; set; } /// <summary> /// Size for UserProfileImage query /// </summary> public ProfileImageSize? ImageSize { get; set; } /// <summary> /// Set to TweetMode.Extended to receive 280 characters in Status.FullText property /// </summary> public TweetMode? TweetMode { get; set; } /// <summary> /// Contains Next and Previous cursors /// </summary> /// <remarks> /// This is read-only and returned with the response /// from Twitter. You use it by setting Cursor on the /// next request to indicate that you want to move to /// either the next or previous page. /// </remarks> [XmlIgnore] public Cursors? CursorMovement { get; internal set; } /// <summary> /// name of user /// </summary> public string? Name { get; set; } /// <summary> /// location of user /// </summary> public string? Location { get; set; } /// <summary> /// user's description /// </summary> public string? Description { get; set; } /// <summary> /// user's image /// </summary> public string? ProfileImageUrl { get; set; } /// <summary> /// user's image for use on HTTPS secured pages /// </summary> public string? ProfileImageUrlHttps { get; set; } /// <summary> /// user's image is a defaulted placeholder /// </summary> public bool DefaultProfileImage{ get; set; } /// <summary> /// user's URL /// </summary> public string? Url { get; set; } /// <summary> /// Entities connected to the <see cref="User"/> /// </summary> public UserEntities? Entities { get; set; } /// <summary> /// user's profile has not been configured (is just defaults) /// </summary> public bool DefaultProfile { get; set; } /// <summary> /// is user protected /// </summary> public bool Protected { get; set; } /// <summary> /// number of people following user /// </summary> public int FollowersCount { get; set; } /// <summary> /// color of profile background /// </summary> public string? ProfileBackgroundColor { get; set; } /// <summary> /// color of profile text /// </summary> public string? ProfileTextColor { get; set; } /// <summary> /// color of profile links /// </summary> public string? ProfileLinkColor { get; set; } /// <summary> /// color of profile sidebar /// </summary> public string? ProfileSidebarFillColor { get; set; } /// <summary> /// color of profile sidebar border /// </summary> public string? ProfileSidebarBorderColor { get; set; } /// <summary> /// number of friends /// </summary> public int FriendsCount { get; set; } /// <summary> /// date and time when profile was created /// </summary> public DateTime CreatedAt { get; set; } /// <summary> /// number of favorites /// </summary> public int FavoritesCount { get; set; } /// <summary> /// UTC Offset /// </summary> public int UtcOffset { get; set; } /// <summary> /// Time Zone /// </summary> public string? TimeZone { get; set; } /// <summary> /// URL of profile background image /// </summary> public string? ProfileBackgroundImageUrl { get; set; } /// <summary> /// URL of profile background image for use on HTTPS secured pages /// </summary> public string? ProfileBackgroundImageUrlHttps { get; set; } /// <summary> /// Title of profile background /// </summary> public bool ProfileBackgroundTile { get; set; } /// <summary> /// Should we use the profile background image? /// </summary> public bool ProfileUseBackgroundImage { get; set; } /// <summary> /// number of status updates user has made /// </summary> public int StatusesCount { get; set; } /// <summary> /// type of device notifications /// </summary> public bool Notifications { get; set; } /// <summary> /// Supports Geo Tracking /// </summary> public bool GeoEnabled { get; set; } /// <summary> /// Is a verified account /// </summary> public bool Verified { get; set; } /// <summary> /// Is contributors enabled on account? /// </summary> public bool ContributorsEnabled { get; set; } /// <summary> /// Is this a translator? /// </summary> public bool IsTranslator { get; set; } /// <summary> /// is authenticated user following this user /// </summary> public bool Following { get; set; } /// <summary> /// current user status (valid only in user queries) /// </summary> public Status? Status { get; set; } /// <summary> /// User categories for Twitter Suggested Users /// </summary> public List<Category>? Categories { get; set; } /// <summary> /// Input param for Category queries /// </summary> public string? Lang { get; set; } /// <summary> /// Return results for specified language /// Note: Twitter only supports a limited number of languages, /// which include en, fr, de, es, it when this feature was added. /// </summary> public string? LangResponse { get; set; } /// <summary> /// Indicates if user has inline media enabled /// </summary> public bool ShowAllInlineMedia { get; set; } /// <summary> /// Number of lists user is a member of /// </summary> public int ListedCount { get; set; } /// <summary> /// If authenticated user has requested to follow this use /// </summary> public bool FollowRequestSent { get; set; } /// <summary> /// Response from ProfileImage query /// </summary> public string? ProfileImage { get; set; } /// <summary> /// Url of Profile Banner image. /// </summary> public string? ProfileBannerUrl { get; set; } /// <summary> /// Available sizes to use in account banners. /// </summary> public List<BannerSize>? BannerSizes { get; set; } /// <summary> /// User's email-address (null if not filled in on app is /// lacking whitelisting) /// </summary> public string? Email { get; set; } } }
JoeMayo/LinqToTwitter
src/LinqToTwitter6/LinqToTwitter/User/User.cs
C#
mit
12,718
import { h } from 'omi'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon(h("path", { d: "M2 6.67V22h20V6H8.3l8.26-3.34L15.88 1 2 6.67zM7 20c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm13-8h-2v-2h-2v2H4V8h16v4z" }), 'RadioSharp');
AlloyTeam/Nuclear
components/icon/esm/radio-sharp.js
JavaScript
mit
272
<?php /* * This file is part of OAuth 2.0 Laravel. * * (c) Luca Degasperi <packages@lucadegasperi.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace LucaDegasperi\OAuth2Server\Storage; use Carbon\Carbon; use League\OAuth2\Server\Entity\AuthCodeEntity; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Storage\AuthCodeInterface; /** * This is the fluent auth code class. * * @author Luca Degasperi <packages@lucadegasperi.com> */ class FluentAuthCode extends AbstractFluentAdapter implements AuthCodeInterface { /** * Get the auth code. * * @param string $code * * @return \League\OAuth2\Server\Entity\AuthCodeEntity */ public function get($code) { $result = $this->getConnection()->table('oauth_auth_codes') ->where('oauth_auth_codes.id', $code) ->where('oauth_auth_codes.expire_time', '>=', time()) ->first(); if (is_null($result)) { return; } if (is_array($result)) { $result = (object) $result; } return (new AuthCodeEntity($this->getServer())) ->setId($result->id) ->setRedirectUri($result->redirect_uri) ->setExpireTime((int) $result->expire_time); } /** * Get the scopes for an access token. * * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code * * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity */ public function getScopes(AuthCodeEntity $token) { $result = $this->getConnection()->table('oauth_auth_code_scopes') ->select('oauth_scopes.*') ->join('oauth_scopes', 'oauth_auth_code_scopes.scope_id', '=', 'oauth_scopes.id') ->where('oauth_auth_code_scopes.auth_code_id', $token->getId()) ->get(); $scopes = []; foreach ($result as $scope) { if (is_array($scope)) { $scope = (object) $scope; } $scopes[] = (new ScopeEntity($this->getServer()))->hydrate([ 'id' => $scope->id, 'description' => $scope->description, ]); } return $scopes; } /** * Associate a scope with an access token. * * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope * * @return void */ public function associateScope(AuthCodeEntity $token, ScopeEntity $scope) { $this->getConnection()->table('oauth_auth_code_scopes')->insert([ 'auth_code_id' => $token->getId(), 'scope_id' => $scope->getId(), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } /** * Delete an access token. * * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The access token to delete * * @return void */ public function delete(AuthCodeEntity $token) { $this->getConnection()->table('oauth_auth_codes') ->where('oauth_auth_codes.id', $token->getId()) ->delete(); } /** * Create an auth code. * * @param string $token The token ID * @param int $expireTime Token expire time * @param int $sessionId Session identifier * @param string $redirectUri Client redirect uri * * @return void */ public function create($token, $expireTime, $sessionId, $redirectUri) { $this->getConnection()->table('oauth_auth_codes')->insert([ 'id' => $token, 'session_id' => $sessionId, 'redirect_uri' => $redirectUri, 'expire_time' => $expireTime, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } }
BunceeLLC/oauth2-server-laravel
src/Storage/FluentAuthCode.php
PHP
mit
3,992
using System; using System.Collections.Generic; using System.Linq; namespace School { public class Teacher : Person { //field private string comments; //property public List<Discipline> SetOfDisciplines{ get; private set; } public string Comments { get { return this.comments; } set { this.comments = value; } } //constructor public Teacher(string name) : base(name) { this.SetOfDisciplines = new List<Discipline>(); } public Teacher(string name, string comments) : this(name) { this.Comments = comments; } //methods //add discipline public void AddDiscipline(Discipline discipline) { SetOfDisciplines.Add(discipline); } public void AddDisciplines(List<Discipline> disciplines) { SetOfDisciplines.AddRange(disciplines); } } }
niki-funky/Telerik_Academy
Programming/OOP/05. OOP Principles I/01. School/Teacher.cs
C#
mit
1,097
/** * @author: @NikhilS */ require('ts-node/register'); var helpers = require('./helpers'); exports.config = { baseUrl: 'http://localhost:3000/', // use `npm run e2e` specs: [ helpers.root('src/**/**.e2e.ts'), helpers.root('src/**/*.e2e.ts') ], exclude: [], framework: 'jasmine2', allScriptsTimeout: 110000, jasmineNodeOpts: { showTiming: true, showColors: true, isVerbose: false, includeStackTrace: false, defaultTimeoutInterval: 400000 }, directConnect: true, capabilities: { 'browserName': 'chrome', 'chromeOptions': { 'args': ['show-fps-counter=true'] } }, onPrepare: function() { browser.ignoreSynchronization = true; }, /** * Angular 2 configuration * * useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching * `rootEl` */ useAllAngular2AppRoots: true };
nikhilsarvaiye/PeopleManager
config/protractor.conf.js
JavaScript
mit
931
<?php namespace BlogBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\Session; class DefaultController extends Controller { public function indexAction(){ return $this->render('BlogBundle:Entry:index.html.twig'); } public function langAction(Request $request){ return $this->redirectToRoute("blog_homepage"); } }
alexciobanu4/symfony3
src/BlogBundle/Controller/DefaultController.php
PHP
mit
451
#include<cstdio> void main() { int queenNum,i; while(scanf("%d",&queenNum)) { if(queenNum==0)break; if(queenNum%6!=2 && queenNum%6!=3) { for(i=2;i<=queenNum;i+=2)printf("%d ",i); for(i=1;i<=queenNum;i+=2)printf("%d ",i); } else { if((queenNum/2)%2==0) { for(i=queenNum/2;i<=queenNum;i+=2)printf("%d ",i); for(i=2;i<=queenNum/2-2;i+=2)printf("%d ",i); for(i=queenNum/2+3;i<=queenNum-1;i+=2)printf("%d ",i); for(i=1;i<=queenNum/2+1;i+=2)printf("%d ",i); } else { for(i=queenNum/2;i<=queenNum-1;i+=2)printf("%d ",i); for(i=1;i<=queenNum/2-2;i+=2)printf("%d ",i); for(i=queenNum/2+3;i<=queenNum;i+=2)printf("%d ",i); for(i=2;i<=queenNum/2+1;i+=2)printf("%d ",i); } if(queenNum%2!=0)printf("%d ",queenNum); } printf("\n"); } }
junzh0u/poj-solutions
3239/3002024_AC_0MS_72K.cpp
C++
mit
834
# frozen_string_literal: true require "set" # Niceness of a node means that it cannot be nil. # # Note that the module depends on the includer # to provide #scope (for #nice_variable) module Niceness # Literals are nice, except the nil literal. NICE_LITERAL_NODE_TYPES = [ :self, :false, :true, :int, :float, :str, :sym, :regexp, :array, :hash, :pair, :irange, # may contain nils but they are not nil :dstr, # "String #{interpolation}" mixes :str, :begin :dsym # :"#{foo}" ].to_set def nice(node) nice_literal(node) || nice_variable(node) || nice_send(node) || nice_begin(node) end def nice_literal(node) NICE_LITERAL_NODE_TYPES.include? node.type end def nice_variable(node) node.type == :lvar && scope[node.children.first].nice end # Methods that preserve niceness if all their arguments are nice # These are global, called with a nil receiver NICE_GLOBAL_METHODS = { # message, number of arguments _: 1 }.freeze NICE_OPERATORS = { # message, number of arguments (other than receiver) :+ => 1 }.freeze def nice_send(node) return false unless node.type == :send receiver, message, *args = *node if receiver.nil? arity = NICE_GLOBAL_METHODS.fetch(message, -1) else return false unless nice(receiver) arity = NICE_OPERATORS.fetch(message, -1) end args.size == arity && args.all? { |a| nice(a) } end def nice_begin(node) node.type == :begin && nice(node.children.last) end end
yast/zombie-killer
lib/zombie_killer/niceness.rb
Ruby
mit
1,574
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using UNIFreelancerDataBaseEntry.CCandidateService; namespace UNIFreelancerDataBaseEntry { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { var client = new CCandidateService.CandidateServiceClient(); var test = client.GetCandidates(new CandidateDetailSearchRequest()); } } }
mayurdo/UNISoftware
UNIFreelancerDataBaseEntry/Form1.cs
C#
mit
759
// Include assertion library "Should" var should = require('should'); // jshint ignore:line var PowerupElection = require('polyball/shared/powerups/PowerupElection.js'); var Vote = require('polyball/shared/model/Vote.js'); // An example test that runs using Mocha and uses "Should" for assertion testing describe('Powerup Election', function() { "use strict"; describe('#addVote()', function() { it('should increase the size of the votes array by 1', function() { var pe = new PowerupElection({powerups: [1,2,3]}); pe.addVote(new Vote({spectatorID: 1, powerup:1})); pe.votes.length.should.equal(1); }); it('should increase the size of the votes array by 1 for each added vote', function() { var pe = new PowerupElection({powerups: [1,2,3]}); var n = 10; for (var i = 0; i < n; i++){ pe.addVote(new Vote({spectatorID: i, powerup:1})); } pe.votes.length.should.equal(n); }); it('should replace the current vote with new vote', function() { var pe = new PowerupElection({powerups: [1,2,3]}); pe.addVote(new Vote({spectatorID: 1, powerup:1})); pe.addVote(new Vote({spectatorID: 1, powerup:2})); pe.votes.length.should.equal(1); (pe.votes[0]).powerup.should.equal(2); }); it('should replace the current vote with new vote for each additional ' + 'vote from same spectator', function() { var pe = new PowerupElection({powerups: [1,2,3]}); var n = 10; var firstVote = 1; var secondVote = 2; for (var i = 0; i < n; i++){ pe.addVote(new Vote({spectatorID: i, powerup: firstVote})); pe.addVote(new Vote({spectatorID: i, powerup: secondVote})); } pe.votes.length.should.equal(n); pe.votes.forEach(function(elm){ elm.powerup.should.equal(secondVote); }); }); }); describe('#removeVote()', function() { it('should decrease the size of the votes array by 1', function() { var pe = new PowerupElection({powerups: [1,2,3]}); pe.addVote(new Vote({spectatorID: 1, powerup:1})); pe.removeVote(1); pe.votes.length.should.equal(0); }); it('should decrease the size of the votes array by 1 for each additional call', function() { var pe = new PowerupElection({powerups: [1,2,3]}); var n = 10; for (var i = 0; i < n; i++){ pe.addVote(new Vote({spectatorID: i, powerup:1})); } for (i = 0; i < n; i++){ pe.removeVote(i); } pe.votes.length.should.equal(0); }); }); describe('#getWinner()', function() { it('should return the powerup with the most votes ', function() { var pe = new PowerupElection({powerups: [1,2,3]}); pe.addVote(new Vote({spectatorID: 1, powerup:1})); pe.addVote(new Vote({spectatorID: 2, powerup:2})); pe.addVote(new Vote({spectatorID: 3, powerup:2})); pe.getWinner().should.equal(2); }); it('should decrease the size of the votes array by 1 for each additional call', function() { var pe = new PowerupElection({powerups: [1,2,3]}); var winner = pe.getWinner(); (winner != null).should.be.ok; //jshint ignore:line [1,2,3].should.containEql(winner); }); }); });
polyball/polyball
polyball/tests/shared/model/PowerupElectionTests.js
JavaScript
mit
3,626
version https://git-lfs.github.com/spec/v1 oid sha256:92a4f24d3a4ad4de3bbed1013b330d5ca23f4d0cbeed4a7536dcd6b3cd3e492d size 4461
yogeshsaroya/new-cdnjs
ajax/libs/dojo/1.7.2/nls/nb/colors.js
JavaScript
mit
129
version https://git-lfs.github.com/spec/v1 oid sha256:50ef15b4c4f47fb98410127b48f1db6e32dc7f759cab685bd27afbfcfd7fdd38 size 23119
yogeshsaroya/new-cdnjs
ajax/libs/yui/3.17.1/jsonp/jsonp-coverage.js
JavaScript
mit
130
<?php /** * Handle BB code. * * This plugin is the most powerful plugin, if you don't want to write every * text in HTML. It also enables users that are not allowed to post HTML to * format their text. * * A detailed documentation of how to use the tags can be found at * http://github.com/marcoraddatz/candyCMS/wiki/BBCode * * @link http://github.com/marcoraddatz/candyCMS * @author Marco Raddatz <http://marcoraddatz.com> * @license MIT * @since 1.0 * @see https://github.com/marcoraddatz/candyCMS/wiki/BBCode * */ namespace candybox\Plugins; use candyCMS\Core\Helpers\I18n; use candyCMS\Core\Helpers\Helper; use candyCMS\Core\Helpers\Image; final class Bbcode { /** * Identifier for Template Replacements * * @var constant * */ const IDENTIFIER = 'Bbcode'; /** * @var array * @access protected * */ protected $_aRequest; /** * @var array * @access protected * */ protected $_aSession; /** * Initialize the plugin and register all needed events. * * @access public * @param array $aRequest alias for the combination of $_GET and $_POST * @param array $aSession alias for $_SESSION * @param object $oPlugins the PluginManager * */ public function __construct(&$aRequest, &$aSession, &$oPlugins) { $this->_aRequest = & $aRequest; $this->_aSession = & $aSession; # now register some events with the pluginmanager #$oPlugins->registerContentDisplayPlugin($this); $oPlugins->registerEditorPlugin($this); } /** * Search and replace BB code. * * @final * @static * @access private * @param string $sStr HTML to replace * @return string $sStr HTML with formated code * */ private final static function _setFormatedText($sStr) { # BBCode $sStr = str_replace('[hr]', '<hr />', $sStr); $sStr = preg_replace('/\[center\](.*)\[\/center]/isU', '<div style=\'text-align:center\'>\1</div>', $sStr); $sStr = preg_replace('/\[left\](.*)\[\/left]/isU', '<left>\1</left>', $sStr); $sStr = preg_replace('/\[right\](.*)\[\/right]/isU', '<right>\1</right>', $sStr); $sStr = preg_replace('/\[p\](.*)\[\/p]/isU', '<p>\1</p>', $sStr); $sStr = preg_replace('=\[b\](.*)\[\/b\]=Uis', '<strong>\1</strong>', $sStr); $sStr = preg_replace('=\[i\](.*)\[\/i\]=Uis', '<em>\1</em>', $sStr); $sStr = preg_replace('=\[u\](.*)\[\/u\]=Uis', '<span style="text-decoration:underline">\1</span>', $sStr); $sStr = preg_replace('=\[del\](.*)\[\/del\]=Uis', '<span style="text-decoration:line-through">\1</span>', $sStr); $sStr = preg_replace('#\[abbr=(.*)\](.*)\[\/abbr\]#Uis', '<abbr title="\1">\2</abbr>', $sStr); $sStr = preg_replace('#\[acronym=(.*)\](.*)\[\/acronym\]#Uis', '<acronym title="\1">\2</acronym>', $sStr); $sStr = preg_replace('#\[color=(.*)\](.*)\[\/color\]#Uis', '<span style="color:\1">\2</span>', $sStr); $sStr = preg_replace('#\[size=(.*)\](.*)\[\/size\]#Uis', '<span style="font-size:\1%">\2</span>', $sStr); $sStr = preg_replace('#\[anchor:(.*)\]#Uis', '<a name="\1"></a>', $sStr); # Load specific icon $sStr = preg_replace('#\[icon:(.*)\]#Uis', '<i class="icon-\1"></i>', $sStr); # Replace images with image tag (every location allowed while (preg_match('=\[img\](.*)\[\/img\]=isU', $sStr, $sUrl)) { $sUrl[1] = Helper::removeSlash($sUrl[1]); $sImageExtension = strtolower(substr(strrchr($sUrl[1], '.'), 1)); $sTempFileName = md5(MEDIA_DEFAULT_X . $sUrl[1]); $sTempFilePath = Helper::removeSlash(PATH_UPLOAD . '/temp/bbcode/' . $sTempFileName . '.' . $sImageExtension); $sHTML = ''; if (!file_exists($sTempFilePath)) { require_once PATH_STANDARD . '/vendor/candycms/core/helpers/Image.helper.php'; # This might be very slow. So we try to use it rarely. $aInfo = @getImageSize($sUrl[1]); # If external, download image and save as preview if (substr($sUrl[1], 0, 4) == 'http') file_put_contents($sTempFilePath, file_get_contents($sUrl[1])); if ($aInfo[0] > MEDIA_DEFAULT_X) { $oImage = new Image($sTempFileName, 'temp', $sUrl[1], $sImageExtension); $oImage->resizeDefault(MEDIA_DEFAULT_X, '', 'bbcode'); } } $sUrl[1] = substr($sUrl[1], 0, 4) !== 'http' ? WEBSITE_URL . '/' . $sUrl[1] : $sUrl[1]; # Remove capty and change image information. if (file_exists($sTempFilePath)) { $aNewInfo = getImageSize($sTempFilePath); $sTempFilePath = WEBSITE_URL . Helper::addSlash($sTempFilePath); $sClass = 'js-image'; $sAlt = I18n::get('global.image.click_to_enlarge'); } else { $aNewInfo[3] = ''; $sTempFilePath = $sUrl[1]; $sClass = ''; $sAlt = $sTempFilePath; } $sHTML .= '<figure class="image">'; $sHTML .= '<a class="js-fancybox fancybox-thumb" rel="fancybox-thumb" href="' . $sUrl[1] . '">'; $sHTML .= '<img class="' . $sClass . '" alt="' . $sAlt . '"'; $sHTML .= 'src="' . $sTempFilePath . '" ' . $aNewInfo[3] . ' />'; $sHTML .= '</a>'; $sHTML .= '</figure>'; $sStr = preg_replace('=\[img\](.*)\[\/img\]=isU', $sHTML, $sStr, 1); } # using [audio]file.ext[/audio] while (preg_match('#\[audio\](.*)\[\/audio\]#Uis', $sStr, $aMatch)) { $sUrl = 'http://url2vid.com/?url=' . $aMatch[1] . '&w=' . MEDIA_DEFAULT_X . '&h=30&callback=?'; $sStr = preg_replace('#\[audio\](.*)\[\/audio\]#Uis', '<div class="js-media" title="' . $sUrl . '"><a href="' . $sUrl . '">' . $aMatch[1] . '</a></div>', $sStr, 1); } # [video]file[/video] while (preg_match('#\[video\](.*)\[\/video\]#Uis', $sStr, $aMatch)) { $sUrl = 'http://url2vid.com/?url=' . $aMatch[1] . '&w=' . MEDIA_DEFAULT_X . '&h=' . MEDIA_DEFAULT_Y . '&callback=?'; $sStr = preg_replace('#\[video\](.*)\[\/video\]#Uis', '<a href="' . $aMatch[1] . '" class="js-media" title="' . $sUrl . '">' . $aMatch[1] . '</a>', $sStr, 1); } # [video thumbnail]file[/video] while (preg_match('#\[video (.*)\](.*)\[\/video]#Uis', $sStr, $aMatch)) { $sUrl = 'http://url2vid.com/?url=' . $aMatch[2] . '&w=' . MEDIA_DEFAULT_X . '&h=' . MEDIA_DEFAULT_Y . '&p=' . $aMatch[1] . '&callback=?'; $sStr = preg_replace('#\[video (.*)\](.*)\[\/video]#Uis', '<div class="js-media" title="' . $sUrl . '"><a href="' . $aMatch[2] . '">' . $aMatch[2] . '</a></div>', $sStr, 1); } # [video width height thumbnail]file[/video] while (preg_match('#\[video ([0-9]+) ([0-9]+) (.*)\](.*)\[\/video\]#Uis', $sStr, $aMatch)) { $sUrl = 'http://url2vid.com/?url=' . $aMatch[4] . '&w=' . $aMatch[1] . '&h=' . $aMatch[2] . '&p=' . $aMatch[3] . '&callback=?'; $sStr = preg_replace('#\[video ([0-9]+) ([0-9]+) (.*)\](.*)\[\/video\]#Uis', '<div class="js-media" title="' . $sUrl . '"><a href="' . $aMatch[4] . '" class="js-media">' . $aMatch[4] . '</a></div>', $sStr, 1); } # Quote while (preg_match("/\[quote\]/isU", $sStr) && preg_match("/\[\/quote]/isU", $sStr) || preg_match("/\[quote\=/isU", $sStr) && preg_match("/\[\/quote]/isU", $sStr)) { $sStr = preg_replace("/\[quote\](.*)\[\/quote]/isU", "<blockquote>\\1</blockquote>", $sStr); $sStr = preg_replace("/\[quote\=(.+)\](.*)\[\/quote]/isU", "<blockquote><h4>" . I18n::get('global.quote.by') . " \\1</h4>\\2</blockquote>", $sStr); } # Code while (preg_match('#\[code\](.*)\[\/code\]#Uis', $sStr, $aMatch)) { $sStr = preg_replace('#\[code\](.*)\[\/code\]#Uis', '<pre>' . htmlentities($aMatch[1]) . '</pre>', $sStr, 1); } # Bugfix: Fix quote and allow these tags for comment quoting $sStr = str_replace("&lt;blockquote&gt;", "<blockquote>", $sStr); $sStr = str_replace("&lt;/blockquote&gt;", "</blockquote>", $sStr); $sStr = str_replace("&lt;h4&gt;", "<h4>", $sStr); $sStr = str_replace("&lt;/h4&gt;", "</h4>", $sStr); return $sStr; } /** * Return the formatted code. * * @final * @static * @access public * @param string $sStr * @return string HTML with formated code * */ public final function prepareContent($sStr) { return self::_setFormatedText($sStr); } /** * Show nothing, since this plugin does not need to output additional javascript. * * @final * @access public * @return string HTML * */ public final function show() { return ''; } /** * Generate an Info Array ('url' => '', 'iconurl' => '', 'description' => '') * * @final * @access public * @return array|boolean infor array or false * @todo return array with bbcode logo and link to github info page * */ public final function getInfo() { return false; } }
cnlpete/candybox
plugins/Bbcode/Bbcode.controller.php
PHP
mit
9,003
// // Created by Per-Arne on 27.02.2017. // #ifndef WARC2SIM_COLORCONVERTER_H #define WARC2SIM_COLORCONVERTER_H #include <SFML/Graphics/Color.hpp> class ColorConverter { public: static sf::Color hsv(double hue, double sat, double val) { hue = fmod(hue, 360); while(hue<0) hue += 360; if(sat<0.f) sat = 0.f; if(sat>1.f) sat = 1.f; if(val<0.f) val = 0.f; if(val>1.f) val = 1.f; int h = hue/60; double f = (hue)/60-h; double p = val*(1.f-sat); double q = val*(1.f-sat*f); double t = val*(1.f-sat*(1-f)); switch(h) { default: case 0: case 6: return sf::Color(val*255, t*255, p*255); case 1: return sf::Color(q*255, val*255, p*255); case 2: return sf::Color(p*255, val*255, t*255); case 3: return sf::Color(p*255, q*255, val*255); case 4: return sf::Color(t*255, p*255, val*255); case 5: return sf::Color(val*255, p*255, q*255); } } }; #endif //WARC2SIM_COLORCONVERTER_H
UIA-CAIR/DeepRTS
src/util/ColorConverter.hpp
C++
mit
1,098
package morbrian.mormessages.controller; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import morbrian.mormessages.dataformat.CalendarDeserializer; import morbrian.mormessages.dataformat.CalendarSerializer; import morbrian.mormessages.dataformat.DurationAsLongMillisSerializer; import java.time.Duration; import java.time.Instant; import java.util.Calendar; import java.util.Date; import java.util.Objects; import java.util.UUID; @JsonIgnoreProperties(ignoreUnknown = true) public class Subscription { private String subscriptionId; private String userIdentity; private String topicId; private Calendar expirationTime; private Duration duration; public Subscription(String userIdentity, String topicId, String subscriptionId) { this.subscriptionId = subscriptionId; this.userIdentity = userIdentity; this.topicId = topicId; this.duration = Duration.ofSeconds(SubscriptionManager.DEFAULT_DURATION_SECONDS); this.expirationTime = Calendar.getInstance(); this.expirationTime.setTime(Date.from(Instant.now().plusSeconds(duration.getSeconds()))); } public Subscription(String userIdentity, String topicId) { this(userIdentity, topicId, UUID.randomUUID().toString()); } public Subscription(String userIdentity, String topicId, Calendar expirationTime) { this(userIdentity, topicId); if (expirationTime != null) { this.expirationTime = expirationTime; this.duration = Duration.ofMillis(expirationTime.getTimeInMillis() - System.currentTimeMillis()); } } public Subscription(String userIdentity, String topicId, Duration duration) { this(userIdentity, topicId); if (duration != null) { this.duration = duration; this.expirationTime = Calendar.getInstance(); this.expirationTime.setTime(Date.from(Instant.now().plusSeconds(duration.getSeconds()))); } } public Subscription(String userIdentity, String topicId, Calendar expiration, Duration duration) { this(userIdentity, topicId); this.duration = duration; this.expirationTime = expiration; } @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) public static Subscription jsonCreator(@JsonProperty(value = "id") String subscriptionId, @JsonProperty(value = "userIdentity") String userIdentity, @JsonProperty(value = "topicId") String topicId, @JsonProperty(value = "durationMillis") long durationMillis, @JsonProperty(value = "expiration") Calendar expiration) { Subscription subscription = new Subscription(userIdentity, topicId, expiration, Duration.ofMillis(durationMillis)); subscription.subscriptionId = subscriptionId; return subscription; } public String getSubscriptionId() { return subscriptionId; } public String getTopicId() { return topicId; } public String getUserIdentity() { return userIdentity; } public Subscription renew(Duration duration) { Subscription extended = new Subscription(userIdentity, topicId, duration); extended.subscriptionId = this.subscriptionId; return extended; } @JsonSerialize(using = CalendarSerializer.class) @JsonDeserialize(using = CalendarDeserializer.class) public Calendar getExpiration() { return expirationTime; } public boolean isExpired() { return expirationTime.getTimeInMillis() < System.currentTimeMillis(); } @JsonSerialize(using = DurationAsLongMillisSerializer.class) @JsonProperty(value = "durationMillis") public Duration getDuration() { return duration; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Subscription that = (Subscription) o; return Objects.equals(subscriptionId, that.subscriptionId) && Objects.equals(getUserIdentity(), that.getUserIdentity()) && Objects.equals(getTopicId(), that.getTopicId()) && Objects.equals(expirationTime, that.expirationTime) && Objects.equals(getDuration(), that.getDuration()); } @Override public int hashCode() { return Objects .hash(subscriptionId, getUserIdentity(), getTopicId(), expirationTime, getDuration()); } }
morbrian/mormessages
src/main/java/morbrian/mormessages/controller/Subscription.java
Java
mit
4,448
/* transparency component */ define([ 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/query', 'dojo/dom-style', 'dijit/PopupMenuItem', 'dijit/TooltipDialog', 'dijit/form/HorizontalSlider', 'dijit/form/HorizontalRuleLabels' ], function ( declare, lang, array, query, domStyle, PopupMenuItem, TooltipDialog, HorizontalSlider, HorizontalRuleLabels ) { return declare(PopupMenuItem, { layer: null, constructor: function (options) { options = options || {}; lang.mixin(this, options); }, postCreate: function () { this.inherited(arguments); var transparencySlider = new HorizontalSlider({ value: this.layer.layer.getOpacity(), minimum: 0, maximum: 1, discreteValues: 21, intermediateChanges: true, showButtons: false, onChange: lang.hitch(this, function (value) { this.layer.layer.setOpacity(value); array.forEach(query('.' + this.layer.id + '-layerLegendImage'), function (img) { domStyle.set(img, 'opacity', value); }); }) }); var rule = new HorizontalRuleLabels({ labels: ['100%', '50%', '0%'], style: 'height:1em;font-size:75%;' }, transparencySlider.bottomDecoration); rule.startup(); transparencySlider.startup(); this.popup = new TooltipDialog({ style: 'width:200px;', content: transparencySlider }); domStyle.set(this.popup.connectorNode, 'display', 'none'); this.popup.startup(); } }); });
pri0ri7y/OpenMap
js/widgets/templates/layercontrol/plugins/Transparency.js
JavaScript
mit
1,864
class AswersController < ApplicationController def index @aswers = Aswer.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @aswers } end end def show @aswer = Aswer.find(params[:id]) respond_to do |format| format.html #show.html.erb format.xml { render :xml => @aswer } end end end
serviceweb2012/Plugin-Enquete
generators/enquete/templates/app/controllers/aswers_controller.rb
Ruby
mit
391
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // Version 2, December 2004 // // Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> // // Everyone is permitted to copy and distribute verbatim or modified // copies of this license document, and changing it is allowed as long // as the name is changed. // // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION // // 0. You just DO WHAT THE FUCK YOU WANT TO. function Map3DGeometry (data, innerRadius) { if ((arguments.length < 2) || isNaN(parseFloat(innerRadius)) || !isFinite(innerRadius) || (innerRadius < 0)) { // if no valid inner radius is given, do not extrude innerRadius = 42; } THREE.Geometry.call (this); // data.vertices = [lat, lon, ...] // data.polygons = [[poly indices, hole i-s, ...], ...] // data.triangles = [tri i-s, ...] var i, uvs = []; for (i = 0; i < data.vertices.length; i += 2) { var lon = data.vertices[i]; var lat = data.vertices[i + 1]; // colatitude var phi = +(90 - lat) * 0.01745329252; // azimuthal angle var the = +(180 - lon) * 0.01745329252; // translate into XYZ coordinates var wx = Math.sin (the) * Math.sin (phi) * -1; var wz = Math.cos (the) * Math.sin (phi); var wy = Math.cos (phi); // equirectangular projection var wu = 0.25 + lon / 360.0; var wv = 0.5 + lat / 180.0; this.vertices.push (new THREE.Vector3 (wx, wy, wz)); uvs.push (new THREE.Vector2 (wu, wv)); } var n = this.vertices.length; if (innerRadius <= 1) { for (i = 0; i < n; i++) { var v = this.vertices[i]; this.vertices.push (v.clone ().multiplyScalar (innerRadius)); } } for (i = 0; i < data.triangles.length; i += 3) { var a = data.triangles[i]; var b = data.triangles[i + 1]; var c = data.triangles[i + 2]; this.faces.push( new THREE.Face3( a, b, c, [ this.vertices[a], this.vertices[b], this.vertices[c] ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ a ], uvs[ b ], uvs[ c ] ]); if ((0 < innerRadius) && (innerRadius <= 1)) { this.faces.push( new THREE.Face3( n + b, n + a, n + c, [ this.vertices[b].clone ().multiplyScalar (-1), this.vertices[a].clone ().multiplyScalar (-1), this.vertices[c].clone ().multiplyScalar (-1) ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ b ], uvs[ a ], uvs[ c ] ]); // shitty uvs to make 3js exporter happy } } // extrude if (innerRadius < 1) { for (i = 0; i < data.polygons.length; i++) { var polyWithHoles = data.polygons[i]; for (var j = 0; j < polyWithHoles.length; j++) { var polygonOrHole = polyWithHoles[j]; for (var k = 0; k < polygonOrHole.length; k++) { var a = polygonOrHole[k], b = polygonOrHole[(k + 1) % polygonOrHole.length]; var va1 = this.vertices[a], vb1 = this.vertices[b]; var va2 = this.vertices[n + a], vb2 = this.vertices[n + b]; var normal; if (j < 1) { // polygon normal = vb1.clone ().sub (va1).cross ( va2.clone ().sub (va1) ).normalize (); this.faces.push ( new THREE.Face3( a, b, n + a, [ normal, normal, normal ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ a ], uvs[ b ], uvs[ a ] ]); // shitty uvs to make 3js exporter happy if (innerRadius > 0) { this.faces.push ( new THREE.Face3( b, n + b, n + a, [ normal, normal, normal ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ b ], uvs[ b ], uvs[ a ] ]); // shitty uvs to make 3js exporter happy } } else { // hole normal = va2.clone ().sub (va1).cross ( vb1.clone ().sub (va1) ).normalize (); this.faces.push ( new THREE.Face3( b, a, n + a, [ normal, normal, normal ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ b ], uvs[ a ], uvs[ a ] ]); // shitty uvs to make 3js exporter happy if (innerRadius > 0) { this.faces.push ( new THREE.Face3( b, n + a, n + b, [ normal, normal, normal ] ) ); this.faceVertexUvs[ 0 ].push( [ uvs[ b ], uvs[ a ], uvs[ b ] ]); // shitty uvs to make 3js exporter happy } } } } } } this.computeFaceNormals (); this.boundingSphere = new THREE.Sphere (new THREE.Vector3 (), 1); } Map3DGeometry.prototype = Object.create (THREE.Geometry.prototype);
beeva-hodeilopez/beeva-data-visualization-hackathon
three-js/map3d.js
JavaScript
mit
4,972
logparser = r'(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2},\d{3})\s+' \ r'(DEBUG|ERROR|INFO)\s+\[(\w+):(\w+):?(\w+)?\]\s+(.+)$'
the-zebulan/CodeWars
katas/kyu_6/parse_the_log.py
Python
mit
134
using System; using System.Net; using System.Net.Http; namespace AonWeb.FluentHttp.Exceptions { public interface IWriteableExceptionResponseMetadata : IExceptionResponseMetadata { new HttpStatusCode StatusCode { get; set; } new string ReasonPhrase { get; set; } new long? ResponseContentLength { get; set; } new string ResponseContentType { get; set; } new Uri RequestUri { get; set; } new HttpMethod RequestMethod { get; set; } new long? RequestContentLength { get; set; } new string RequestContentType { get; set; } } }
aonweb/fluent-http
AonWeb.FluentHttp.Serialization/Exceptions/IWriteableExceptionResponseMetadata.cs
C#
mit
601
using UnityEngine; using System.Collections; public class ItemBase : MonoBehaviour { //public GameObject brokenItemsPrefab; public int life; public int speeddown; public int super; public int confuse; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter(Collider otherCollider) { if (otherCollider.GetComponent<BBPlayer>()) { if(life == 1){ if(CollisionCount.count != 0) CollisionCount.count--; } Destroy(gameObject); } } }
seonggwang/blueberry-pi
Assets/Scripts/ItemBase.cs
C#
mit
551
module SwiftServer module Controllers class Keystone1 < ApplicationController include Concerns::CredentialsHelper attr_accessor :tenant, :username def show if authorize safe_append_header('X-Storage-Url', app.url('/v1/AUTH_tester')) safe_append_header('X-Auth-Token', 'tk_tester') safe_append_header('X-Storage-Token', 'stk_tester') app.status 200 else app.status 401 end end private def authorize req_headers[:x_auth_user].split(':').tap do |v| @tenant = v.first @username = v.last end valid_tenant?(tenant) && valid_username?(username) && valid_password?(req_headers[:x_auth_key]) end end end end
mdouchement/swift-server
lib/swift_server/controllers/keystone_1.rb
Ruby
mit
775
package edu.rutgers.rumad.rumadworkshopthree.completed; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.LogInCallback; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.SignUpCallback; import edu.rutgers.rumad.rumadworkshopthree.R; public class MainActivity extends ActionBarActivity { Button login, signin, cancel; EditText usernameField, passwordField, nameField; Context ctx; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //store context in variable so we can access in inner methods ctx = this; //initialize buttons login = (Button)findViewById(R.id.loginBtn); signin = (Button)findViewById(R.id.signinBtn); cancel = (Button)findViewById(R.id.cancelBtn); //initialize text fields usernameField = (EditText)findViewById(R.id.username); passwordField = (EditText)findViewById(R.id.password); nameField = (EditText)findViewById(R.id.name); signin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (signin.getText().toString().equalsIgnoreCase("Sign Up")) { login.setVisibility(View.INVISIBLE); cancel.setVisibility(View.VISIBLE); signin.setText("Done"); nameField.setVisibility(View.VISIBLE); } else { //initialize a new user ParseUser user = new ParseUser(); String username = usernameField.getText().toString(); String password = passwordField.getText().toString(); String name = nameField.getText().toString(); //built in method that assigns username to user user.setUsername(username); //built in method that encrypts and assigns password to user user.setPassword(password); //or add in your own data like: user.put("name", name); //where the first parameter is the key and the second parameter is the value /* You can do other stuff too like: //another built in method user.setEmail(email); //whatever you want user.put("age", 18); for now we will just do username and password */ //check if username or password is not there if (username == null || password == null) { Toast.makeText(ctx, "Oops, you must enter a username AND password to sign up", Toast.LENGTH_SHORT).show(); } else { //parse automatically does it in the background thread so no need for AsyncTasks!!! //it also checks automatically if the username was already used user.signUpInBackground(new SignUpCallback() { @Override public void done(ParseException e) { //check if there is no error if (e == null) { //if there isn't we're successful! Go to the next screen and resume initial state of screen! signin.setText("Sign Up"); cancel.setVisibility(View.INVISIBLE); nameField.setVisibility(View.INVISIBLE); login.setVisibility(View.INVISIBLE); Intent intent = new Intent(ctx, SecondActivity.class); startActivity(intent); } //otherwise, let's see what happened else { //go to LogCat and look for error tag if what you expected didn't happen Log.e("error", "user sign up error: " + e.getMessage()); } } }); } } } }); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //get inputs String username = usernameField.getText().toString(); String password = passwordField.getText().toString(); ParseUser.logInInBackground(username, password, new LogInCallback() { @Override public void done(ParseUser parseUser, ParseException e) { //make sure there is no error if(e == null){ //go to next activity Intent intent = new Intent(ctx, SecondActivity.class); startActivity(intent); } //error, what's wrong? else{ Log.e("error logging in",e.getMessage()); } } }); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
RutgersMobileApplicationDevelopment/RUMADWorkshopThree
app/src/main/java/edu/rutgers/rumad/rumadworkshopthree/completed/MainActivity.java
Java
mit
6,604
<!DOCTYPE html> <html lang="en"> <head> <?php include('head.php') ?> <style> a.link{ text-decoration: none; } </style> </head> <body> <!--Menu Begin--> <?php include('menu.php') ?> <!--Menu Ends--> <div class="container"> <table class="table table-responsive"> <form method="post" action="<?php echo base_url('price_change/change'); ?>"> <tr><td>Current Purchase Price</td><td><?php if(isset($p_price)) echo "<h2>".$p_price."</h2>"; ?></td></tr> <tr><td>Current Sales Price</td><td><?php if(isset($s_price)) echo "<h2>".$s_price."</h2>"; ?></td></tr> <tr><td>Purchase Price</td><td><input type="text" name="p_price" required="" pattern="[0-9]{1,2}" title="Number only, range 1-99"></td></tr> <tr><td>Sales Price</td><td><input type="text" name="s_price" required="" pattern="[0-9]{1,2}" title="Number only, range 1-99"></td></tr> <tr><td colspan="2"><button type="submit" class="btn btn-primary">Update</button></td></tr> <tr><td colspan="2"><?php if(isset($message)) echo "<h2>".$message."</h2>"; ?></td></tr> </form> </table> </div> <!--Footer Begin--> <?php include('footer.php') ?> <!--Footer Ends--> </body> </html>
soorajnraju/oruma
application/views/price_change.php
PHP
mit
1,165
module StatefulJobs module Controller extend ActiveSupport::Concern included do class << self attr_accessor :stateful_jobs_class, :stateful_jobs_options end end module ClassMethods def stateful_jobs klass, options = {} self.stateful_jobs_class = klass.to_s.camelcase.constantize self.stateful_jobs_options = options if options[:action] define_method options[:action] do end else if self.stateful_jobs_class.stateful_jobs.is_a? Hash self.stateful_jobs_class.stateful_jobs.keys.each do |job| define_method job do end end end end end end def state render json: stateful_jobs_class.where(id: params[:id]).limit(1).select('current_job, current_state').first.to_json end def stateful_jobs_class self.class.stateful_jobs_class end end end
metascape/stateful_jobs
lib/stateful_jobs/controller.rb
Ruby
mit
955
class BaseWoodTile < MapTile def initialize(position) super @type = :wood @speed_modifier = Settings.wood_floor_movement_points end end class ClientWoodTile < BaseWoodTile def initialize(position) super @image = Images[:wood_floor] end end
MichaelBaker/zombie-picnic
lib/game/lib/map_tiles/wood_tile.rb
Ruby
mit
279
package problems; /** * Created by wanghongkai on 2017/1/16. * * 问题:将一个字符串转为正数,实现atoi的功能 * * 思路:注意正负号,注意溢出判断 * * 更优解法:优化溢出时的判断,参考p007 */ public class P008_string_to_integer { public static int myAtoi(String str) { if (str == null) { return 0; } str = str.trim(); int length = str.length(); if (length > 0) { int index = 0; boolean positive = true; char first = str.charAt(0); if (first == '-') { positive = false; index++; } else if (first == '+') { index++; } if (index >= length) { return 0; } char firstNum = str.charAt(index); if (firstNum >= '0' && firstNum <= '9') { long result = (int) firstNum - 48; while (++index < length) { char next = str.charAt(index); if (next < '0' || next > '9') { break; } result = result * 10 + ((int) next - 48); if (positive && result > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } else if (!positive && -result < Integer.MIN_VALUE) { return Integer.MIN_VALUE; } } return (int) (positive ? result : -result); } } return 0; } public static void main(String[] args) { String[] test = new String[]{ "0", "1", "-1", " 0 ", " 1 ", " -1 ", " +1 ", " a1 ", " 1a", " +19826385692345982734", " -19826385692345982734", " -", }; for (String s : test) { System.out.println(myAtoi(s)); } } }
ironwang/leetcode
src/problems/P008_string_to_integer.java
Java
mit
2,145
using BlueSheep.Interface; using BlueSheep.Interface.Text; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Windows; namespace BlueSheep.Engine.Types { public class WatchDog { #region Fields private AccountUC m_Account; private DateTime PathAction; private Thread m_PathDog; #endregion #region Constructors public WatchDog(AccountUC account) { m_Account = account; } #endregion #region Public Methods public void StartPathDog() { m_PathDog = new Thread(new ThreadStart(PathDog)); m_PathDog.Start(); } public void StopPathDog() { if (m_PathDog != null) m_PathDog.Abort(); } public void Update() { PathAction = DateTime.Now; } #endregion #region Private Methods private void PathDog() { DateTime now = PathAction; double endwait = Environment.TickCount + 10000; while (Environment.TickCount < endwait) { System.Threading.Thread.Sleep(1); System.Windows.Forms.Application.DoEvents(); } DateTime after = PathAction; if (DateTime.Compare(now, after) == 0 && CheckState()) { m_Account.Log(new DebugTextInformation("[WatchDog] Relaunch path"), 0); m_Account.Path.ParsePath(); StartPathDog(); } else { m_Account.Log(new DebugTextInformation("[WatchDog] Nothing to do."), 0); StartPathDog(); } } private bool CheckState() { return (m_Account.state == Enums.Status.None || m_Account.state == Enums.Status.Moving || m_Account.state == Enums.Status.Busy); } #endregion } }
Sadikk/BlueSheep
BlueSheep/Engine/Types/WatchDog.cs
C#
mit
2,065
<!DOCTYPE html> <html> <head> <title>Other page</title> </head> <body> <h1>You know... some other page</h1> </body> </html>
alexandresalome/php-webdriver
website/other.php
PHP
mit
156
#include <bits/stdc++.h> using namespace std; int n, m; struct Edge { int u, v, r; Edge() {} Edge(int _u, int _v, int _r) : u(_u), v(_v), r(_r) {} }; vector<Edge> e[10]; int bit_count(int x) { int c = 0; while (x) { ++c; x -= x&(-x); } return c; } int f(int r, int sta) { // cout << "r = " << r << " sta " << sta << endl; if (r > n) return 1; vector<Edge> tmp; int cnt = 0; for (int i = 0; i < (int)e[r].size(); ++i) { if (sta & (1<<e[r][i].r)) cnt++; else tmp.push_back(e[r][i]); } if (cnt > (int)tmp.size()) return 0; int ans = 0; for (int i = 0; i < (1 << tmp.size()); ++i) { if ((cnt + bit_count(i)) * 2 != (int)e[r].size()) continue; bool flag = false; int new_sta = sta; for (int j = 0; j < (int)tmp.size(); ++j) { if (i & (1 << j)) { new_sta |= (1 << tmp[j].r); if (tmp[j].v < r) flag = true; } } if (flag) continue; ans += f(r + 1, new_sta); } return ans; } int main() { int T; scanf("%d", &T); while (T--) { for (int i = 0; i < 10; ++i) e[i].clear(); scanf("%d %d", &n, &m); for (int i = 0; i < m; ++i) { int u, v; scanf("%d %d", &u, &v); e[u].push_back(Edge(u, v, i)); e[v].push_back(Edge(v, u, i)); } printf("%d\n", m % 2 ? 0 : f(0, 0)); } return 0; }
hangim/ACM
HDU/5305_Friends/5305.cc
C++
mit
1,603
using System; using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using SharePointPnP.PowerShell.Commands.Enums; namespace SharePointPnP.PowerShell.Commands.Features { [Cmdlet(VerbsLifecycle.Disable, "PnPFeature", SupportsShouldProcess = false)] [CmdletAlias("Disable-SPOFeature")] [CmdletHelp("Disables a feature", Category = CmdletHelpCategory.Features)] [CmdletExample( Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe", Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe""", SortOrder = 1)] [CmdletExample( Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Force", Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with force.", SortOrder = 2)] [CmdletExample( Code = "PS:> Disable-PnPFeature -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Scope Web", Remarks = @"This will disable the feature with the id ""99a00f6e-fb81-4dc7-8eac-e09c6f9132fe"" with the web scope.", SortOrder = 3)] public class DisableFeature : SPOWebCmdlet { [Parameter(Mandatory = true, Position = 0, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "The id of the feature to disable.")] public GuidPipeBind Identity; [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets, HelpMessage = "Forcibly disable the feature.")] public SwitchParameter Force; [Parameter(Mandatory = false, HelpMessage = "Specify the scope of the feature to deactivate, either Web or Site. Defaults to Web.")] public FeatureScope Scope = FeatureScope.Web; protected override void ExecuteCmdlet() { Guid featureId = Identity.Id; if (Scope == FeatureScope.Web) { SelectedWeb.DeactivateFeature(featureId); } else { ClientContext.Site.DeactivateFeature(featureId); } } } }
iiunknown/PnP-PowerShell
Commands/Features/DisableFeature.cs
C#
mit
2,265
<?php namespace Tutto\CommonBundle\Form\Subscriber; use Exception; /** * Class SubscriberException * @package Tutto\CommonBundle\Form\Subscriber */ class SubscriberException extends Exception { }
apihour/crm
src/Tutto/CommonBundle/Form/Subscriber/SubscriberException.php
PHP
mit
201
package seedu.task.ui; import java.net.URL; import java.util.logging.Logger; import javafx.fxml.FXML; import javafx.scene.Scene; import javafx.scene.layout.Region; import javafx.scene.web.WebView; import javafx.stage.Stage; import seedu.task.MainApp; import seedu.task.commons.core.LogsCenter; import seedu.task.commons.util.FxViewUtil; /** * Controller for a help page */ public class HelpWindow extends UiPart<Region> { private static final Logger logger = LogsCenter.getLogger(HelpWindow.class); private static final String ICON = "/images/help_icon.png"; private static final String FXML = "HelpWindow.fxml"; private static final String TITLE = "Help"; private static final String USERGUIDE_URL = "/view/KITUserGuide.html"; @FXML private WebView browser; private final Stage dialogStage; public HelpWindow() { super(FXML); Scene scene = new Scene(getRoot()); //Null passed as the parent stage to make it non-modal. dialogStage = createDialogStage(TITLE, null, scene); dialogStage.setMaximized(false); //TODO: set a more appropriate initial size FxViewUtil.setStageIcon(dialogStage, ICON); URL help = MainApp.class.getResource(USERGUIDE_URL); browser.getEngine().load(help.toString()); FxViewUtil.applyAnchorBoundaryParameters(browser, 0.0, 0.0, 0.0, 0.0); } public void show() { logger.fine("Showing help page about the application."); dialogStage.showAndWait(); } }
CS2103JAN2017-F14-B2/main
src/main/java/seedu/task/ui/HelpWindow.java
Java
mit
1,518
package com.network.gui; /** * MainModel. * * @author ningzhangnj */ public class MainModel { private int localPort; private String remoteHost; private int remotePort; public int getLocalPort() { return localPort; } public void setLocalPort(int localPort) { this.localPort = localPort; } public String getRemoteHost() { return remoteHost; } public void setRemoteHost(String remoteHost) { this.remoteHost = remoteHost; } public int getRemotePort() { return remotePort; } public void setRemotePort(int remotePort) { this.remotePort = remotePort; } }
ningzhangnj/NetCapPlay
src/main/java/com/network/gui/MainModel.java
Java
mit
669
'''dossier.fc Feature Collections :class:`dossier.fc.FeatureCollection` provides convenience methods for working with collections of features such as :class:`dossier.fc.StringCounter`. A feature collection provides ``__add__`` and ``__sub__`` so that adding/subtracting FeatureCollections does the right thing for its constituent features. .. This software is released under an MIT/X11 open source license. Copyright 2012-2015 Diffeo, Inc. ''' from __future__ import absolute_import, division, print_function try: from collections import Counter except ImportError: from backport_collections import Counter from collections import MutableMapping, Sequence import copy from itertools import chain, ifilter, imap import logging import operator import cbor import pkg_resources import streamcorpus from dossier.fc.exceptions import ReadOnlyException, SerializationError from dossier.fc.feature_tokens import FeatureTokens, FeatureTokensSerializer from dossier.fc.geocoords import GeoCoords, GeoCoordsSerializer from dossier.fc.string_counter import StringCounterSerializer, StringCounter, \ NestedStringCounter, NestedStringCounterSerializer from dossier.fc.vector import SparseVector, DenseVector logger = logging.getLogger(__name__) class FeatureCollectionChunk(streamcorpus.CborChunk): ''' A :class:`FeatureCollectionChunk` provides a way to serialize a colllection of feature collections to a single blob of data. Here's an example that writes two feature collections to an existing file handle:: fc1 = FeatureCollection({'NAME': {'foo': 2, 'baz': 1}}) fc2 = FeatureCollection({'NAME': {'foo': 4, 'baz': 2}}) fh = StringIO() chunk = FeatureCollectionChunk(file_obj=fh, mode='wb') chunk.add(fc1) chunk.add(fc2) chunk.flush() And the blob created inside the buffer can be read from to produce an iterable of the feature collections that were written:: fh = StringIO(fh.getvalue()) chunk = FeatureCollectionChunk(file_obj=fh, mode='rb') rfc1, rfc2 = list(chunk) assert fc1 == rfc1 assert fc2 == rfc2 ''' def __init__(self, *args, **kwargs): kwargs['write_wrapper'] = FeatureCollection.to_dict kwargs['read_wrapper'] = FeatureCollection.from_dict kwargs['message'] = lambda x: x super(FeatureCollectionChunk, self).__init__(*args, **kwargs) class FeatureCollection(MutableMapping): ''' A collection of features. This is a dictionary from feature name to a :class:`collections.Counter` or similar object. In typical use callers will not try to instantiate individual dictionary elements, but will fall back on the collection's default-value behavior:: fc = FeatureCollection() fc['NAME']['John Smith'] += 1 The default default feature type is :class:`~dossier.fc.StringCounter`. **Feature collection construction and serialization:** .. automethod:: __init__ .. automethod:: loads .. automethod:: dumps .. automethod:: from_dict .. automethod:: to_dict .. automethod:: register_serializer **Feature collection values and attributes:** .. autoattribute:: read_only .. autoattribute:: generation .. autoattribute:: DISPLAY_PREFIX .. autoattribute:: EPHEMERAL_PREFIX **Feature collection computation:** .. automethod:: __add__ .. automethod:: __sub__ .. automethod:: __mul__ .. automethod:: __imul__ .. automethod:: total .. automethod:: merge_with ''' __slots__ = ['_features', '_read_only'] DISPLAY_PREFIX = '#' '''Prefix on names of features that are human-readable. Processing may convert a feature ``name`` to a similar feature ``#name`` that is human-readable, while converting the original feature to a form that is machine-readable only; for instance, replacing strings with integers for faster comparison. ''' EPHEMERAL_PREFIX = '_' '''Prefix on names of features that are not persisted. :meth:`to_dict` and :meth:`dumps` will not write out features that begin with this character. ''' TOKEN_PREFIX = '@' '''Prefix on names of features that contain tokens.''' GEOCOORDS_PREFIX = '!' '''Prefix on names of features that contain geocoords.''' NESTED_PREFIX = '%' '''Prefix on names of features based on NestedStringCounters''' @staticmethod def register_serializer(feature_type, obj): ''' This is a **class** method that lets you define your own feature type serializers. ``tag`` should be the name of the feature type that you want to define serialization for. Currently, the valid values are ``StringCounter``, ``Unicode``, ``SparseVector`` or ``DenseVector``. Note that this function is not thread safe. ``obj`` must be an object with three attributes defined. ``obj.loads`` is a function that takes a CBOR created Python data structure and returns a new feature counter. ``obj.dumps`` is a function that takes a feature counter and returns a Python data structure that can be serialized by CBOR. ``obj.constructor`` is a function with no parameters that returns the Python ``type`` that can be used to construct new features. It should be possible to call ``obj.constructor()`` to get a new and empty feature counter. ''' registry.add(feature_type, obj) def __init__(self, data=None, read_only=False): ''' Creates a new empty feature collection. If ``data`` is a dictionary-like object with a structure similar to that of a feature collection (i.e., a dict of multisets), then it is used to initialize the feature collection. ''' self._features = {} self.read_only = read_only if data is not None: self._from_dict_update(data) @classmethod def loads(cls, data): '''Create a feature collection from a CBOR byte string.''' rep = cbor.loads(data) if not isinstance(rep, Sequence): raise SerializationError('expected a CBOR list') if len(rep) != 2: raise SerializationError('expected a CBOR list of 2 items') metadata = rep[0] if 'v' not in metadata: raise SerializationError('no version in CBOR metadata') if metadata['v'] != 'fc01': raise SerializationError('invalid CBOR version {!r} ' '(expected "fc01")' .format(metadata['v'])) read_only = metadata.get('ro', False) contents = rep[1] return cls.from_dict(contents, read_only=read_only) def dumps(self): '''Create a CBOR byte string from a feature collection.''' metadata = {'v': 'fc01'} if self.read_only: metadata['ro'] = 1 rep = [metadata, self.to_dict()] return cbor.dumps(rep) @classmethod def from_dict(cls, data, read_only=False): '''Recreate a feature collection from a dictionary. The dictionary is of the format dumped by :meth:`to_dict`. Additional information, such as whether the feature collection should be read-only, is not included in this dictionary, and is instead passed as parameters to this function. ''' fc = cls(read_only=read_only) fc._features = {} fc._from_dict_update(data) return fc def _from_dict_update(self, data): for name, feat in data.iteritems(): if not isinstance(name, unicode): name = name.decode('utf-8') if name.startswith(self.EPHEMERAL_PREFIX): self._features[name] = feat continue if isinstance(feat, cbor.Tag): if feat.tag not in cbor_tags_to_names: raise SerializationError( 'Unknown CBOR value (tag id: %d): %r' % (feat.tag, feat.value)) loads = registry.get(cbor_tags_to_names[feat.tag]).loads feat = feat.value elif is_native_string_counter(feat): loads = registry.get('StringCounter').loads elif isinstance(feat, unicode): # A Unicode string. loads = registry.get('Unicode').loads elif registry.is_serializeable(feat): loads = lambda x: x else: raise SerializationError( 'Unknown CBOR value (type: %r): %r' % (type(feat), feat)) value = loads(feat) if hasattr(value, 'read_only'): value.read_only = self.read_only self._features[name] = value def to_dict(self): '''Dump a feature collection's features to a dictionary. This does not include additional data, such as whether or not the collection is read-only. The returned dictionary is suitable for serialization into JSON, CBOR, or similar data formats. ''' def is_non_native_sc(ty, encoded): return (ty == 'StringCounter' and not is_native_string_counter(encoded)) fc = {} native = ('StringCounter', 'Unicode') for name, feat in self._features.iteritems(): if name.startswith(self.EPHEMERAL_PREFIX): continue if not isinstance(name, unicode): name = name.decode('utf-8') tyname = registry.feature_type_name(name, feat) encoded = registry.get(tyname).dumps(feat) # This tomfoolery is to support *native untagged* StringCounters. if tyname not in native or is_non_native_sc(tyname, encoded): encoded = cbor.Tag(cbor_names_to_tags[tyname], encoded) fc[name] = encoded return fc @property def generation(self): '''Get the generation number for this feature collection. This is the highest generation number across all counters in the collection, if the counters support generation numbers. This collection has not changed if the generation number has not changed. ''' return max(getattr(collection, 'generation', 0) for collection in self._features.itervalues()) def __repr__(self): return 'FeatureCollection(%r)' % self._features def __missing__(self, key): default_tyname = FeatureTypeRegistry.get_default_feature_type_name(key) if self.read_only: # reaturn a read-only instance of the default type, of # which there is one, because we'll only ever need one, # because it's read-only. return registry.get_read_only(default_tyname) if key.startswith(self.EPHEMERAL_PREFIX): # When the feature name starts with an ephemeral prefix, then # we have no idea what it should be---anything goes. Therefore, # the caller must set the initial value themselves (and we must # be careful not to get too eager with relying on __missing__). raise KeyError(key) default_value = registry.get_constructor(default_tyname)() self[key] = default_value return default_value def __contains__(self, key): ''' Returns ``True`` if the feature named ``key`` is in this FeatureCollection. :type key: unicode ''' return key in self._features def merge_with(self, other, multiset_op, other_op=None): '''Merge this feature collection with another. Merges two feature collections using the given ``multiset_op`` on each corresponding multiset and returns a new :class:`FeatureCollection`. The contents of the two original feature collections are not modified. For each feature name in both feature sets, if either feature collection being merged has a :class:`collections.Counter` instance as its value, then the two values are merged by calling `multiset_op` with both values as parameters. If either feature collection has something other than a :class:`collections.Counter`, and `other_op` is not :const:`None`, then `other_op` is called with both values to merge them. If `other_op` is :const:`None` and a feature is not present in either feature collection with a counter value, then the feature will not be present in the result. :param other: The feature collection to merge into ``self``. :type other: :class:`FeatureCollection` :param multiset_op: Function to merge two counters :type multiset_op: fun(Counter, Counter) -> Counter :param other_op: Function to merge two non-counters :type other_op: fun(object, object) -> object :rtype: :class:`FeatureCollection` ''' result = FeatureCollection() for ms_name in set(self._counters()) | set(other._counters()): c1 = self.get(ms_name, None) c2 = other.get(ms_name, None) if c1 is None and c2 is not None: c1 = c2.__class__() if c2 is None and c1 is not None: c2 = c1.__class__() result[ms_name] = multiset_op(c1, c2) if other_op is not None: for o_name in (set(self._not_counters()) | set(other._not_counters())): v = other_op(self.get(o_name, None), other.get(o_name, None)) if v is not None: result[o_name] = v return result def __add__(self, other): ''' Add features from two FeatureCollections. >>> fc1 = FeatureCollection({'foo': Counter('abbb')}) >>> fc2 = FeatureCollection({'foo': Counter('bcc')}) >>> fc1 + fc2 FeatureCollection({'foo': Counter({'b': 4, 'c': 2, 'a': 1})}) Note that if a feature in either of the collections is not an instance of :class:`collections.Counter`, then it is ignored. ''' return self.merge_with(other, operator.add) def __iadd__(self, other): ''' In-place add features from two FeatureCollections. >>> fc1 = FeatureCollection({'foo': Counter('abbb')}) >>> fc2 = FeatureCollection({'foo': Counter('bcc')}) >>> fc1 += fc2 FeatureCollection({'foo': Counter({'b': 4, 'c': 2, 'a': 1})}) Note that if a feature in either of the collections is not an instance of :class:`collections.Counter`, then it is ignored. ''' if self.read_only: raise ReadOnlyException() fc = self.merge_with(other, operator.iadd) self._features = fc._features return self def __sub__(self, other): ''' Subtract features from two FeatureCollections. >>> fc1 = FeatureCollection({'foo': Counter('abbb')}) >>> fc2 = FeatureCollection({'foo': Counter('bcc')}) >>> fc1 - fc2 FeatureCollection({'foo': Counter({'b': 2, 'a': 1})}) Note that if a feature in either of the collections is not an instance of :class:`collections.Counter`, then it is ignored. ''' return self.merge_with(other, operator.sub) def __isub__(self, other): ''' In-place subtract features from two FeatureCollections. >>> fc1 = FeatureCollection({'foo': Counter('abbb')}) >>> fc2 = FeatureCollection({'foo': Counter('bcc')}) >>> fc1 -= fc2 FeatureCollection({'foo': Counter({'b': 2, 'a': 1})}) Note that if a feature in either of the collections is not an instance of :class:`collections.Counter`, then it is ignored. ''' if self.read_only: raise ReadOnlyException() fc = self.merge_with(other, operator.isub) self._features = fc._features return self def __mul__(self, coef): fc = copy.deepcopy(self) fc *= coef return fc def __imul__(self, coef): '''In-place multiplication by a scalar.''' if self.read_only: raise ReadOnlyException() if coef == 1: return self for name in self._counters(): self[name] *= coef return self def total(self): ''' Returns sum of all counts in all features that are multisets. ''' feats = imap(lambda name: self[name], self._counters()) return sum(chain(*map(lambda mset: map(abs, mset.values()), feats))) def __getitem__(self, key): ''' Returns the feature named ``key``. If ``key`` does not exist, then a new empty :class:`StringCounter` is created. Alternatively, a second optional positional argument can be given that is used as a default value. Note that traditional indexing is supported too, e.g.:: fc = FeatureCollection({'NAME': {'foo': 1}}) assert fc['NAME'] == StringCounter({'foo': 1}) :type key: unicode ''' v = self._features.get(key) if v is not None: return v return self.__missing__(key) def get(self, key, default=None): if key not in self: return default else: return self._features[key] def __setitem__(self, key, value): if self.read_only: raise ReadOnlyException() if not isinstance(key, unicode): if isinstance(key, str): key = unicode(key) else: raise TypeError(key) if hasattr(value, 'read_only'): value.read_only = self.read_only self._features[key] = value def __delitem__(self, key): ''' Deletes the feature named ``key`` from this feature collection. :type key: unicode ''' if self.read_only: raise ReadOnlyException() if key in self._features: del self._features[key] else: raise KeyError(key) def _counters(self): ''' Returns a generator of ``feature_name`` where ``feature_name`` corresponds to a feature that is an instance of :class:`collections.Counter`. This method is useful when you need to perform operations only on features that are multisets. ''' return ifilter(lambda n: is_counter(self[n]), self) def _not_counters(self): ''' Returns a generator of ``feature_name`` where ``feature_name`` corresponds to a feature that is **not** an instance of :class:`collections.Counter`. This method is useful when you need to perform operations only on features that are **not** multisets. ''' return ifilter(lambda n: not is_counter(self[n]), self) def __iter__(self): return self._features.iterkeys() def __len__(self): ''' Returns the number of features in this collection. ''' return len(set(iter(self))) @property def read_only(self): '''Flag if this feature collection is read-only. When a feature collection is read-only, no part of it can be modified. Individual feature counters cannot be added, deleted, or changed. This attribute is preserved across serialization and deserialization. ''' return self._read_only @read_only.setter def read_only(self, ro): self._read_only = ro for (k, v) in self._features.iteritems(): if hasattr(v, 'read_only'): v.read_only = ro class FeatureTypeRegistry (object): ''' This is a pretty bogus class that has exactly one instance. Its purpose is to guarantee the correct lazy loading of entry points into the registry. ''' ENTRY_POINT_GROUP = 'dossier.fc.feature_types' DEFAULT_FEATURE_TYPE_NAME = 'StringCounter' DEFAULT_FEATURE_TYPE_PREFIX_NAMES = { FeatureCollection.DISPLAY_PREFIX: 'StringCounter', FeatureCollection.EPHEMERAL_PREFIX: 'StringCounter', FeatureCollection.TOKEN_PREFIX: 'FeatureTokens', FeatureCollection.GEOCOORDS_PREFIX: 'GeoCoords', FeatureCollection.NESTED_PREFIX: 'NestedStringCounter', } @classmethod def get_default_feature_type_name(cls, feature_name): by_prefix = cls.DEFAULT_FEATURE_TYPE_PREFIX_NAMES.get(feature_name[0]) if by_prefix is None: return cls.DEFAULT_FEATURE_TYPE_NAME else: return by_prefix def __init__(self): self._registry = {} self._inverse = {} self._entry_points = False def add(self, name, obj): '''Register a new feature serializer. The feature type should be one of the fixed set of feature representations, and `name` should be one of ``StringCounter``, ``SparseVector``, or ``DenseVector``. `obj` is a describing object with three fields: `constructor` is a callable that creates an empty instance of the representation; `dumps` is a callable that takes an instance of the representation and returns a JSON-compatible form made of purely primitive objects (lists, dictionaries, strings, numbers); and `loads` is a callable that takes the response from `dumps` and recreates the original representation. Note that ``obj.constructor()`` *must* return an object that is an instance of one of the following types: ``unicode``, :class:`dossier.fc.StringCounter`, :class:`dossier.fc.SparseVector` or :class:`dossier.fc.DenseVector`. If it isn't, a :exc:`ValueError` is raised. ''' ro = obj.constructor() if name not in cbor_names_to_tags: print(name) raise ValueError( 'Unsupported feature type name: "%s". ' 'Allowed feature type names: %r' % (name, cbor_names_to_tags.keys())) if not is_valid_feature_instance(ro): raise ValueError( 'Constructor for "%s" returned "%r" which has an unknown ' 'sub type "%r". (mro: %r). Object must be an instance of ' 'one of the allowed types: %r' % (name, ro, type(ro), type(ro).mro(), ALLOWED_FEATURE_TYPES)) self._registry[name] = {'obj': obj, 'ro': obj.constructor()} self._inverse[obj.constructor] = name def feature_type_name(self, feat_name, obj): ty = type(obj) if ty not in self._inverse: raise SerializationError( 'Python type "%s" is not in the feature type registry: %r\n\n' 'The offending feature (%s): %r' % (ty, self._inverse, feat_name, obj)) return self._inverse[ty] def is_serializeable(self, obj): return type(obj) in self._inverse def _get(self, type_name): self._load_entry_points() if type_name not in self._registry: raise SerializationError( 'Feature type %r not in feature type registry: %r' % (type_name, self._registry)) return self._registry[type_name] def get(self, type_name): return self._get(type_name)['obj'] def get_constructor(self, type_name): return self._get(type_name)['obj'].constructor def get_read_only(self, type_name): return self._get(type_name)['ro'] def types(self): self._load_entry_points() return self._registry.keys() def _load_entry_points(self): if self._entry_points: return self._entry_points = True for epoint in pkg_resources.iter_entry_points(self.ENTRY_POINT_GROUP): try: obj = epoint.load() except (ImportError, pkg_resources.DistributionNotFound): import traceback logger.warn(traceback.format_exc()) continue self.add(epoint.name, obj) def _reset(self): self._entry_points = False self._registry = {} self._inverse = {} self.add('StringCounter', StringCounterSerializer) self.add('Unicode', UnicodeSerializer) self.add('GeoCoords', GeoCoordsSerializer) self.add('FeatureTokens', FeatureTokensSerializer) self.add('NestedStringCounter', NestedStringCounterSerializer) def __enter__(self): return self def __exit__(self, *args): self._reset() class UnicodeSerializer(object): def __init__(self): raise NotImplementedError() # cbor natively supports Unicode, so we can use the identity function. loads = staticmethod(lambda x: x) dumps = staticmethod(lambda x: x) constructor = unicode cbor_names_to_tags = { # Tagged just in case someone wants to changed the binary format. # By default, FeatureCollection will deserialize it as a special case # into a dict of {unicode |--> int} with no tag. 'StringCounter': 55800, # Not tagged because CBOR supports it natively. 'Unicode': None, # These are *always* tagged. 'SparseVector': 55801, 'DenseVector': 55802, # 55803 was FeatureOffsets 'FeatureTokens': 55804, 'GeoCoords': 55805, 'NestedStringCounter': 55806, } cbor_tags_to_names = {} for k, v in cbor_names_to_tags.items(): if v: cbor_tags_to_names[v] = k ALLOWED_FEATURE_TYPES = ( unicode, StringCounter, SparseVector, DenseVector, FeatureTokens, GeoCoords, NestedStringCounter, ) def is_native_string_counter(cbor_data): return isinstance(cbor_data, dict) def is_counter(obj): return isinstance(obj, Counter) \ or getattr(obj, 'is_counter', False) def is_valid_feature_instance(obj): return isinstance(obj, ALLOWED_FEATURE_TYPES) registry = FeatureTypeRegistry() registry._reset()
dossier/dossier.fc
python/dossier/fc/feature_collection.py
Python
mit
26,206
<?php /** * Template for "My company" page. * * @author: Andrii Birev */ defined('BEXEC')or die('No direct access!'); ?> <div id="companies_newcompany"> <div class="header"> <h1 class="page-header">Create company</h1> </div> <?php $this->breadcrumbs->draw(); ?> <div> form </div> </div>
konservs/financello
templates/members/companies.newcompany.d.php
PHP
mit
302
/* * This file is part of ThaumicSpongeAPI, licensed under the MIT License (MIT). * * Copyright (c) Gabriel Harris-Rouquette * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.gabizou.thaumicsponge.api.entity; import org.spongepowered.api.entity.Entity; public interface EldritchMonster extends Entity { }
gabizou/ThaumicSpongeAPI
src/main/java/com/gabizou/thaumicsponge/api/entity/EldritchMonster.java
Java
mit
1,382
import { Java } from './java'; import * as path from 'path'; import { ChildProcess } from "child_process"; import { LoggerContext } from './lib/logger-context'; import { Logger } from './lib/logger'; function emitLines(stream): void { let backlog = ''; stream.on('data', function (data) { backlog += data; let n = backlog.indexOf('\n'); // got a \n? emit one or more 'line' events while (~n) { stream.emit('line', backlog.substring(0, n)); backlog = backlog.substring(n + 1); n = backlog.indexOf('\n'); } }); stream.on('end', function () { if (backlog) { stream.emit('line', backlog); } }); } /** * Class allowing abstract interface for accessing sqflint CLI. */ export class SQFLint { // This is list of waiting results private waiting: { // eslint-disable-next-line @typescript-eslint/no-explicit-any [filename: string]: ((info: SQFLint.ParseInfo) => any); } = {}; // Currently running sqflint process private childProcess: ChildProcess; private logger: Logger; constructor(context: LoggerContext) { this.logger = context.createLogger('sqflint'); } /** * Launches sqflint process and assigns basic handlers. */ private launchProcess(): void { this.childProcess = Java.spawn( path.join(__dirname, "..", "bin", "SQFLint.jar"), [ "-j" ,"-v" ,"-s" // ,"-bl" ] ); // Fix for nodejs issue (see https://gist.github.com/TooTallNate/1785026) emitLines(this.childProcess.stdout); this.childProcess.stdout.resume(); this.childProcess.stdout.setEncoding('utf-8'); this.childProcess.stdout.on('line', line => this.processLine(line.toString())); this.childProcess.stderr.on('data', data => { let dataStr: string = data.toString().trim(); if (dataStr.startsWith('\n')) { dataStr = dataStr.substring(1).trim(); } // benchLog begin with timestamp // TODO find better filter this.logger.error(dataStr.startsWith("158") ? "" : "SQFLint: Error message", dataStr); }); this.childProcess.on('error', msg => { this.logger.error("SQFLint: Process crashed", msg); this.childProcess = null; this.flushWaiters(); }); this.childProcess.on('close', code => { if (code != 0) { this.logger.error("SQFLint: Process crashed with code", code); } else { this.logger.info('Background server stopped'); } this.childProcess = null; this.flushWaiters(); }); } /** * Calls all waiters with empty result and clears the waiters list. */ private flushWaiters(): void { for (const i in this.waiting) { this.waiting[i](new SQFLint.ParseInfo()); } this.waiting = {}; } /** * Processes sqflint server line * @param line sqflint output line in server mode */ private processLine(line: string): void { // Prepare result info const info = new SQFLint.ParseInfo(); // Skip empty lines if (line.replace(/(\r\n|\n|\r)/gm, "").length == 0) { return; } // Parse message let serverMessage: RawServerMessage; try { serverMessage = JSON.parse(line) as RawServerMessage; } catch (ex) { console.error("SQFLint: Failed to parse server output."); console.error(line); return; } // log some bench info.timeNeededSqfLint = serverMessage.timeneeded; // Parse messages for (const l in serverMessage.messages) { this.processMessage(serverMessage.messages[l], info); } // Pass result to waiter const waiter = this.waiting[serverMessage.file]; if (waiter) { waiter(info); delete this.waiting[serverMessage.file]; } else { console.error("SQFLint: Received unrequested info."); } } /** * Converts raw sqflint message into specific classes. * @param message sqflint info message * @param info used to store parsed messages */ private processMessage(message: RawMessage, info: SQFLint.ParseInfo): void { const errors: SQFLint.Error[] = info.errors; const warnings: SQFLint.Warning[] = info.warnings; const variables: SQFLint.VariableInfo[] = info.variables; const macros: SQFLint.Macroinfo[] = info.macros; const includes: SQFLint.IncludeInfo[] = info.includes; // Preload position if present let position: SQFLint.Range = null; if (message.line && message.column) { position = this.parsePosition(message); } // Create different wrappers based on type if (message.type == "error") { errors.push(new SQFLint.Error( message.error || message.message, position )); } else if (message.type == "warning") { warnings.push(new SQFLint.Warning( message.error || message.message, position, message.filename )); } else if (message.type == "variable") { // Build variable info wrapper const variable = new SQFLint.VariableInfo(); variable.name = message.variable; variable.comment = this.parseComment(message.comment); variable.usage = []; variable.definitions = []; // We need to convert raw positions to our format (compatible with vscode format) for(const i in message.definitions) { variable.definitions.push(this.parsePosition(message.definitions[i])); } for(const i in message.usage) { variable.usage.push(this.parsePosition(message.usage[i])); } variables.push(variable); } else if (message.type == "macro") { const macro = new SQFLint.Macroinfo(); macro.name = message.macro; macro.definitions = []; if (macro.name.indexOf('(') >= 0) { macro.arguments = macro.name.substr(macro.name.indexOf('(')); if (macro.arguments.indexOf(')') >= 0) { macro.arguments = macro.arguments.substr(0, macro.arguments.indexOf(')') + 1); } macro.name = macro.name.substr(0, macro.name.indexOf('(')); } const defs = message.definitions as unknown as { range: RawMessagePosition; value: string; filename: string }[]; for(const i in defs) { const definition = new SQFLint.MacroDefinition(); definition.position = this.parsePosition(defs[i].range); definition.value = defs[i].value; definition.filename = defs[i].filename; macro.definitions.push(definition); } macros.push(macro); } else if (message.type == "include") { const include = new SQFLint.IncludeInfo(); include.filename = message.include; include.expanded = message.expandedInclude; includes.push(include); } } /** * Parses content and returns result wrapped in helper classes. * Warning: This only queues the item, the linting will start after 200ms to prevent fooding. */ public parse(filename: string, contents: string, options: SQFLint.Options): Promise<SQFLint.ParseInfo> { // Cancel previous callback if exists if (this.waiting[filename]) { this.waiting[filename](null); delete(this.waiting[filename]); } return new Promise<SQFLint.ParseInfo>((success /*, reject */): void => { if (!this.childProcess) { this.logger.info("Starting background server..."); this.launchProcess(); this.logger.info("Background server started"); } const startTime = new Date(); this.waiting[filename] = (info: SQFLint.ParseInfo): void => { info.timeNeededMessagePass = new Date().valueOf() - startTime.valueOf(); success(info); }; this.childProcess.stdin.write(JSON.stringify({ "file": filename, "contents": contents, "options": options }) + "\n"); }); } /** * Stops subprocess if running. */ public stop(): void { if (this.childProcess != null) { this.logger.info('Stopping background server'); this.childProcess.stdin.write(JSON.stringify({ "type": "exit" }) + "\n"); } } /** * Converts raw position to result position. */ private parsePosition(position: RawMessagePosition): SQFLint.Range { return new SQFLint.Range( new SQFLint.Position(position.line[0] - 1, position.column[0] - 1), new SQFLint.Position(position.line[1] - 1, position.column[1]) ); } /** * Removes comment specific characters and trims the comment. */ private parseComment(comment: string): string { if (comment) { comment = comment.trim(); if (comment.indexOf("//") == 0) { comment = comment.substr(2).trim(); } if (comment.indexOf("/*") == 0) { const clines = comment.substr(2, comment.length - 4).trim().split("\n"); for(const c in clines) { let cline = clines[c].trim(); if (cline.indexOf("*") == 0) { cline = cline.substr(1).trim(); } clines[c] = cline; } comment = clines.filter((i) => !!i).join("\r\n").trim(); } } return comment; } } /** * Raw message received from server. */ interface RawServerMessage { timeneeded?: number; file: string; messages: RawMessage[]; } /** * Raw position received from sqflint CLI. */ interface RawMessagePosition { line: number[]; column: number[]; } /** * Raw message received from sqflint CLI. */ interface RawMessage extends RawMessagePosition { type: string; error?: string; message?: string; macro?: string; filename?: string; include?: string; expandedInclude?: string; variable?: string; comment?: string; usage: RawMessagePosition[]; definitions: RawMessagePosition[]; } // eslint-disable-next-line @typescript-eslint/no-namespace export namespace SQFLint { /** * Base message. */ class Message { constructor( public message: string, public range: Range, public filename?: string ) {} } /** * Error in code. */ export class Error extends Message {} /** * Warning in code. */ export class Warning extends Message {} /** * Contains info about parse result. */ export class ParseInfo { errors: Error[] = []; warnings: Warning[] = []; variables: VariableInfo[] = []; macros: Macroinfo[] = []; includes: IncludeInfo[] = []; timeNeededSqfLint?: number; timeNeededMessagePass?: number; } export class IncludeInfo { filename: string; expanded: string; } /** * Contains info about variable used in document. */ export class VariableInfo { name: string; ident: string; comment: string; definitions: Range[]; usage: Range[]; public isLocal(): boolean { return this.name.charAt(0) == '_'; } } /** * Info about macro. */ export class Macroinfo { name: string; arguments: string = null; definitions: MacroDefinition[] } /** * Info about one specific macro definition. */ export class MacroDefinition { position: Range; value: string; filename: string; } /** * vscode compatible range */ export class Range { constructor( public start: Position, public end: Position ) {} } /** * vscode compatible position */ export class Position { constructor( public line: number, public character: number ) {} } export interface Options { checkPaths?: boolean; pathsRoot?: string; ignoredVariables?: string[]; includePrefixes?: { [key: string]: string }; contextSeparation?: boolean; } }
SkaceKamen/vscode-sqflint
server/src/sqflint.ts
TypeScript
mit
13,048
// Fill out your copyright notice in the Description page of Project Settings. #include "Chapter5.h" #include "TimeOfDayHandler.h" #include "Clock.h" // Sets default values AClock::AClock() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; RootSceneComponent = CreateDefaultSubobject<USceneComponent>("RootSceneComponent"); ClockFace = CreateDefaultSubobject<UStaticMeshComponent>("ClockFace"); HourHand = CreateDefaultSubobject<UStaticMeshComponent>("HourHand"); MinuteHand = CreateDefaultSubobject<UStaticMeshComponent>("MinuteHand"); HourHandle = CreateDefaultSubobject<USceneComponent>("HourHandle"); MinuteHandle = CreateDefaultSubobject<USceneComponent>("MinuteHandle"); auto MeshAsset = ConstructorHelpers::FObjectFinder<UStaticMesh>(TEXT("StaticMesh'/Engine/BasicShapes/Cylinder.Cylinder'")); if (MeshAsset.Object != nullptr) { ClockFace->SetStaticMesh(MeshAsset.Object); HourHand->SetStaticMesh(MeshAsset.Object); MinuteHand->SetStaticMesh(MeshAsset.Object); } RootComponent = RootSceneComponent; HourHand->AttachTo(HourHandle); MinuteHand->AttachTo(MinuteHandle); HourHandle->AttachTo(RootSceneComponent); MinuteHandle->AttachTo(RootSceneComponent); ClockFace->AttachTo(RootSceneComponent); ClockFace->SetRelativeTransform(FTransform(FRotator(90, 0, 0), FVector(10, 0, 0), FVector(2, 2, 0.1))); HourHand->SetRelativeTransform(FTransform(FRotator(0, 0, 0), FVector(0, 0, 25), FVector(0.1, 0.1, 0.5))); MinuteHand->SetRelativeTransform(FTransform(FRotator(0, 0, 0), FVector(0, 0, 50), FVector(0.1, 0.1, 1))); } // Called when the game starts or when spawned void AClock::BeginPlay() { Super::BeginPlay(); TArray<AActor*> TimeOfDayHandlers; UGameplayStatics::GetAllActorsOfClass(GetWorld(), ATimeOfDayHandler::StaticClass(), TimeOfDayHandlers); if (TimeOfDayHandlers.Num() != 0) { auto TimeOfDayHandler = Cast<ATimeOfDayHandler>(TimeOfDayHandlers[0]); MyDelegateHandle = TimeOfDayHandler->OnTimeChanged.AddUObject(this, &AClock::TimeChanged); } } // Called every frame void AClock::Tick( float DeltaTime ) { Super::Tick( DeltaTime ); } void AClock::TimeChanged(int32 Hours, int32 Minutes) { HourHandle->SetRelativeRotation(FRotator( 0, 0,30 * Hours)); MinuteHandle->SetRelativeRotation(FRotator(0,0,6 * Minutes)); }
sunithshetty/Unreal-Engine-4-Scripting-with-CPlusPlus-Cookbook
Chapter05/source/Chapter5/Clock.cpp
C++
mit
2,382
using System; using System.Collections.Generic; using System.Reflection; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media.Imaging; using C1.WPF.Toolbar; using Memento.Component.WPF; namespace Memento.JMS.Toolbar { /// <summary> /// 菜单栏通用组件 /// </summary> public partial class ToolbarControl : UserControl { #region 成员变量 private static Dictionary<string, ICommand> m_AllCommands = new Dictionary<string, ICommand>(); #endregion #region 构造函数 /// <summary> /// 菜单栏通用组件 /// </summary> public ToolbarControl() { InitializeComponent(); } #endregion #region 公开方法 /// <summary> /// 注册命令 /// </summary> /// <param name="command">命令</param> public void RegisterCommand(ICommand command) { CommandAttribute cmdAttr = BaseCommand.GetCommandAttr(command); if(cmdAttr == null) { throw new ArgumentNullException("There is no attribute defined in the command."); } if (!m_AllCommands.ContainsKey(cmdAttr.TabItemHeader)) { // 创建新菜单 m_AllCommands[cmdAttr.TabItemHeader] = command; C1ToolbarTabItem tabItem = CreateC1ToolbarTabItem(command, cmdAttr.TabItemHeader); toolbar.ToolbarItems.Add(tabItem); tabItem.IsSelected = true; } else if (command != m_AllCommands[cmdAttr.TabItemHeader]) { CancelCommand(command); RegisterCommand(command); } } /// <summary> /// 注销命令 /// </summary> /// <param name="command">命令</param> public void CancelCommand(ICommand command) { CommandAttribute cmdAttr = BaseCommand.GetCommandAttr(command); if (cmdAttr == null) { throw new ArgumentNullException("There is no attribute defined in the command."); } if (m_AllCommands.ContainsKey(cmdAttr.TabItemHeader)) { m_AllCommands.Remove(cmdAttr.TabItemHeader); int toolbarItemsCount = toolbar.ToolbarItems.Count; for (int i = 0; i < toolbarItemsCount; i++) { C1ToolbarTabItem tabItem = toolbar.ToolbarItems[i] as C1ToolbarTabItem; if (tabItem != null && tabItem.Header.ToString() == cmdAttr.TabItemHeader) { toolbar.ToolbarItems.Remove(tabItem); break; } } } else { throw new Exception("The command is not registered by RegisterCommand method."); } } /// <summary> /// 注销命令 /// </summary> /// <param name="tabItemHeader">命令页签标题</param> public void CancelCommand(string tabItemHeader) { if (m_AllCommands.ContainsKey(tabItemHeader)) { CancelCommand(m_AllCommands[tabItemHeader]); } } /// <summary> /// 注销某个命令下的某个方法 /// </summary> /// <param name="command">命令</param> /// <param name="methodName">方法名称</param> public void CancelMethod(ICommand command, string methodName) { CommandAttribute cmdAttr = BaseCommand.GetCommandAttr(command); if (cmdAttr == null) { throw new ArgumentNullException("There is no attribute defined in the command."); } bool flag = false; foreach (C1ToolbarTabItem tabItem in toolbar.ToolbarItems) { if (tabItem != null && tabItem.Header.ToString() == cmdAttr.TabItemHeader) { int groupCount = tabItem.Groups.Count; for (int groupIndex = 0; groupIndex < groupCount; groupIndex++) { C1ToolbarGroup group = tabItem.Groups[groupIndex]; int btnCount = group.Items.Count; for (int btnIndex = 0; btnIndex < btnCount; btnIndex++) { C1ToolbarButton button = group.Items[btnIndex] as C1ToolbarButton; if (button != null && button.Name == "btn" + methodName) { flag = true; group.Items.Remove(button); break; } } if (flag) { // 移除空组 if (group.Items.Count == 0) { tabItem.Groups.Remove(group); } break; } } break; } } } /// <summary> /// 刷新命令 /// </summary> /// <param name="command">命令</param> public void RefreshCommand(ICommand command) { MethodInfo[] mis = command.GetType().GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); foreach(MethodInfo mi in mis) { string key = "cmd" + mi.Name; C1ToolbarCommand cmd = grid.Resources[key] as C1ToolbarCommand; bool canExecute = command.EnabledItems.Contains(mi.Name); if (cmd != null) { CommandManager.RegisterClassCommandBinding( GetType(), new CommandBinding( cmd, (sender, e) => { try { mi.Invoke(command, null); } catch (Exception ex) { MsgBoxHelper.ShowError(ex.InnerException); } }, (sender, e) => { e.CanExecute = canExecute; })); } } } #endregion #region 其他方法 // 创建 C1ToolbarTabItem private C1ToolbarTabItem CreateC1ToolbarTabItem(ICommand command, string tabItemHeader) { C1ToolbarTabItem tabItem = new C1ToolbarTabItem(); tabItem.Header = tabItemHeader; Dictionary<int, List<CommandMethodAttribute>> cmdMethodAttrs = new Dictionary<int, List<CommandMethodAttribute>>(); foreach(MethodInfo mi in command.GetType().GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public)) { foreach(object attr in mi.GetCustomAttributes(true)) { if(attr is CommandMethodAttribute) { CommandMethodAttribute cmdMethod = attr as CommandMethodAttribute; if(cmdMethod != null) { if(!cmdMethodAttrs.ContainsKey(cmdMethod.GroupIndex)) { cmdMethodAttrs[cmdMethod.GroupIndex] = new List<CommandMethodAttribute>(); } cmdMethodAttrs[cmdMethod.GroupIndex].Add(cmdMethod); break; } } } } foreach(int gourpIndex in cmdMethodAttrs.Keys) { C1ToolbarGroup group = CreateC1ToolbarGroup(cmdMethodAttrs[gourpIndex], command.GetType()); tabItem.Groups.Add(group); } return tabItem; } // 创建 C1ToolbarGroup private C1ToolbarGroup CreateC1ToolbarGroup(List<CommandMethodAttribute> methods, Type cmdType) { C1ToolbarGroup group = new C1ToolbarGroup(); C1ToolbarGroupSizeDefinition groupSizeDef = new C1ToolbarGroupSizeDefinition(); groupSizeDef.ControlSizes.Add(C1ToolbarControlSize.Large); group.GroupSizeDefinitions.Add(groupSizeDef); foreach(CommandMethodAttribute cmdMethodAttr in methods) { if (cmdMethodAttr.IsEnable) { string key = "cmd" + cmdMethodAttr.Name; C1ToolbarCommand toolbarCmd = null; if (grid.Resources.Contains(key)) { grid.Resources.Remove(key); } toolbarCmd = new C1ToolbarCommand(); toolbarCmd.LabelTitle = cmdMethodAttr.Title; toolbarCmd.LargeImageSource = new BitmapImage(new Uri(string.Format("/{0};component/Resources/{1}32.png", cmdType.BaseType.Namespace, cmdMethodAttr.Name), UriKind.Relative)); toolbarCmd.SmallImageSource = new BitmapImage(new Uri(string.Format("/{0};component/Resources/{1}.png", cmdType.BaseType.Namespace, cmdMethodAttr.Name), UriKind.Relative)); grid.Resources.Add(key, toolbarCmd); C1ToolbarButton button = new C1ToolbarButton(); button.Name = "btn" + cmdMethodAttr.Name; button.Command = toolbarCmd; group.Items.Add(button); } } return group; } #endregion } }
Memento1990/Memento
JMS/JMSToolbar/ToolbarControl.xaml.cs
C#
mit
10,199
'use strict'; angular.module('ucllApp') .controller('LogoutController', function (Auth) { Auth.logout(); });
craftworkz/ucll-workshop-jhipster
jhipster-demo/src/main/webapp/scripts/app/account/logout/logout.controller.js
JavaScript
mit
126
/* The following code example is taken from the book * "The C++ Standard Library - A Tutorial and Reference, 2nd Edition" * by Nicolai M. Josuttis, Addison-Wesley, 2012 * * (C) Copyright Nicolai M. Josuttis 2012. * Permission to copy, use, modify, sell and distribute this software * is granted provided this copyright notice appears in all copies. * This software is provided "as is" without express or implied * warranty, and with no claim as to its suitability for any purpose. */ #include <unordered_map> #include <string> #include <iostream> using namespace std; int main() { unordered_map<string,double> coll { { "tim", 9.9 }, { "struppi", 11.77 } }; // square the value of each element: for (pair<const string,double>& elem : coll) { elem.second *= elem.second; } // print each element (key and value): for (const auto& elem : coll) { cout << elem.first << ": " << elem.second << endl; } }
iZhangHui/cppstdlib
stl/unordmap1.cpp
C++
mit
1,036
/* * Copyright (C) 2012 David Geary. This code is from the book * Core HTML5 Canvas, published by Prentice-Hall in 2012. * * License: * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * The Software may not be used to create training material of any sort, * including courses, books, instructional videos, presentations, etc. * without the express written consent of David Geary. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ var canvas = document.getElementById('canvas'), context = canvas.getContext('2d'), CENTROID_RADIUS = 10, CENTROID_STROKE_STYLE = 'rgba(0, 0, 0, 0.5)', CENTROID_FILL_STYLE ='rgba(80, 190, 240, 0.6)', GUIDEWIRE_STROKE_STYLE = 'goldenrod', GUIDEWIRE_FILL_STYLE = 'rgba(85, 190, 240, 0.6)', TEXT_FILL_STYLE = 'rgba(100, 130, 240, 0.5)', TEXT_STROKE_STYLE = 'rgba(200, 0, 0, 0.7)', TEXT_SIZE = 64, GUIDEWIRE_STROKE_STYLE = 'goldenrod', GUIDEWIRE_FILL_STYLE = 'rgba(85, 190, 240, 0.6)', circle = { x: canvas.width/2, y: canvas.height/2, radius: 200 }; // Functions..................................................... function drawGrid(color, stepx, stepy) { context.save() context.shadowColor = undefined; context.shadowOffsetX = 0; context.shadowOffsetY = 0; context.strokeStyle = color; context.fillStyle = '#ffffff'; context.lineWidth = 0.5; context.fillRect(0, 0, context.canvas.width, context.canvas.height); for (var i = stepx + 0.5; i < context.canvas.width; i += stepx) { context.beginPath(); context.moveTo(i, 0); context.lineTo(i, context.canvas.height); context.stroke(); } for (var i = stepy + 0.5; i < context.canvas.height; i += stepy) { context.beginPath(); context.moveTo(0, i); context.lineTo(context.canvas.width, i); context.stroke(); } context.restore(); } // Drawing functions............................................. function drawCentroid() { context.beginPath(); context.save(); context.strokeStyle = CENTROID_STROKE_STYLE; context.fillStyle = CENTROID_FILL_STYLE; context.arc(circle.x, circle.y, CENTROID_RADIUS, 0, Math.PI*2, false); context.stroke(); context.fill(); context.restore(); } function drawCircularText(string, startAngle, endAngle) { var radius = circle.radius, angleDecrement = (startAngle - endAngle)/(string.length-1), angle = parseFloat(startAngle), index = 0, character; context.save(); context.fillStyle = TEXT_FILL_STYLE; context.strokeStyle = TEXT_STROKE_STYLE; context.font = TEXT_SIZE + 'px Lucida Sans'; while (index < string.length) { character = string.charAt(index); context.save(); context.beginPath(); context.translate( circle.x + Math.cos(angle) * radius, circle.y - Math.sin(angle) * radius); context.rotate(Math.PI/2 - angle); context.fillText(character, 0, 0); context.strokeText(character, 0, 0); angle -= angleDecrement; index++; context.restore(); } context.restore(); } // Initialization................................................ if (navigator.userAgent.indexOf('Opera') === -1) context.shadowColor = 'rgba(0, 0, 0, 0.4)'; context.shadowOffsetX = 2; context.shadowOffsetY = 2; context.shadowBlur = 5; context.textAlign = 'center'; context.textBaseline = 'middle'; drawGrid('lightgray', 10, 10); drawCentroid(); drawCircularText("Clockwise around the circle", Math.PI*2, Math.PI/8);
yuesir/HTML5-Canvas
ch03/example-3.9/example.js
JavaScript
mit
4,545
// @flow import React, { type Node } from 'react'; import classnames from 'classnames'; import { Tooltip as ReactAccessibleTooltip } from 'react-accessible-tooltip'; import './tooltip.scss'; function Tooltip({ label, overlay }: { label: Node, overlay: Node }) { return ( <ReactAccessibleTooltip className="tooltip" label={({ labelAttributes }: { labelAttributes: Object }) => ( <span className="tooltip__label" {...labelAttributes}> <strong>{label}</strong> </span> )} overlay={({ overlayAttributes, isHidden, }: { overlayAttributes: Object, isHidden: boolean, }) => ( <span className={classnames('tooltip__overlay', { 'tooltip__overlay--hidden': isHidden, })} {...overlayAttributes} > <span className="tooltip__overlay-inner">{overlay}</span> </span> )} /> ); } export default Tooltip;
ryami333/react-accessible-tooltip
packages/docs/src/components/Tooltip/Tooltip.js
JavaScript
mit
1,166
<?php namespace Adriatic\PHPAkademija\DesignPattern\FactoryMethod\MailerImplementations; use Adriatic\PHPAkademija\DesignPattern\FactoryMethod\Newsletter; class GiveawayNewsletter extends Newsletter { public function getContent() : string { return $this->recipientName . ', nagradna igra!'; } }
adriatichr/php-academy
example/src/DesignPattern/FactoryMethod/MailerImplementations/GiveawayNewsletter.php
PHP
mit
318
<?php function draw_html(){ set_lang(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script src="inc/js/kvm-vdi-openstack.js"></script> </head> <body> <style> .input-group-addon { min-width:80px; } </style> <form id="new_vm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><?php echo _("Create virtual machine(s)");?></h4> </div> <div class="modal-body"> <div class="row targetConfig"> <div class="col-md-6"> <label><?php echo _("Machine type:");?></label> <select class="form-control selectClass" name="OSMachineType" id="OSMachineType" required tabindex="1"> <option selected value=""><?php echo _("Please select machine type");?></option> <option value="initialmachine"><?php echo _("Initial machine");?></option> <option value="sourcemachine"><?php echo _("Source machine");?></option> <option value="vdimachine"><?php echo _("VDI machine");?></option> </select> </div> <div class="col-md-6"> <label><?php echo _("Machine source:");?></label> <select class="form-control selectClass" name="OSSource" id="OSSource" required> </select> </div> </div> <div class="row"> <div class="col-md-6"> <label><?php echo _("Networks:");?><i class="fa fa-spinner fa-spin fa-1x fa-fw hide" id="OSNetworkLoad"></i></label> <select multiple class="form-control osselection" name="OSNetworks" id="OSNetworks" tabindex="3" required type="number"> </select> </div> <div class="col-md-6 hide" id="OSVolumeSize"> <label><?php echo _("Volume size GB:");?></label> <input type="number" name="OSVolumeGB" id="OSVolumeGB" min="1" value="1" class="form-control" required> </div> </div> <div class="row"> <div class="col-md-6" id="newmachine-os"> <label><?php echo _("System info:");?></label> <div class="input-group"> <span class="input-group-addon"><?php echo _("OS type");?></span> <select class="form-control osselection" name="os_type" id="os_type" tabindex="3" required type="number"> <option selected value=""><?php echo _("Please select OS type");?></option> <option value="linux"><?php echo _("Linux");?></option> <option value="windows"><?php echo _("Windows");?></option> </select> </div> </div> <div class="col-md-6"> <label><?php echo _("Flavors")?><i class="fa fa-spinner fa-spin fa-1x fa-fw hide" id="OSFlavorLoad"></i></label> <select class="form-control selectClass" name="OSFlavor" id="OSFlavor" required tabindex="1"> </select> </div> </div> <div class="row machineDeployInfo"> <div class="col-md-6"> <label><?php echo _("Machine name:");?></label> <input type="text" name="machinename" id="machinename" placeholder="somename-" class="form-control" required pattern="[a-zA-Z0-9-_]+" oninvalid="setCustomValidity(<?php echo ("'Illegal characters detected'");?>)" onchange="try{setCustomValidity('')}catch(e){}" > </div> <div class="col-md-6 hide" id="OSMachineCount"> <label><?php echo _("Number of machines to create:");?></label> <input type="number" name="machinecount" id="machinecount" min="1" value="1" class="form-control" required> </div> </div> </div> <div class="modal-footer"> <div class="row"> <div class="col-md-7"> <div class="alert alert-info text-left hide" id="new_vm_creation_info_box"></div> </div> <div class="col-md-5"> <button type="button" class="btn btn-default create_vm_buttons" data-dismiss="modal"><?php echo _("Close");?></button> <button type="button" class="btn btn-primary create_vm_buttons" id="create-vm-button-click"><?php echo _("Create VMs");?></button> <input type="submit" class="hide"> </div> </div> </div> </div> </form> </body> <script type="text/javascript"> $(document).ready(function () { loadNetworkList(); loadFlavorList(); }); </script> </html> <?php }
Seitanas/kvm-vdi
inc/modules/OpenStack/NewVM.php
PHP
mit
5,047
var router = new AiRouter(); router.route('/',{ name:'HOME', action:function(params, query) { document.getElementById("switch").innerHTML = "Changed to Home page!"; console.log('Home Page'); }, }); router.route('/projects/:projectId/tests/:testId',{ name:'HOME', action:function(params, query) { document.getElementById("switch").innerHTML = "Changed to Projects page!"; console.log(params); console.log(query); }, }); router.route('/posts/:postId/comments/:commentId',{ name:'HOME', beforeAction:function(params, query) { console.log('This function trigger before Action'); console.log(params); console.log(query); }, action:function(params, query) { document.getElementById("switch").innerHTML = "Changed to Blog page!"; console.log('This function trigger Action'); console.log(params); console.log(query); }, afterAction:function(params, query) { console.log('This function triggers after Action'); console.log(params); console.log(query); } }); router.notFound({ action:function() { document.getElementById("switch").innerHTML = "No Route Found page!"; console.log('No Route Found page'); } }); function go1() { router.go('/demo/#/'); } function go2() { router.go('/demo/#/projects/123/tests/321'); } function go3() { router.go('/demo/#/posts/123/comments/A2516BC'); } function go4() { var things = ['Rock', 'Paper', 'Scissor']; var thing = things[Math.floor(Math.random()*things.length)]; router.go('/demo/#/'+thing); }
nedyalkovV/AiRouter
demo/demo/demo.js
JavaScript
mit
1,653
#!/usr/local/bin/python3 import argparse import gym import logging import tensorflow as tf from dqn_agent import DQNAgent from network import Network from replay_memory import ReplayMemory def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--log_level', default='INFO', help='Log verbosity') # Environment parser.add_argument('--env', default='CartPole-v0', help='OpenAI Gym environment name') parser.add_argument('--monitor', action='store_true', help='Turn on OpenAI Gym monitor') parser.add_argument('--monitor_path', default='/tmp/gym', help='Path for OpenAI Gym monitor logs') parser.add_argument('--disable_video', action='store_true', help='Disable video recording while when running the monitor') # Network parser.add_argument('--network', default='simple', choices=['simple', 'cnn'], help='Network architecture type') parser.add_argument('--lr', default=0.001, type=float, help='Learning rate') parser.add_argument('--reg_param', default=0.001, type=float, help='Regularization param') parser.add_argument('--optimizer', default='sgd', choices=['adadelta', 'adagrad', 'adam', 'ftrl', 'sgd', 'momentum', 'rmsprop'], help='Type of optimizer for gradient descent') parser.add_argument('--momentum', default=0.9, type=float, help='Momentum value for MomentumOptimizer') parser.add_argument('--rmsprop_decay', default=0.95, type=float, help='Decay for RMSPropOptimizer') # Agent parser.add_argument('--num_episodes', default=10000, type=int, help='Number of episodes to train') parser.add_argument('--max_steps_per_episode', default=1000, type=int, help='Max steps to train for each episode') parser.add_argument('--minibatch_size', default=30, type=int, help='Minibatch size for each training step') parser.add_argument('--frames_per_state', default=1, type=int, help='Number of consecutive frames that form a state') parser.add_argument('--resize_width', default=0, type=int, help='Resized screen width for frame pre-processing (0 for no resizing)') parser.add_argument('--resize_height', default=0, type=int, help='Resized screen height for frame pre-processing (0 for no resizing)') parser.add_argument('--reward_discount', default=0.9, type=float, help='Discount factor for future rewards') parser.add_argument('--replay_memory_capacity', default=10000, type=int, help='Max size of the memory for experience replay') parser.add_argument('--replay_start_size', default=0, type=int, help='Size to prefill the replay memory to based on random actions') parser.add_argument('--init_random_action_prob', default=0.9, type=float, help='Initial probability for choosing random actions') parser.add_argument('--min_random_action_prob', default=0.1, type=float, help='Threshold at which to stop decaying random action probability') parser.add_argument('--random_action_explore_steps', default=10000, type=int, help='Number of steps over which to decay the random action probability') parser.add_argument('--update_freq', default=1, type=int, help='Number of actions by the agent between successive learning updates') parser.add_argument('--target_update_freq', default=10000, type=int, help='Target network update frequency in terms of number of training steps') # Distribution parser.add_argument('--ps_hosts', default='', help='Parameter Servers. Comma separated list of host:port pairs') parser.add_argument('--worker_hosts', default='localhost:0', help='Worker hosts. Comma separated list of host:port pairs') parser.add_argument('--job', default='worker', choices=['ps', 'worker'], help='Whether this instance is a param server or a worker') parser.add_argument('--task_id', default=0, type=int, help='Index of this task within the job') parser.add_argument('--gpu_id', default=0, type=int, help='Index of the GPU to run the training on') parser.add_argument('--sync', action='store_true', help='Whether to perform synchronous training') parser.add_argument('--disable_cpu_param_pinning', action='store_true', help='If set, param server will not pin the varaibles to CPU, allowing ' 'TensorFlow to default to GPU:0 if the host has GPU devices') parser.add_argument('--disable_target_replication', action='store_true', help='Unless set, the target params will be replicated on each GPU. ' 'Setting the flag defaults to a single set of target params managed ' 'by the param server.') # Summary parser.add_argument('--logdir', default='/tmp/train_logs', help='Directory for training summary and logs') parser.add_argument('--summary_freq', default=100, type=int, help='Frequency for writing summary (in terms of global steps') return parser.parse_args() def run_worker(cluster, server, args): env = gym.make(args.env) worker_job = args.job num_workers = len(cluster.job_tasks(worker_job)) ps_device = None if num_workers > 1 and not args.disable_cpu_param_pinning: # If in a distributed setup, have param servers pin params to CPU. # Otherwise, in a multi-GPU setup, /gpu:0 would be used for params # by default, and it becomes a communication bottleneck. ps_device = '/cpu' # If no GPU devices are found, then allow_soft_placement in the # config below results in falling back to CPU. worker_device = '/job:%s/task:%d/gpu:%d' % \ (worker_job, args.task_id, args.gpu_id) replica_setter = tf.train.replica_device_setter( worker_device=worker_device, cluster=cluster, ) with tf.device(replica_setter): network = Network.create_network( config=args, input_shape=DQNAgent.get_input_shape(env, args), num_actions=env.action_space.n, num_replicas=num_workers, ps_device=ps_device, worker_device=worker_device, ) init_op = tf.initialize_all_variables() # Designate the first worker task as the chief is_chief = (args.task_id == 0) # Create a Supervisor that oversees training and co-ordination of workers sv = tf.train.Supervisor( is_chief=is_chief, logdir=args.logdir, init_op=init_op, global_step=network.global_step, summary_op=None, # Explicitly disable as DQNAgent handles summaries recovery_wait_secs=3, ) # Start the gym monitor if needed video = False if args.disable_video else None if args.monitor: env.monitor.start(args.monitor_path, resume=True, video_callable=video) # Initialize memory for experience replay replay_memory = ReplayMemory(args.replay_memory_capacity) # Start the session and kick-off the train loop config=tf.ConfigProto(log_device_placement=True, allow_soft_placement=True) with sv.managed_session(server.target, config=config) as session: dqn_agent = DQNAgent( env, network, session, replay_memory, args, enable_summary=is_chief, # Log summaries only from the chief worker ) dqn_agent.train(args.num_episodes, args.max_steps_per_episode, sv) # Close the gym monitor if args.monitor: env.monitor.close() # Stop all other services sv.stop() if __name__ == '__main__': args = parse_args() logging.getLogger().setLevel(args.log_level) ps_hosts = args.ps_hosts.split(',') if args.ps_hosts else [] worker_hosts = args.worker_hosts.split(',') if args.worker_hosts else [] cluster = tf.train.ClusterSpec({'ps': ps_hosts, 'worker': worker_hosts}) # Create a TensorFlow server that acts either as a param server or # as a worker. For non-distributed setup, we still create a single # instance cluster without any --ps_hosts and one item in --worker_hosts # that corresponds to localhost. server = tf.train.Server( cluster, job_name=args.job, task_index=args.task_id ) if args.job == 'ps': # Param server server.join() elif args.job == 'worker': # Start the worker and run the train loop run_worker(cluster, server, args)
viswanathgs/dist-dqn
src/main.py
Python
mit
7,997
User.inject({ statics: { log: function() { var str = Array.create(arguments).join(' '); if (session && session.user) str = '[' + session.user.name + '] ' + str; app.log(str); }, logError: function(title, e) { var shortDesc = (e.fileName ? 'Error in ' + e.fileName + ', Line ' + e.lineNumber : 'Error') + ' (' + title + '): ' + e; // In some situations, the global req object might not be available, // so make sure we check to not produce another error. if (global.req && req.path) shortDesc += '\n(' + req.path + ')'; // Generate the stacktrace: var longDesc = shortDesc; if (e.javaException) { var sw = new java.io.StringWriter(); e.javaException.printStackTrace(new java.io.PrintWriter(sw)); longDesc += '\nStacktrace:\n' + sw.toString(); } User.log(longDesc); var from = app.properties.errorFromAddress || app.properties.serverAddress; var to = app.properties.errorToAddress; if (from && to) { try { // Send an error mail: var mail = new Mail(); mail.setFrom(from); mail.setTo(to); mail.setSubject('[' + new Date().format( 'yyyy/MM/dd HH:mm:ss') + '] ' + title); if (session.user != null) longDesc = '[' + session.user.name + '] ' + longDesc; mail.addText(longDesc); mail.send(); } catch (e) { } } return shortDesc; }, getHost: function() { var host = req.data.http_remotehost; var address = java.net.InetAddress.getByName(host); var name = address && address.getCanonicalHostName(); return name || host; } } });
lehni/boots
base/helma/User/functions.js
JavaScript
mit
1,599
import { bootstrap } from '@angular/platform-browser-dynamic'; import { enableProdMode } from '@angular/core'; import { HTTP_PROVIDERS } from '@angular/http'; import { DestinyGrimoireAppComponent, environment } from './app/'; if (environment.production) { enableProdMode(); } bootstrap(DestinyGrimoireAppComponent, [HTTP_PROVIDERS]);
Foshkey/destiny-grimoire
src/main.ts
TypeScript
mit
339
class CreateTweets < ActiveRecord::Migration def change create_table :tweets do |t| t.string :xid t.string :name t.string :screen_name t.text :text t.text :media_url t.text :profile_image_url t.datetime :tweeted_at t.timestamps end end end
cbetta/battlehack-dashboard
db/migrate/20130716134921_create_tweets.rb
Ruby
mit
301
/** * @since 2019-07-19 14:13 * @author vivaxy * * Call simple function. 7.964s * Call function await promise. 16.687s * Call function with if logic. 9.612s */ let resolved = false; function request() { return new Promise(function(resolve) { setTimeout(function() { resolve(true); }, 1000); }); } const promise = request(); async function callSimpleFunction() { return 0; } async function callFunctionWithAwaitPromise() { await promise; return 0; } async function callFunctionWithIfLogic() { if (resolved) { return 0; } await promise; return 0; } function getTime(s) { return (Date.now() - s) / 1000 + 's'; } (async function() { await promise; resolved = true; const loopCount = 1e8; let s = Date.now(); for (let i = 0; i < loopCount; i++) { await callSimpleFunction(); } console.log('Call simple function.', getTime(s)); s = Date.now(); for (let i = 0; i < loopCount; i++) { await callFunctionWithAwaitPromise(); } console.log('Call function await promise.', getTime(s)); s = Date.now(); for (let i = 0; i < loopCount; i++) { await callFunctionWithIfLogic(); } console.log('Call function with if logic.', getTime(s)); })();
vivaxy/course
benchmark/await-resolved-promise/index.js
JavaScript
mit
1,223
package speedy.model.database.mainmemory.datasource.nodes; import speedy.model.database.mainmemory.datasource.operators.INodeVisitor; public class SetNode extends IntermediateNode { boolean cloned = false; public SetNode(String label) { super(label); } public SetNode(String label, Object value) { super(label, value); } public boolean isCloned() { return cloned; } public void setCloned(boolean cloned) { this.cloned = cloned; } public boolean isRequiredSet() { return this.getChild(0).isRequired(); } public void accept(INodeVisitor visitor) { visitor.visitSetNode(this); } }
dbunibas/Speedy
src/speedy/model/database/mainmemory/datasource/nodes/SetNode.java
Java
mit
700
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { Ng2CompleterModule } from "ng2-completer"; import { AgmCoreModule } from "angular2-google-maps/core"; import { AppComponent } from './app.component'; import { homeComponent } from './components/home/home.component'; import { weathersComponent } from './components/weathers/weathers.component'; import { itemsComponent } from './components/weathers/items.component'; import {WeatherService} from './services/weather.service'; @NgModule({ imports: [ BrowserModule, HttpModule, FormsModule, ReactiveFormsModule, Ng2CompleterModule, AgmCoreModule.forRoot({ apiKey: "AIzaSyDlvJY0jGnu7tHPmLuqVye7V-fu2_-DPCk", libraries: ["places"] })], declarations: [ AppComponent, homeComponent, weathersComponent, itemsComponent ], providers: [WeatherService], bootstrap: [ AppComponent ] }) export class AppModule { }
pratik-trianz/hello_weather
src/app/app.module.ts
TypeScript
mit
1,066
/* * This file is part of Sponge, licensed under the MIT License (MIT). * * Copyright (c) SpongePowered.org <http://www.spongepowered.org> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.spongepowered.api.entity.living.complex; import org.spongepowered.api.entity.Entity; /** * Represents a part of a {@link ComplexLiving}. * <p>Parts are usually created to have multiple bounding boxes associated * with a larger entity.</p> */ public interface ComplexLivingPart extends Entity { /** * Gets the associated parent of this part. * * @return The associated parent */ ComplexLiving getParent(); }
Fozie/SpongeAPI
src/main/java/org/spongepowered/api/entity/living/complex/ComplexLivingPart.java
Java
mit
1,706
package com.youdevise.hsd; public enum QueryType { SELECT("select"), INSERT("insert"), UPDATE("update"), DELETE("delete"); private String keyword; private QueryType(String keyword) { this.keyword = keyword; } public boolean matches(String sql) { return sql.trim().toLowerCase().startsWith(keyword); } public static QueryType forSql(String sql) { for (QueryType queryType : QueryType.values()) { if (queryType.matches(sql)) { return queryType; } } throw new IllegalArgumentException("Query type not recognised for query: " + sql); } }
tim-group/High-Speed-Dirt
src/main/java/com/youdevise/hsd/QueryType.java
Java
mit
673
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SumArrayElements")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("SumArrayElements")] [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("d4101c9b-8202-469d-ad94-71de67629ad8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
dakh93/ProgrammingFundamentals
Arrays/SimpleArrayProcessing/SumArrayElements/Properties/AssemblyInfo.cs
C#
mit
1,426
class AddOpenAllEntriesToUsers < ActiveRecord::Migration[5.2] def up add_column :users, :open_all_entries, :boolean, null: false, default: false User.all.each do |u| u.update_column :open_all_entries, false end end def down change_column :users, :open_all_entries, :boolean end end
amatriain/feedbunch
FeedBunch-app/db/migrate/20131121205700_add_open_all_entries_to_users.rb
Ruby
mit
314
using System; using System.Collections.Generic; namespace Puresharp { static public partial class Data { public class Store<T> : IStore<T> where T : class { private Dictionary<string, T> m_Dictionary; public Store() { this.m_Dictionary = new Dictionary<string, T>(); } public T this[string name] { get { this.m_Dictionary.TryGetValue(name, out var _value); return _value; } set { this.m_Dictionary[name] = value; } } public void Add(string name, T value) { this.m_Dictionary.Add(name, value); } public void Remove(string name) { this.m_Dictionary.Remove(name); } } } }
Virtuoze/Puresharp
Puresharp/Puresharp/Data/Data.Store.cs
C#
mit
933
// Copyright (c) 2014 The Drivercoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/hmac_sha256.h" #include <string.h> CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen) { unsigned char rkey[64]; if (keylen <= 64) { memcpy(rkey, key, keylen); memset(rkey + keylen, 0, 64 - keylen); } else { CSHA256().Write(key, keylen).Finalize(rkey); memset(rkey + 32, 0, 32); } for (int n = 0; n < 64; n++) rkey[n] ^= 0x5c; outer.Write(rkey, 64); for (int n = 0; n < 64; n++) rkey[n] ^= 0x5c ^ 0x36; inner.Write(rkey, 64); } void CHMAC_SHA256::Finalize(unsigned char hash[OUTPUT_SIZE]) { unsigned char temp[32]; inner.Finalize(temp); outer.Write(temp, 32).Finalize(hash); }
drivercoin/drivercoin
src/crypto/hmac_sha256.cpp
C++
mit
900
'use strict'; FbFriends.StatsView = Backbone.View.extend({ events: { }, initialize: function(options) { _.extend(this, options); this.friends.on('reset', this.render, this); }, render: function(event) { this.showSexRepartition(); // this.showTopVille(); this.showRelationRepartition(); }, showSexRepartition: function() { var repartition = this.friends.getRepartitionSexe(); this.$el.find(".pie-sexes").highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: 0, plotShadow: false }, title: { text: 'Sexes', align: 'center', verticalAlign: 'middle', y: 50 }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { dataLabels: { enabled: true, distance: -50, style: { fontWeight: 'bold', color: 'white', textShadow: '0px 1px 2px black' } }, startAngle: -90, endAngle: 90, center: ['50%', '75%'] } }, series: [{ type: 'pie', name: 'Sexes', innerSize: '50%', data: [ ['Homme', repartition["male"] || 0.0], ['Femme', repartition["female"] || 0.0], ['Non défini', repartition[""] || 0.0] ] }] }); }, showRelationRepartition: function() { var repartition = this.friends.getRelationShipPercent(); this.$el.find(".pie-relation").highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Relations' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<b>{point.name}</b>: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' } } } }, series: [{ type: 'pie', data: _.pairs(repartition) }] }); }, // not yet implemented showTopVille: function() { // var data = this.friends.getTopVillesData(); // // this.$el.find('.pie-top-villes').highcharts({ // chart: { // type: 'column' // }, // title: { // text: 'Top 10 des villes' // }, // xAxis: { // categories: [] // }, // yAxis: { // min: 0 // }, // tooltip: { // headerFormat: '<span style="font-size:10px">{point.key}</span><table>', // pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + // '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>', // footerFormat: '</table>', // shared: true, // useHTML: true // }, // plotOptions: { // column: { // pointPadding: 0.2, // borderWidth: 0 // } // }, // series: [{ // name: 'Tokyo', // data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] // // }, { // name: 'New York', // data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3] // // }, { // name: 'London', // data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2] // // }, { // name: 'Berlin', // data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1] // // }] // }); } });
FXHibon/facebook-fun
frontend/app/friends/statistics/StatsView.js
JavaScript
mit
4,807
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2018_02_01 module Models # # The routes table associated with the ExpressRouteCircuit. # class ExpressRouteCircuitRoutesTableSummary include MsRestAzure # @return [String] Neighbor attr_accessor :neighbor # @return [Integer] BGP version number spoken to the neighbor. attr_accessor :v # @return [Integer] Autonomous system number. attr_accessor :as # @return [String] The length of time that the BGP session has been in # the Established state, or the current status if not in the Established # state. attr_accessor :up_down # @return [String] Current state of the BGP session, and the number of # prefixes that have been received from a neighbor or peer group. attr_accessor :state_pfx_rcd # # Mapper for ExpressRouteCircuitRoutesTableSummary class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'ExpressRouteCircuitRoutesTableSummary', type: { name: 'Composite', class_name: 'ExpressRouteCircuitRoutesTableSummary', model_properties: { neighbor: { client_side_validation: true, required: false, serialized_name: 'neighbor', type: { name: 'String' } }, v: { client_side_validation: true, required: false, serialized_name: 'v', type: { name: 'Number' } }, as: { client_side_validation: true, required: false, serialized_name: 'as', type: { name: 'Number' } }, up_down: { client_side_validation: true, required: false, serialized_name: 'upDown', type: { name: 'String' } }, state_pfx_rcd: { client_side_validation: true, required: false, serialized_name: 'statePfxRcd', type: { name: 'String' } } } } } end end end end
Azure/azure-sdk-for-ruby
management/azure_mgmt_network/lib/2018-02-01/generated/azure_mgmt_network/models/express_route_circuit_routes_table_summary.rb
Ruby
mit
2,716