[ad_1]
Must Watch
‘ });
* // => ‘'
*
* // using the "evaluate" delimiter to execute JavaScript and generate HTML
* var compiled = _.template('
* compiled( 'users': ['fred', 'barney'] );
* // => '
'
*
* // using the internal `print` function in "evaluate" delimiters
* var compiled = _.template('!');
* compiled( 'user': 'barney' );
* // => 'hello barney!'
*
* // using the ES delimiter as an alternative to the default "interpolate" delimiter
* var compiled = _.template('hello $ user !');
* compiled( 'user': 'pebbles' );
* // => 'hello pebbles!'
*
* // using custom template delimiters
* _.templateSettings.interpolate = /([sS]+?)/g;
* var compiled = _.template('hello user !');
* compiled( 'user': 'mustache' );
* // => 'hello mustache!'
*
* // using backslashes to treat delimiters as plain text
* var compiled = _.template('" %>');
* compiled( 'value': 'ignored' );
* // => ''
*
* // using the `imports` option to import `jQuery` as `jq`
* var text = '
* var compiled = _.template(text, 'imports': 'jq': jQuery );
* compiled( 'users': ['fred', 'barney'] );
* // => '
'
*
* // using the `sourceURL` option to specify a custom sourceURL for the template
* var compiled = _.template('hello !', 'sourceURL': '/basic/greeting.jst' );
* compiled(data);
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
*
* // using the `variable` option to ensure a with-statement isn't used in the compiled template
* var compiled = _.template('hi !', 'variable': 'data' );
* compiled.source;
* // => function(data)
* // var __t, __p = '';
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
* // return __p;
* //
*
* // using the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and a stack trace
* fs.writeFileSync(path.join(cwd, 'jst.js'), '
* var JST =
* "main": ' + _.template(mainText).source + '
* ;
* ');
*/
function template(string,options,otherOptions)/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to trim.
* @param string [chars=whitespace] The characters to trim.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns string Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string,chars,guard)var value=string;return(string=baseToString(string))?(guard?isIterateeCall(value,chars,guard):null==chars)?string.slice(trimmedLeftIndex(string),trimmedRightIndex(string)+1):(chars+="",string.slice(charsLeftIndex(string,chars),charsRightIndex(string,chars)+1)):string/**
* Removes leading whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to trim.
* @param string [chars=whitespace] The characters to trim.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns string Returns the trimmed string.
* @example
*
* _.trimLeft(' abc ');
* // => 'abc '
*
* _.trimLeft('-_-abc-_-', '_-');
* // => 'abc-_-'
*/
function trimLeft(string,chars,guard)var value=string;return string=baseToString(string),string?(guard?isIterateeCall(value,chars,guard):null==chars)?string.slice(trimmedLeftIndex(string)):string.slice(charsLeftIndex(string,chars+"")):string/**
* Removes trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to trim.
* @param string [chars=whitespace] The characters to trim.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns string Returns the trimmed string.
* @example
*
* _.trimRight(' abc ');
* // => ' abc'
*
* _.trimRight('-_-abc-_-', '_-');
* // => '-_-abc'
*/
function trimRight(string,chars,guard)var value=string;return string=baseToString(string),string?(guard?isIterateeCall(value,chars,guard):null==chars)?string.slice(0,trimmedRightIndex(string)+1):string.slice(0,charsRightIndex(string,chars+"")+1):string/**
* 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 "...".
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to truncate.
* @param number [options] The options object or maximum string length.
* @param number [options.length=30] The maximum string length.
* @param string [options.omission='...'] The string to indicate text is omitted.
* @param RegExp [options.separator] The separator pattern to truncate to.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns string Returns the truncated string.
* @example
*
* _.trunc('hi-diddly-ho there, neighborino');
* // => 'hi-diddly-ho there, neighbo...'
*
* _.trunc('hi-diddly-ho there, neighborino', 24);
* // => 'hi-diddly-ho there, n...'
*
* _.trunc('hi-diddly-ho there, neighborino',
* 'length': 24,
* 'separator': ' '
* );
* // => 'hi-diddly-ho there,...'
*
* _.trunc('hi-diddly-ho there, neighborino',
* 'length': 24,
* 'separator': /,? +/
* );
* // => 'hi-diddly-ho there...'
*
* _.trunc('hi-diddly-ho there, neighborino',
* 'omission': ' [...]'
* );
* // => 'hi-diddly-ho there, neig [...]'
*/
function trunc(string,options,guard)guard&&isIterateeCall(string,options,guard)&&(options=undefined);var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(null!=options)if(isObject(options))var separator="separator"in options?options.separator:separator;length="length"in options?+options.lengthelse length=+options/**
* The inverse of `_.escape`; this method converts the HTML entities
* `&`, ``, `"`, `'`, and ``` 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_](https://mths.be/he).
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to unescape.
* @returns string Returns the unescaped string.
* @example
*
* _.unescape('fred, barney, & pebbles');
* // => 'fred, barney, & pebbles'
*/
function unescape(string)return string=baseToString(string),string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @category String
* @param string [string=''] The string to inspect.
* @param RegExp [pattern] The pattern to match words.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns Array Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string,pattern,guard)/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
* and 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 _
* @alias iteratee
* @category Utility
* @param * [func=_.identity] The value to convert to a callback.
* @param * [thisArg] The `this` binding of `func`.
* @param- Object [guard] Enables use as a callback for functions like `_.map`.
* @returns Function Returns the callback.
* @example
*
* var users = [
* 'user': 'barney', 'age': 36 ,
* 'user': 'fred', 'age': 40
* ];
*
* // wrap to create custom callback shorthands
* _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
* var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
* if (!match)
* return callback(func, thisArg);
*
* return function(object) {
* return match[2] == 'gt'
* ? object[match[1]] > match[3]
* : object[match[1]] [ 'user': 'fred', 'age': 40 ]
*/
function callback(func,thisArg,guard)return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=undefined),isObjectLike(func)?matches(func):baseCallback(func,thisArg)/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @category Utility
* @param * value The value to return from the new function.
* @returns Function Returns the new function.
* @example
*
* var object = 'user': 'fred' ;
* var getter = _.constant(object);
*
* getter() === object;
* // => true
*/
function constant(value)return function()return value/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param * value Any value.
* @returns * Returns `value`.
* @example
*
* var object = 'user': 'fred' ;
*
* _.identity(object) === object;
* // => true
*/
function identity(value)return value/**
* 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`.
*
* @static
* @memberOf _
* @category Utility
* @param Object source The object of property values to match.
* @returns Function Returns the new function.
* @example
*
* var users = [
* 'user': 'barney', 'age': 36, 'active': true ,
* 'user': 'fred', 'age': 40, 'active': false
* ];
*
* _.filter(users, _.matches( 'age': 40, 'active': false ));
* // => [ 'user': 'fred', 'age': 40, 'active': false ]
*/
function matches(source)return baseMatches(baseClone(source,!0))/**
* 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.
*
* @static
* @memberOf _
* @category Utility
* @param string path The path of the property to get.
* @param * srcValue The value to match.
* @returns Function Returns the new function.
* @example
*
* var users = [
* 'user': 'barney' ,
* 'user': 'fred'
* ];
*
* _.find(users, _.matchesProperty('user', 'fred'));
* // => 'user': 'fred'
*/
function matchesProperty(path,srcValue)return baseMatchesProperty(path,baseClone(srcValue,!0))/**
* 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.
*
* @static
* @memberOf _
* @category Utility
* @param Function [object=lodash] The destination object.
* @param Object source The object of functions to add.
* @param Object [options] The options object.
* @param boolean [options.chain=true] Specify whether the functions added
* are chainable.
* @returns Function Returns `object`.
* @example
*
* function vowels(string)
* return _.filter(string, function(v)
* return /[aeiou]/i.test(v);
* );
*
*
* _.mixin( 'vowels': vowels );
* _.vowels('fred');
* // => ['e']
*
* _('fred').vowels().value();
* // => ['e']
*
* _.mixin( 'vowels': vowels , 'chain': false );
* _('fred').vowels();
* // => ['e']
*/
function mixin(object,source,options){if(null==options)var isObj=isObject(source),props=isObj?keys(source):undefined,methodNames=props&&props.length?baseFunctions(source,props):undefined;(methodNames?methodNames.length:isObj)methodNames||(methodNames=baseFunctions(source,keys(source)));var chain=!0,index=-1,isFunc=isFunction(object),length=methodNames.length;options===!1?chain=!1:isObject(options)&&"chain"in options&&(chain=options.chain);for(;++index
*/
function noop()/**
* Creates a function that returns the property value at `path` on a
* given object.
*
* @static
* @memberOf _
* @category Utility
* @param string path The path of the property to get.
* @returns Function Returns the new function.
* @example
*
* var objects = [
* 'a': 'b': 'c': 2 ,
* 'a': 'b': 'c': 1
* ];
*
* _.map(objects, _.property('a.b.c'));
* // => [2, 1]
*
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
function property(path)return isKey(path)?baseProperty(path):basePropertyDeep(path)/**
* The opposite of `_.property`; this method creates a function that returns
* the property value at a given path on `object`.
*
* @static
* @memberOf _
* @category Utility
* @param Object object The object to query.
* @returns Function Returns the new function.
* @example
*
* var array = [0, 1, 2],
* object = 'a': array, 'b': array, 'c': array ;
*
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
* // => [2, 0]
*
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
* // => [2, 0]
*/
function propertyOf(object)return function(path)return baseGet(object,toPath(path),path+"")/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. If `end` is not specified it is
* 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.
*
* @static
* @memberOf _
* @category Utility
* @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
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
function range(start,end,step){step&&isIterateeCall(start,end,step)&&(end=step=undefined),start=+start||0,step=null==step?1:+step||0,null==end?(end=start,start=0):end=+end||0;for(
// Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
// See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);++index
*
* _.times(3, function(n)
* mage.castSpell(n);
* );
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
*
* _.times(3, function(n)
* this.cast(n);
* , mage);
* // => also invokes `mage.castSpell(n)` three times
*/
function times(n,iteratee,thisArg)
// Exit early to avoid a JSC JIT bug in Safari 8
// where `Array(0)` is treated as `Array(1)`.
if(n=nativeFloor(n),1>n/**
* Generates a unique ID. If `prefix` is provided the ID is appended to it.
*
* @static
* @memberOf _
* @category Utility
* @param string [prefix] The value to prefix the ID with.
* @returns string Returns the unique ID.
* @example
*
* _.uniqueId('contact_');
* // => 'contact_104'
*
* _.uniqueId();
* // => '105'
*/
function uniqueId(prefix)var id=++idCounter;return baseToString(prefix)+id/*------------------------------------------------------------------------*/
/**
* Adds two numbers.
*
* @static
* @memberOf _
* @category Math
* @param number augend The first number to add.
* @param number addend The second number to add.
* @returns number Returns the sum.
* @example
*
* _.add(6, 4);
* // => 10
*/
function add(augend,addend)/**
* Gets the sum of the values in `collection`.
*
* @static
* @memberOf _
* @category Math
* @param Array collection The collection to iterate over.
* @param Object [iteratee] The function invoked per iteration.
* @param * [thisArg] The `this` binding of `iteratee`.
* @returns number Returns the sum.
* @example
*
* _.sum([4, 6]);
* // => 10
*
* _.sum( 'a': 4, 'b': 6 );
* // => 10
*
* var objects = [
* 'n': 4 ,
* 'n': 6
* ];
*
* _.sum(objects, function(object)
* return object.n;
* );
* // => 10
*
* // using the `_.property` callback shorthand
* _.sum(objects, 'n');
* // => 10
*/
function sum(collection,iteratee,thisArg)return thisArg&&isIterateeCall(collection,iteratee,thisArg)&&(iteratee=undefined),iteratee=getCallback(iteratee,thisArg,3),1==iteratee.length?arraySum(isArray(collection)?collection:toIterable(collection),iteratee):baseSum(collection,iteratee)
// Avoid issues with some ES3 environments that attempt to use values, named
// after built-in constructors like `Object`, for the creation of literals.
// ES5 clears this up by stating that literals must use built-in constructors.
// See https://es5.github.io/#x11.1.5 for more details.
context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;/** Native constructor references. */
var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError,arrayProto=Array.prototype,objectProto=Object.prototype,stringProto=String.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,idCounter=0,objToString=objectProto.toString,oldDash=root._,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\^$.*+?()[]|]/g,"\$&").replace(/hasOwnProperty|(function).*?(?=\()| for .+?(?=\])/g,"$1.*?")+"$"),ArrayBuffer=context.ArrayBuffer,clearTimeout=context.clearTimeout,parseFloat=context.parseFloat,pow=Math.pow,propertyIsEnumerable=objectProto.propertyIsEnumerable,Set=getNative(context,"Set"),setTimeout=context.setTimeout,splice=arrayProto.splice,Uint8Array=context.Uint8Array,WeakMap=getNative(context,"WeakMap"),nativeCeil=Math.ceil,nativeCreate=getNative(Object,"create"),nativeFloor=Math.floor,nativeIsArray=getNative(Array,"isArray"),nativeIsFinite=context.isFinite,nativeKeys=getNative(Object,"keys"),nativeMax=Math.max,nativeMin=Math.min,nativeNow=getNative(Date,"now"),nativeParseInt=context.parseInt,nativeRandom=Math.random,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,POSITIVE_INFINITY=Number.POSITIVE_INFINITY,MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,MAX_SAFE_INTEGER=9007199254740991,metaMap=WeakMap&&new WeakMap,realNames=;lodash.support=;/**
* By default, the template delimiters used by lodash are like those in
* embedded Ruby (ERB). Change the following template settings to use
* alternative delimiters.
*
* @static
* @memberOf _
* @type Object
*/
lodash.templateSettings=/**
* Used to detect `data` property values to be HTML-escaped.
*
* @memberOf _.templateSettings
* @type RegExp
*/
escape:reEscape,/**
* Used to detect code to be evaluated.
*
* @memberOf _.templateSettings
* @type RegExp
*/
evaluate:reEvaluate,/**
* Used to detect `data` property values to inject.
*
* @memberOf _.templateSettings
* @type RegExp
*/
interpolate:reInterpolate,/**
* Used to reference the data object in the template text.
*
* @memberOf _.templateSettings
* @type string
*/
variable:"",/**
* Used to import variables into the compiled template.
*
* @memberOf _.templateSettings
* @type Object
*/
imports:/**
* A reference to the `lodash` function.
*
* @memberOf _.templateSettings.imports
* @type Function
*/
_:lodash;/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param Object prototype The object to inherit from.
* @returns Object Returns the new object.
*/
var baseCreate=function()function object()return function(prototype)(),baseEach=createBaseEach(baseForOwn),baseEachRight=createBaseEach(baseForOwnRight,!0),baseFor=createBaseFor(),baseForRight=createBaseFor(!0),baseSetData=metaMap?function(func,data)return metaMap.set(func,data),func:identity,getData=metaMap?function(func)return metaMap.get(func):noop,getLength=baseProperty("length"),setData=function()var count=0,lastCalled=0;return function(key,value)var stamp=now(),remaining=HOT_SPAN-(stamp-lastCalled);if(lastCalled=stamp,remaining>0)if(++count>=HOT_COUNT)return keyelse count=0;return baseSetData(key,value)(),difference=restParam(function(array,values)return isObjectLike(array)&&isArrayLike(array)?baseDifference(array,baseFlatten(values,!1,!0)):[]),findIndex=createFindIndex(),findLastIndex=createFindIndex(!0),intersection=restParam(function(arrays)function()return(new Date).getTime(),bind=restParam(function(func,thisArg,partials)var bitmask=BIND_FLAG;if(partials.length)var holders=replaceHolders(partials,bind.placeholder);bitmaskreturn createWrapper(func,bitmask,thisArg,partials,holders)),bindAll=restParam(function(object,methodNames)methodNames=methodNames.length?baseFlatten(methodNames):functions(object);for(var index=-1,length=methodNames.length;++index
Sidekick More Market News
[ad_2]
Source link