omniscientjs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniscientjs.rb +6 -0
- data/lib/omniscientjs/version.rb +3 -0
- data/omniscientjs.gemspec +33 -0
- data/vendor/javascripts/omniscient.js +3014 -0
- data/vendor/javascripts/wget-log +12 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20dbbf48dc3743f9e2565966ecd0c901415c1979
|
4
|
+
data.tar.gz: f6e1e7a2b9e410a15ab520f1f0c783bafb610b52
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 577ed4c9bc222f93fa6d6b3344b453598427d66dd4c68a16da9a7c457ef425a9ecd886780d8fa9cfa6bc869267b9eab97556035a9adc5bf34e17eb44592a8030
|
7
|
+
data.tar.gz: 0c7a5b6ada6cb71612cf4f19f4f2fdb9af14dfe0ca77ce68e3b109ffc85ef113ef5621649d7c7a561f861e5dc703c85ae883b8bbc3bd8b40ef2342ac56d9e198
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at namburu.karthik@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 karthiknamburu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Omniscientjs
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniscientjs`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniscientjs'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install omniscientjs
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniscientjs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniscientjs"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/omniscientjs.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniscientjs/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniscientjs"
|
8
|
+
spec.version = Omniscientjs::VERSION
|
9
|
+
spec.authors = ["karthiknamburu"]
|
10
|
+
spec.email = ["namburu.karthik@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Gem to Integrate Omniscient javascript}
|
13
|
+
spec.description = %q{A Gem to Integrate Omniscient javascript}
|
14
|
+
spec.homepage = "https://github.com/karthiknamburu/omniscientjs"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
end
|
@@ -0,0 +1,3014 @@
|
|
1
|
+
/**
|
2
|
+
* Omniscient.js v4.1.1
|
3
|
+
* Authors: @torgeir,@mikaelbr
|
4
|
+
***************************************/
|
5
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.omniscient = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var shouldupdate = _dereq_('./shouldupdate');
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Directly fetch `cache` to use outside of Omniscient.
|
12
|
+
* You can do this if you want to define functions that caches computed
|
13
|
+
* result to avoid recomputing if invoked with equal arguments as last time.
|
14
|
+
*
|
15
|
+
* Returns optimized version of given `f` function for repeated
|
16
|
+
* calls with an equal inputs. Returned function caches last input
|
17
|
+
* and a result of the computation for it, which is handy for
|
18
|
+
* optimizing `render` when computations are run on unchanged parts
|
19
|
+
* of state. Although note that only last result is cached so it is
|
20
|
+
* not practical to call it mulitple times with in the same `render`
|
21
|
+
* call.
|
22
|
+
*
|
23
|
+
* @param {Function} Function that does a computation.
|
24
|
+
*
|
25
|
+
* @module cached
|
26
|
+
* @returns {Function} Optimized function
|
27
|
+
* @api public
|
28
|
+
*/
|
29
|
+
module.exports = factory();
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Create a “local” instance of the `cache` with overriden defaults.
|
33
|
+
*
|
34
|
+
* ### Options
|
35
|
+
* ```js
|
36
|
+
* {
|
37
|
+
* isEqualProps: function (currentProps, nextProps), // check props
|
38
|
+
* }
|
39
|
+
* ```
|
40
|
+
*
|
41
|
+
* @param {Object} [Options] Options with defaults to override
|
42
|
+
*
|
43
|
+
* @module cached.withDefaults
|
44
|
+
* @returns {Function} cached with overriden defaults
|
45
|
+
* @api public
|
46
|
+
*/
|
47
|
+
module.exports.withDefaults = factory;
|
48
|
+
|
49
|
+
function factory (methods) {
|
50
|
+
var isEqual = (methods && methods.isEqualProps) || shouldupdate.isEqualProps;
|
51
|
+
|
52
|
+
return function cached (f) {
|
53
|
+
var input,
|
54
|
+
output;
|
55
|
+
|
56
|
+
return function () {
|
57
|
+
if (!isEqual(arguments, input)) {
|
58
|
+
output = f.apply(this, arguments);
|
59
|
+
}
|
60
|
+
// Update input either way to allow GC reclaim it unless
|
61
|
+
// anything else is referring to it.
|
62
|
+
input = arguments;
|
63
|
+
return output;
|
64
|
+
};
|
65
|
+
};
|
66
|
+
}
|
67
|
+
|
68
|
+
},{"./shouldupdate":34}],2:[function(_dereq_,module,exports){
|
69
|
+
(function (global){
|
70
|
+
"use strict";
|
71
|
+
|
72
|
+
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
|
73
|
+
var assign = _dereq_('lodash.assign');
|
74
|
+
|
75
|
+
var shouldComponentUpdate = _dereq_('./shouldupdate');
|
76
|
+
var cached = _dereq_('./cached');
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Create components for functional views.
|
80
|
+
*
|
81
|
+
* The API of Omniscient is pretty simple, you create a Stateless React Component
|
82
|
+
* but memoized with a smart implemented `shouldComponentUpdate`.
|
83
|
+
*
|
84
|
+
* The provided `shouldComponentUpdate` handles immutable data and cursors by default.
|
85
|
+
* It also falls back to a deep value check if passed props isn't immutable structures.
|
86
|
+
*
|
87
|
+
* You can use an Omniscient component in the same way you'd use a React Stateless Function,
|
88
|
+
* or you can use some of the additional features, such as string defined display name and
|
89
|
+
* pass in life cycle methods. These are features normally not accessible for vanilla
|
90
|
+
* Stateless React Components.
|
91
|
+
*
|
92
|
+
* If you simply pass one cursor, the cursor will be accessible on the
|
93
|
+
* `props.cursor` accessor.
|
94
|
+
*
|
95
|
+
* @param {String} displayName Component's display name. Used when debug()'ing and by React
|
96
|
+
* @param {Array|Object} mixins React mixins. Object literals with functions, or array of object literals with functions.
|
97
|
+
* @param {Function} render Stateless component to add memoization on.
|
98
|
+
*
|
99
|
+
* @property {Function} shouldComponentUpdate Get default shouldComponentUpdate
|
100
|
+
* @module omniscient
|
101
|
+
* @returns {Component}
|
102
|
+
* @api public
|
103
|
+
*/
|
104
|
+
|
105
|
+
module.exports = factory();
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Create a “local” instance of the Omniscient component creator by using the `.withDefaults` method.
|
109
|
+
* This also allows you to override any defaults that Omniscient use to check equality of objects,
|
110
|
+
* unwrap cursors, etc.
|
111
|
+
*
|
112
|
+
* ### Options
|
113
|
+
* ```js
|
114
|
+
* {
|
115
|
+
* // Goes directly to component
|
116
|
+
* shouldComponentUpdate: function(nextProps, nextState), // check update
|
117
|
+
* cursorField: '__singleCursor', // cursor property name to "unwrap" before passing in to render
|
118
|
+
* isNode: function(propValue), // determines if propValue is a valid React node
|
119
|
+
* classDecorator: function(Component), // Allows for decorating created class
|
120
|
+
*
|
121
|
+
* // Passed on to `shouldComponentUpdate`
|
122
|
+
* isCursor: function (cursor), // check if is props
|
123
|
+
* isEqualCursor: function (oneCursor, otherCursor), // check cursor
|
124
|
+
* isEqualState: function (currentState, nextState), // check state
|
125
|
+
* isImmutable: function (currentState, nextState), // check if object is immutable
|
126
|
+
* isEqualProps: function (currentProps, nextProps), // check props
|
127
|
+
* isIgnorable: function (propertyValue, propertyKey), // check if property item is ignorable
|
128
|
+
* unCursor: function (cursor) // convert from cursor to object
|
129
|
+
* }
|
130
|
+
* ```
|
131
|
+
*
|
132
|
+
* ### Examples
|
133
|
+
*
|
134
|
+
* #### Un-wrapping curors
|
135
|
+
* ```jsx
|
136
|
+
* var localComponent = component.withDefaults({
|
137
|
+
* cursorField: 'foobar'
|
138
|
+
* });
|
139
|
+
*
|
140
|
+
* var Component = localComponent(function (myCursor) {
|
141
|
+
* // Now you have myCursor directly instead of having to do props.foobar
|
142
|
+
* });
|
143
|
+
*
|
144
|
+
* React.render(<Component foobar={myCursor} />, mountingPoint);
|
145
|
+
* ```
|
146
|
+
*
|
147
|
+
* #### Decorating class components
|
148
|
+
* ```jsx
|
149
|
+
* // Some third party libraries requires you to decorate the
|
150
|
+
* // React class, not the created component. You can do that
|
151
|
+
* // by creating a decorated component factory
|
152
|
+
* var decoratedComponent = component.withDefaults({
|
153
|
+
* classDecorator: compose(Radium, function (Component) {
|
154
|
+
* var DecoratedComponent = doSomething(Component);
|
155
|
+
* return DecoratedComponent;
|
156
|
+
* })
|
157
|
+
* });
|
158
|
+
*
|
159
|
+
* var Component = decoratedComponent(function (props) {
|
160
|
+
* // ... some implementation
|
161
|
+
* });
|
162
|
+
*
|
163
|
+
* React.render(<Component />, mountingPoint);
|
164
|
+
* ```
|
165
|
+
*
|
166
|
+
* @param {Object} Options Options with defaults to override
|
167
|
+
*
|
168
|
+
* @property {Function} shouldComponentUpdate Get default shouldComponentUpdate
|
169
|
+
*
|
170
|
+
* @module omniscient.withDefaults
|
171
|
+
* @returns {Component}
|
172
|
+
* @api public
|
173
|
+
*/
|
174
|
+
module.exports.withDefaults = factory;
|
175
|
+
|
176
|
+
function factory (initialOptions) {
|
177
|
+
var debug;
|
178
|
+
initialOptions = initialOptions || {};
|
179
|
+
var _shouldComponentUpdate = initialOptions.shouldComponentUpdate ||
|
180
|
+
shouldComponentUpdate.withDefaults(initialOptions);
|
181
|
+
var _isCursor = initialOptions.isCursor || shouldComponentUpdate.isCursor;
|
182
|
+
var _isImmutable = initialOptions.isImmutable || shouldComponentUpdate.isImmutable;
|
183
|
+
var _hiddenCursorField = initialOptions.cursorField || '__singleCursor';
|
184
|
+
var _isNode = initialOptions.isNode || isNode;
|
185
|
+
var _classDecorator = initialOptions.classDecorator || identity;
|
186
|
+
var _cached = cached.withDefaults(_shouldComponentUpdate);
|
187
|
+
|
188
|
+
var CreatedComponent = ComponentCreatorFactory(_classDecorator);
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Create components for functional views, with an attached local class decorator.
|
192
|
+
* Omniscient uses a `React.createClass()` internally to create an higher order
|
193
|
+
* component to attach performance boost and add some syntactic sugar to your
|
194
|
+
* components. Sometimes third party apps need to be added as decorator to this
|
195
|
+
* internal class. For instance Redux or Radium.
|
196
|
+
* This create factory behaves the same as normal Omniscient.js component
|
197
|
+
* creation, but with the additional first parameter for class decorator.
|
198
|
+
*
|
199
|
+
* The API of Omniscient is pretty simple, you create a Stateless React Component
|
200
|
+
* but memoized with a smart implemented `shouldComponentUpdate`.
|
201
|
+
*
|
202
|
+
* The provided `shouldComponentUpdate` handles immutable data and cursors by default.
|
203
|
+
* It also falls back to a deep value check if passed props isn't immutable structures.
|
204
|
+
*
|
205
|
+
* You can use an Omniscient component in the same way you'd use a React Stateless Function,
|
206
|
+
* or you can use some of the additional features, such as string defined display name and
|
207
|
+
* pass in life cycle methods. These are features normally not accessible for vanilla
|
208
|
+
* Stateless React Components.
|
209
|
+
*
|
210
|
+
* If you simply pass one cursor, the cursor will be accessible on the
|
211
|
+
* `props.cursor` accessor.
|
212
|
+
*
|
213
|
+
* #### Decorating class components
|
214
|
+
* ```jsx
|
215
|
+
* // Some third party libraries requires you to decorate the
|
216
|
+
* // React class, not the created component. You can do that
|
217
|
+
* // by creating a decorated component factory
|
218
|
+
* var someDecorator = compose(Radium, function (Component) {
|
219
|
+
* var DecoratedComponent = doSomething(Component);
|
220
|
+
* return DecoratedComponent;
|
221
|
+
* });
|
222
|
+
* var Component = component.classDecorator(someDecorator, function (props) {
|
223
|
+
* // ... some implementation
|
224
|
+
* });
|
225
|
+
*
|
226
|
+
* React.render(<Component />, mountingPoint);
|
227
|
+
* ```
|
228
|
+
*
|
229
|
+
* Also works by creating a component factory:
|
230
|
+
*
|
231
|
+
* ```jsx
|
232
|
+
* var someDecorator = compose(Radium, function (Component) {
|
233
|
+
* var DecoratedComponent = doSomething(Component);
|
234
|
+
* return DecoratedComponent;
|
235
|
+
* });
|
236
|
+
* var newFactory = component.classDecorator(someDecorator);
|
237
|
+
* var Component = newFactory(function (props) {
|
238
|
+
* // ... some implementation
|
239
|
+
* });
|
240
|
+
*
|
241
|
+
* React.render(<Component />, mountingPoint);
|
242
|
+
* ```
|
243
|
+
*
|
244
|
+
* @param {Function} classDecorator Decorator to use for internal class (e.g. Redux connect, Radium)
|
245
|
+
* @param {String} [displayName] Component's display name. Used when debug()'ing and by React
|
246
|
+
* @param {Array|Object} [mixins] React mixins. Object literals with functions, or array of object literals with functions.
|
247
|
+
* @param {Function} [render] Stateless component to add memoization on.
|
248
|
+
*
|
249
|
+
* @property {Function} shouldComponentUpdate Get default shouldComponentUpdate
|
250
|
+
* @module omniscient
|
251
|
+
* @returns {Component|Function}
|
252
|
+
* @api public
|
253
|
+
*/
|
254
|
+
CreatedComponent.classDecorator = function (classDecorator) {
|
255
|
+
var shouldPartiallyApply = arguments.length === 1;
|
256
|
+
if (shouldPartiallyApply) {
|
257
|
+
return ComponentCreatorFactory(classDecorator);
|
258
|
+
}
|
259
|
+
return ComponentCreatorFactory(classDecorator).apply(null, toArray(arguments).slice(1));
|
260
|
+
};
|
261
|
+
return CreatedComponent;
|
262
|
+
|
263
|
+
function ComponentCreatorFactory (passedClassDecorator) {
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Activate debugging for components. Will log when a component renders,
|
267
|
+
* the outcome of `shouldComponentUpdate`, and why the component re-renders.
|
268
|
+
*
|
269
|
+
* ### Example
|
270
|
+
* ```js
|
271
|
+
* Search>: shouldComponentUpdate => true (cursors have changed)
|
272
|
+
* Search>: render
|
273
|
+
* SearchBox>: shouldComponentUpdate => true (cursors have changed)
|
274
|
+
* SearchBox>: render
|
275
|
+
* ```
|
276
|
+
*
|
277
|
+
* @example omniscient.debug(/Search/i);
|
278
|
+
*
|
279
|
+
* @param {RegExp} pattern Filter pattern. Only show messages matching pattern
|
280
|
+
*
|
281
|
+
* @module omniscient.debug
|
282
|
+
* @returns {Immstruct}
|
283
|
+
* @api public
|
284
|
+
*/
|
285
|
+
ComponentCreator.debug = debugFn;
|
286
|
+
ComponentCreator.cached = _cached;
|
287
|
+
ComponentCreator.shouldComponentUpdate = _shouldComponentUpdate;
|
288
|
+
|
289
|
+
return ComponentCreator;
|
290
|
+
|
291
|
+
function ComponentCreator (displayName, mixins, render) {
|
292
|
+
var options = createDefaultArguments(displayName, mixins, render);
|
293
|
+
var methodStatics = pickStaticMixins(options.mixins);
|
294
|
+
|
295
|
+
var componentObject = {
|
296
|
+
displayName: options.displayName || options.render.name,
|
297
|
+
mixins: options.mixins,
|
298
|
+
render: function render () {
|
299
|
+
if (debug) debug.call(this, 'render');
|
300
|
+
// If `props['__singleCursor']` is set a single cursor was passed
|
301
|
+
// to the component, pick it out and pass it.
|
302
|
+
var input = this.props[_hiddenCursorField] || this.props;
|
303
|
+
this.cursor = this.props[_hiddenCursorField];
|
304
|
+
return options.render.call(this, input);
|
305
|
+
}
|
306
|
+
};
|
307
|
+
|
308
|
+
if (methodStatics) {
|
309
|
+
componentObject.statics = methodStatics;
|
310
|
+
removeOldStaticMethods(options.mixins);
|
311
|
+
}
|
312
|
+
|
313
|
+
var Component = passedClassDecorator(React.createClass(componentObject));
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Invoke component (rendering it)
|
317
|
+
*
|
318
|
+
* @param {String} displayName Component display name. Used in debug and by React
|
319
|
+
* @param {Object} props Properties (triggers update when changed). Can be cursors, object and immutable structures
|
320
|
+
* @param {Object} ...rest Child components (React elements, scalar values)
|
321
|
+
*
|
322
|
+
* @module Component
|
323
|
+
* @returns {ReactElement}
|
324
|
+
* @api public
|
325
|
+
*/
|
326
|
+
var create = function (keyOrProps, propsOrPublicContext, ReactUpdateQueue) {
|
327
|
+
// After stateless arrow functions was allowed as components, react will instantiate
|
328
|
+
// the `create` function if it has a prototype. We are passed `props`, `publicContext`
|
329
|
+
// and `ReactUpdateQueue`.
|
330
|
+
// https://github.com/facebook/react/blob/88bae3fb73511893519195e451c56896463f669b/src/renderers/shared/reconciler/ReactCompositeComponent.js#L154-L171
|
331
|
+
if (typeof ReactUpdateQueue == 'object' && !_isNode(ReactUpdateQueue)) {
|
332
|
+
var publicProps = keyOrProps,
|
333
|
+
publicContext = propsOrPublicContext;
|
334
|
+
return new Component(publicProps, publicContext, ReactUpdateQueue);
|
335
|
+
}
|
336
|
+
|
337
|
+
var key = keyOrProps,
|
338
|
+
props = propsOrPublicContext;
|
339
|
+
|
340
|
+
if (typeof key === 'object') {
|
341
|
+
props = key;
|
342
|
+
key = void 0;
|
343
|
+
}
|
344
|
+
|
345
|
+
var children = flatten(sliceFrom(arguments, props).filter(_isNode));
|
346
|
+
|
347
|
+
var _props,
|
348
|
+
inputCursor;
|
349
|
+
|
350
|
+
// If passed props is a signle cursor we move it to `props[_hiddenCursorField]`
|
351
|
+
// to simplify should component update. The render function will move it back.
|
352
|
+
// The name '__singleCursor' is used to not clash with names of user passed properties
|
353
|
+
if (_isCursor(props) || _isImmutable(props)) {
|
354
|
+
inputCursor = props;
|
355
|
+
_props = {};
|
356
|
+
_props[_hiddenCursorField] = inputCursor;
|
357
|
+
} else {
|
358
|
+
_props = assign({}, props);
|
359
|
+
}
|
360
|
+
|
361
|
+
if (key) {
|
362
|
+
_props.key = key;
|
363
|
+
}
|
364
|
+
|
365
|
+
if (children.length) {
|
366
|
+
_props.children = children;
|
367
|
+
}
|
368
|
+
|
369
|
+
return React.createElement(Component, _props);
|
370
|
+
};
|
371
|
+
|
372
|
+
if (methodStatics) {
|
373
|
+
create = assign(create, methodStatics);
|
374
|
+
}
|
375
|
+
|
376
|
+
return assign(create, Component, { type: Component });
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
function debugFn (pattern, logFn) {
|
381
|
+
if (_shouldComponentUpdate.debug) {
|
382
|
+
debug = _shouldComponentUpdate.debug(pattern, logFn);
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
function createDefaultArguments (displayName, mixins, render) {
|
387
|
+
|
388
|
+
// (render)
|
389
|
+
if (typeof displayName === 'function') {
|
390
|
+
render = displayName;
|
391
|
+
mixins = [];
|
392
|
+
displayName = void 0;
|
393
|
+
}
|
394
|
+
|
395
|
+
// (mixins, render)
|
396
|
+
if (typeof displayName === 'object' && typeof mixins === 'function') {
|
397
|
+
render = mixins;
|
398
|
+
mixins = displayName;
|
399
|
+
displayName = void 0;
|
400
|
+
}
|
401
|
+
|
402
|
+
// (displayName, render)
|
403
|
+
if (typeof displayName === 'string' && typeof mixins === 'function') {
|
404
|
+
render = mixins;
|
405
|
+
mixins = [];
|
406
|
+
}
|
407
|
+
|
408
|
+
// Else (displayName, mixins, render)
|
409
|
+
|
410
|
+
if (!Array.isArray(mixins)) {
|
411
|
+
mixins = [mixins];
|
412
|
+
}
|
413
|
+
|
414
|
+
if (!hasShouldComponentUpdate(mixins)) {
|
415
|
+
mixins.unshift({
|
416
|
+
shouldComponentUpdate: _shouldComponentUpdate
|
417
|
+
});
|
418
|
+
}
|
419
|
+
|
420
|
+
return {
|
421
|
+
displayName: displayName,
|
422
|
+
mixins: mixins,
|
423
|
+
render: render
|
424
|
+
};
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Predicate showing whether or not the argument is a valid React Node
|
430
|
+
* or not. Can be numbers, strings, bools, and React Elements.
|
431
|
+
*
|
432
|
+
* React's isNode check from ReactPropTypes validator
|
433
|
+
* but adjusted to not accept objects to avoid collision with props.
|
434
|
+
*
|
435
|
+
* @param {String} propValue Property value to check if is valid React Node
|
436
|
+
*
|
437
|
+
* @returns {Boolean}
|
438
|
+
* @api private
|
439
|
+
*/
|
440
|
+
function isNode (propValue) {
|
441
|
+
switch (typeof propValue) {
|
442
|
+
case 'number':
|
443
|
+
case 'string':
|
444
|
+
return true;
|
445
|
+
case 'boolean':
|
446
|
+
return !propValue;
|
447
|
+
case 'object':
|
448
|
+
if (Array.isArray(propValue)) {
|
449
|
+
return propValue.every(isNode);
|
450
|
+
}
|
451
|
+
if (React.isValidElement(propValue)) {
|
452
|
+
return true;
|
453
|
+
}
|
454
|
+
return false;
|
455
|
+
default:
|
456
|
+
return false;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
|
460
|
+
function pickStaticMixins (mixins) {
|
461
|
+
var filtered = mixins.filter(function (obj) {
|
462
|
+
return !!obj.statics;
|
463
|
+
});
|
464
|
+
|
465
|
+
if (!filtered.length) {
|
466
|
+
return void 0;
|
467
|
+
}
|
468
|
+
|
469
|
+
var statics = {};
|
470
|
+
filtered.forEach(function (obj) {
|
471
|
+
statics = assign(statics, obj.statics);
|
472
|
+
});
|
473
|
+
|
474
|
+
return statics;
|
475
|
+
}
|
476
|
+
|
477
|
+
function removeOldStaticMethods (mixins) {
|
478
|
+
mixins.filter(function (obj) {
|
479
|
+
return !!obj.statics;
|
480
|
+
}).forEach(function (obj) {
|
481
|
+
delete obj.statics;
|
482
|
+
});
|
483
|
+
}
|
484
|
+
|
485
|
+
function hasShouldComponentUpdate (mixins) {
|
486
|
+
return mixins.some(function (mixin) {
|
487
|
+
if (mixin.shouldComponentUpdate) return true;
|
488
|
+
if (!Array.isArray(mixin.mixins)) return false;
|
489
|
+
return hasShouldComponentUpdate(mixin.mixins);
|
490
|
+
});
|
491
|
+
}
|
492
|
+
|
493
|
+
function identity (fn) {
|
494
|
+
return fn;
|
495
|
+
}
|
496
|
+
|
497
|
+
function toArray (args) {
|
498
|
+
return Array.prototype.slice.call(args);
|
499
|
+
}
|
500
|
+
|
501
|
+
function sliceFrom (args, value) {
|
502
|
+
var array = toArray(args);
|
503
|
+
var index = Math.max(array.indexOf(value), 0);
|
504
|
+
return array.slice(index);
|
505
|
+
}
|
506
|
+
|
507
|
+
// Just a shallow flatten
|
508
|
+
function flatten (array) {
|
509
|
+
return Array.prototype.concat.apply([], array);
|
510
|
+
}
|
511
|
+
|
512
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
513
|
+
},{"./cached":1,"./shouldupdate":34,"lodash.assign":3}],3:[function(_dereq_,module,exports){
|
514
|
+
/**
|
515
|
+
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
|
516
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
517
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
518
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
519
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
520
|
+
* Available under MIT license <https://lodash.com/license>
|
521
|
+
*/
|
522
|
+
var baseAssign = _dereq_('lodash._baseassign'),
|
523
|
+
createAssigner = _dereq_('lodash._createassigner'),
|
524
|
+
keys = _dereq_('lodash.keys');
|
525
|
+
|
526
|
+
/**
|
527
|
+
* A specialized version of `_.assign` for customizing assigned values without
|
528
|
+
* support for argument juggling, multiple sources, and `this` binding `customizer`
|
529
|
+
* functions.
|
530
|
+
*
|
531
|
+
* @private
|
532
|
+
* @param {Object} object The destination object.
|
533
|
+
* @param {Object} source The source object.
|
534
|
+
* @param {Function} customizer The function to customize assigned values.
|
535
|
+
* @returns {Object} Returns `object`.
|
536
|
+
*/
|
537
|
+
function assignWith(object, source, customizer) {
|
538
|
+
var index = -1,
|
539
|
+
props = keys(source),
|
540
|
+
length = props.length;
|
541
|
+
|
542
|
+
while (++index < length) {
|
543
|
+
var key = props[index],
|
544
|
+
value = object[key],
|
545
|
+
result = customizer(value, source[key], key, object, source);
|
546
|
+
|
547
|
+
if ((result === result ? (result !== value) : (value === value)) ||
|
548
|
+
(value === undefined && !(key in object))) {
|
549
|
+
object[key] = result;
|
550
|
+
}
|
551
|
+
}
|
552
|
+
return object;
|
553
|
+
}
|
554
|
+
|
555
|
+
/**
|
556
|
+
* Assigns own enumerable properties of source object(s) to the destination
|
557
|
+
* object. Subsequent sources overwrite property assignments of previous sources.
|
558
|
+
* If `customizer` is provided it is invoked to produce the assigned values.
|
559
|
+
* The `customizer` is bound to `thisArg` and invoked with five arguments:
|
560
|
+
* (objectValue, sourceValue, key, object, source).
|
561
|
+
*
|
562
|
+
* **Note:** This method mutates `object` and is based on
|
563
|
+
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
|
564
|
+
*
|
565
|
+
* @static
|
566
|
+
* @memberOf _
|
567
|
+
* @alias extend
|
568
|
+
* @category Object
|
569
|
+
* @param {Object} object The destination object.
|
570
|
+
* @param {...Object} [sources] The source objects.
|
571
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
572
|
+
* @param {*} [thisArg] The `this` binding of `customizer`.
|
573
|
+
* @returns {Object} Returns `object`.
|
574
|
+
* @example
|
575
|
+
*
|
576
|
+
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
|
577
|
+
* // => { 'user': 'fred', 'age': 40 }
|
578
|
+
*
|
579
|
+
* // using a customizer callback
|
580
|
+
* var defaults = _.partialRight(_.assign, function(value, other) {
|
581
|
+
* return _.isUndefined(value) ? other : value;
|
582
|
+
* });
|
583
|
+
*
|
584
|
+
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
585
|
+
* // => { 'user': 'barney', 'age': 36 }
|
586
|
+
*/
|
587
|
+
var assign = createAssigner(function(object, source, customizer) {
|
588
|
+
return customizer
|
589
|
+
? assignWith(object, source, customizer)
|
590
|
+
: baseAssign(object, source);
|
591
|
+
});
|
592
|
+
|
593
|
+
module.exports = assign;
|
594
|
+
|
595
|
+
},{"lodash._baseassign":4,"lodash._createassigner":6,"lodash.keys":10}],4:[function(_dereq_,module,exports){
|
596
|
+
/**
|
597
|
+
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
|
598
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
599
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
600
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
601
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
602
|
+
* Available under MIT license <https://lodash.com/license>
|
603
|
+
*/
|
604
|
+
var baseCopy = _dereq_('lodash._basecopy'),
|
605
|
+
keys = _dereq_('lodash.keys');
|
606
|
+
|
607
|
+
/**
|
608
|
+
* The base implementation of `_.assign` without support for argument juggling,
|
609
|
+
* multiple sources, and `customizer` functions.
|
610
|
+
*
|
611
|
+
* @private
|
612
|
+
* @param {Object} object The destination object.
|
613
|
+
* @param {Object} source The source object.
|
614
|
+
* @returns {Object} Returns `object`.
|
615
|
+
*/
|
616
|
+
function baseAssign(object, source) {
|
617
|
+
return source == null
|
618
|
+
? object
|
619
|
+
: baseCopy(source, keys(source), object);
|
620
|
+
}
|
621
|
+
|
622
|
+
module.exports = baseAssign;
|
623
|
+
|
624
|
+
},{"lodash._basecopy":5,"lodash.keys":10}],5:[function(_dereq_,module,exports){
|
625
|
+
/**
|
626
|
+
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
|
627
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
628
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
629
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
630
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
631
|
+
* Available under MIT license <https://lodash.com/license>
|
632
|
+
*/
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Copies properties of `source` to `object`.
|
636
|
+
*
|
637
|
+
* @private
|
638
|
+
* @param {Object} source The object to copy properties from.
|
639
|
+
* @param {Array} props The property names to copy.
|
640
|
+
* @param {Object} [object={}] The object to copy properties to.
|
641
|
+
* @returns {Object} Returns `object`.
|
642
|
+
*/
|
643
|
+
function baseCopy(source, props, object) {
|
644
|
+
object || (object = {});
|
645
|
+
|
646
|
+
var index = -1,
|
647
|
+
length = props.length;
|
648
|
+
|
649
|
+
while (++index < length) {
|
650
|
+
var key = props[index];
|
651
|
+
object[key] = source[key];
|
652
|
+
}
|
653
|
+
return object;
|
654
|
+
}
|
655
|
+
|
656
|
+
module.exports = baseCopy;
|
657
|
+
|
658
|
+
},{}],6:[function(_dereq_,module,exports){
|
659
|
+
/**
|
660
|
+
* lodash 3.1.1 (Custom Build) <https://lodash.com/>
|
661
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
662
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
663
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
664
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
665
|
+
* Available under MIT license <https://lodash.com/license>
|
666
|
+
*/
|
667
|
+
var bindCallback = _dereq_('lodash._bindcallback'),
|
668
|
+
isIterateeCall = _dereq_('lodash._isiterateecall'),
|
669
|
+
restParam = _dereq_('lodash.restparam');
|
670
|
+
|
671
|
+
/**
|
672
|
+
* Creates a function that assigns properties of source object(s) to a given
|
673
|
+
* destination object.
|
674
|
+
*
|
675
|
+
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`.
|
676
|
+
*
|
677
|
+
* @private
|
678
|
+
* @param {Function} assigner The function to assign values.
|
679
|
+
* @returns {Function} Returns the new assigner function.
|
680
|
+
*/
|
681
|
+
function createAssigner(assigner) {
|
682
|
+
return restParam(function(object, sources) {
|
683
|
+
var index = -1,
|
684
|
+
length = object == null ? 0 : sources.length,
|
685
|
+
customizer = length > 2 ? sources[length - 2] : undefined,
|
686
|
+
guard = length > 2 ? sources[2] : undefined,
|
687
|
+
thisArg = length > 1 ? sources[length - 1] : undefined;
|
688
|
+
|
689
|
+
if (typeof customizer == 'function') {
|
690
|
+
customizer = bindCallback(customizer, thisArg, 5);
|
691
|
+
length -= 2;
|
692
|
+
} else {
|
693
|
+
customizer = typeof thisArg == 'function' ? thisArg : undefined;
|
694
|
+
length -= (customizer ? 1 : 0);
|
695
|
+
}
|
696
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
697
|
+
customizer = length < 3 ? undefined : customizer;
|
698
|
+
length = 1;
|
699
|
+
}
|
700
|
+
while (++index < length) {
|
701
|
+
var source = sources[index];
|
702
|
+
if (source) {
|
703
|
+
assigner(object, source, customizer);
|
704
|
+
}
|
705
|
+
}
|
706
|
+
return object;
|
707
|
+
});
|
708
|
+
}
|
709
|
+
|
710
|
+
module.exports = createAssigner;
|
711
|
+
|
712
|
+
},{"lodash._bindcallback":7,"lodash._isiterateecall":8,"lodash.restparam":9}],7:[function(_dereq_,module,exports){
|
713
|
+
/**
|
714
|
+
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
|
715
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
716
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
717
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
718
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
719
|
+
* Available under MIT license <https://lodash.com/license>
|
720
|
+
*/
|
721
|
+
|
722
|
+
/**
|
723
|
+
* A specialized version of `baseCallback` which only supports `this` binding
|
724
|
+
* and specifying the number of arguments to provide to `func`.
|
725
|
+
*
|
726
|
+
* @private
|
727
|
+
* @param {Function} func The function to bind.
|
728
|
+
* @param {*} thisArg The `this` binding of `func`.
|
729
|
+
* @param {number} [argCount] The number of arguments to provide to `func`.
|
730
|
+
* @returns {Function} Returns the callback.
|
731
|
+
*/
|
732
|
+
function bindCallback(func, thisArg, argCount) {
|
733
|
+
if (typeof func != 'function') {
|
734
|
+
return identity;
|
735
|
+
}
|
736
|
+
if (thisArg === undefined) {
|
737
|
+
return func;
|
738
|
+
}
|
739
|
+
switch (argCount) {
|
740
|
+
case 1: return function(value) {
|
741
|
+
return func.call(thisArg, value);
|
742
|
+
};
|
743
|
+
case 3: return function(value, index, collection) {
|
744
|
+
return func.call(thisArg, value, index, collection);
|
745
|
+
};
|
746
|
+
case 4: return function(accumulator, value, index, collection) {
|
747
|
+
return func.call(thisArg, accumulator, value, index, collection);
|
748
|
+
};
|
749
|
+
case 5: return function(value, other, key, object, source) {
|
750
|
+
return func.call(thisArg, value, other, key, object, source);
|
751
|
+
};
|
752
|
+
}
|
753
|
+
return function() {
|
754
|
+
return func.apply(thisArg, arguments);
|
755
|
+
};
|
756
|
+
}
|
757
|
+
|
758
|
+
/**
|
759
|
+
* This method returns the first argument provided to it.
|
760
|
+
*
|
761
|
+
* @static
|
762
|
+
* @memberOf _
|
763
|
+
* @category Utility
|
764
|
+
* @param {*} value Any value.
|
765
|
+
* @returns {*} Returns `value`.
|
766
|
+
* @example
|
767
|
+
*
|
768
|
+
* var object = { 'user': 'fred' };
|
769
|
+
*
|
770
|
+
* _.identity(object) === object;
|
771
|
+
* // => true
|
772
|
+
*/
|
773
|
+
function identity(value) {
|
774
|
+
return value;
|
775
|
+
}
|
776
|
+
|
777
|
+
module.exports = bindCallback;
|
778
|
+
|
779
|
+
},{}],8:[function(_dereq_,module,exports){
|
780
|
+
/**
|
781
|
+
* lodash 3.0.9 (Custom Build) <https://lodash.com/>
|
782
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
783
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
784
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
785
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
786
|
+
* Available under MIT license <https://lodash.com/license>
|
787
|
+
*/
|
788
|
+
|
789
|
+
/** Used to detect unsigned integer values. */
|
790
|
+
var reIsUint = /^\d+$/;
|
791
|
+
|
792
|
+
/**
|
793
|
+
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
794
|
+
* of an array-like value.
|
795
|
+
*/
|
796
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
797
|
+
|
798
|
+
/**
|
799
|
+
* The base implementation of `_.property` without support for deep paths.
|
800
|
+
*
|
801
|
+
* @private
|
802
|
+
* @param {string} key The key of the property to get.
|
803
|
+
* @returns {Function} Returns the new function.
|
804
|
+
*/
|
805
|
+
function baseProperty(key) {
|
806
|
+
return function(object) {
|
807
|
+
return object == null ? undefined : object[key];
|
808
|
+
};
|
809
|
+
}
|
810
|
+
|
811
|
+
/**
|
812
|
+
* Gets the "length" property value of `object`.
|
813
|
+
*
|
814
|
+
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
815
|
+
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
816
|
+
*
|
817
|
+
* @private
|
818
|
+
* @param {Object} object The object to query.
|
819
|
+
* @returns {*} Returns the "length" value.
|
820
|
+
*/
|
821
|
+
var getLength = baseProperty('length');
|
822
|
+
|
823
|
+
/**
|
824
|
+
* Checks if `value` is array-like.
|
825
|
+
*
|
826
|
+
* @private
|
827
|
+
* @param {*} value The value to check.
|
828
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
829
|
+
*/
|
830
|
+
function isArrayLike(value) {
|
831
|
+
return value != null && isLength(getLength(value));
|
832
|
+
}
|
833
|
+
|
834
|
+
/**
|
835
|
+
* Checks if `value` is a valid array-like index.
|
836
|
+
*
|
837
|
+
* @private
|
838
|
+
* @param {*} value The value to check.
|
839
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
840
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
841
|
+
*/
|
842
|
+
function isIndex(value, length) {
|
843
|
+
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
844
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
845
|
+
return value > -1 && value % 1 == 0 && value < length;
|
846
|
+
}
|
847
|
+
|
848
|
+
/**
|
849
|
+
* Checks if the provided arguments are from an iteratee call.
|
850
|
+
*
|
851
|
+
* @private
|
852
|
+
* @param {*} value The potential iteratee value argument.
|
853
|
+
* @param {*} index The potential iteratee index or key argument.
|
854
|
+
* @param {*} object The potential iteratee object argument.
|
855
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
|
856
|
+
*/
|
857
|
+
function isIterateeCall(value, index, object) {
|
858
|
+
if (!isObject(object)) {
|
859
|
+
return false;
|
860
|
+
}
|
861
|
+
var type = typeof index;
|
862
|
+
if (type == 'number'
|
863
|
+
? (isArrayLike(object) && isIndex(index, object.length))
|
864
|
+
: (type == 'string' && index in object)) {
|
865
|
+
var other = object[index];
|
866
|
+
return value === value ? (value === other) : (other !== other);
|
867
|
+
}
|
868
|
+
return false;
|
869
|
+
}
|
870
|
+
|
871
|
+
/**
|
872
|
+
* Checks if `value` is a valid array-like length.
|
873
|
+
*
|
874
|
+
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
|
875
|
+
*
|
876
|
+
* @private
|
877
|
+
* @param {*} value The value to check.
|
878
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
879
|
+
*/
|
880
|
+
function isLength(value) {
|
881
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
882
|
+
}
|
883
|
+
|
884
|
+
/**
|
885
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
886
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
887
|
+
*
|
888
|
+
* @static
|
889
|
+
* @memberOf _
|
890
|
+
* @category Lang
|
891
|
+
* @param {*} value The value to check.
|
892
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
893
|
+
* @example
|
894
|
+
*
|
895
|
+
* _.isObject({});
|
896
|
+
* // => true
|
897
|
+
*
|
898
|
+
* _.isObject([1, 2, 3]);
|
899
|
+
* // => true
|
900
|
+
*
|
901
|
+
* _.isObject(1);
|
902
|
+
* // => false
|
903
|
+
*/
|
904
|
+
function isObject(value) {
|
905
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
906
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
907
|
+
var type = typeof value;
|
908
|
+
return !!value && (type == 'object' || type == 'function');
|
909
|
+
}
|
910
|
+
|
911
|
+
module.exports = isIterateeCall;
|
912
|
+
|
913
|
+
},{}],9:[function(_dereq_,module,exports){
|
914
|
+
/**
|
915
|
+
* lodash 3.6.1 (Custom Build) <https://lodash.com/>
|
916
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
917
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
918
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
919
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
920
|
+
* Available under MIT license <https://lodash.com/license>
|
921
|
+
*/
|
922
|
+
|
923
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
924
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
925
|
+
|
926
|
+
/* Native method references for those with the same name as other `lodash` methods. */
|
927
|
+
var nativeMax = Math.max;
|
928
|
+
|
929
|
+
/**
|
930
|
+
* Creates a function that invokes `func` with the `this` binding of the
|
931
|
+
* created function and arguments from `start` and beyond provided as an array.
|
932
|
+
*
|
933
|
+
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
|
934
|
+
*
|
935
|
+
* @static
|
936
|
+
* @memberOf _
|
937
|
+
* @category Function
|
938
|
+
* @param {Function} func The function to apply a rest parameter to.
|
939
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
940
|
+
* @returns {Function} Returns the new function.
|
941
|
+
* @example
|
942
|
+
*
|
943
|
+
* var say = _.restParam(function(what, names) {
|
944
|
+
* return what + ' ' + _.initial(names).join(', ') +
|
945
|
+
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
946
|
+
* });
|
947
|
+
*
|
948
|
+
* say('hello', 'fred', 'barney', 'pebbles');
|
949
|
+
* // => 'hello fred, barney, & pebbles'
|
950
|
+
*/
|
951
|
+
function restParam(func, start) {
|
952
|
+
if (typeof func != 'function') {
|
953
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
954
|
+
}
|
955
|
+
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
|
956
|
+
return function() {
|
957
|
+
var args = arguments,
|
958
|
+
index = -1,
|
959
|
+
length = nativeMax(args.length - start, 0),
|
960
|
+
rest = Array(length);
|
961
|
+
|
962
|
+
while (++index < length) {
|
963
|
+
rest[index] = args[start + index];
|
964
|
+
}
|
965
|
+
switch (start) {
|
966
|
+
case 0: return func.call(this, rest);
|
967
|
+
case 1: return func.call(this, args[0], rest);
|
968
|
+
case 2: return func.call(this, args[0], args[1], rest);
|
969
|
+
}
|
970
|
+
var otherArgs = Array(start + 1);
|
971
|
+
index = -1;
|
972
|
+
while (++index < start) {
|
973
|
+
otherArgs[index] = args[index];
|
974
|
+
}
|
975
|
+
otherArgs[start] = rest;
|
976
|
+
return func.apply(this, otherArgs);
|
977
|
+
};
|
978
|
+
}
|
979
|
+
|
980
|
+
module.exports = restParam;
|
981
|
+
|
982
|
+
},{}],10:[function(_dereq_,module,exports){
|
983
|
+
/**
|
984
|
+
* lodash 3.1.2 (Custom Build) <https://lodash.com/>
|
985
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
986
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
987
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
988
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
989
|
+
* Available under MIT license <https://lodash.com/license>
|
990
|
+
*/
|
991
|
+
var getNative = _dereq_('lodash._getnative'),
|
992
|
+
isArguments = _dereq_('lodash.isarguments'),
|
993
|
+
isArray = _dereq_('lodash.isarray');
|
994
|
+
|
995
|
+
/** Used to detect unsigned integer values. */
|
996
|
+
var reIsUint = /^\d+$/;
|
997
|
+
|
998
|
+
/** Used for native method references. */
|
999
|
+
var objectProto = Object.prototype;
|
1000
|
+
|
1001
|
+
/** Used to check objects for own properties. */
|
1002
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
1003
|
+
|
1004
|
+
/* Native method references for those with the same name as other `lodash` methods. */
|
1005
|
+
var nativeKeys = getNative(Object, 'keys');
|
1006
|
+
|
1007
|
+
/**
|
1008
|
+
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
|
1009
|
+
* of an array-like value.
|
1010
|
+
*/
|
1011
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
1012
|
+
|
1013
|
+
/**
|
1014
|
+
* The base implementation of `_.property` without support for deep paths.
|
1015
|
+
*
|
1016
|
+
* @private
|
1017
|
+
* @param {string} key The key of the property to get.
|
1018
|
+
* @returns {Function} Returns the new function.
|
1019
|
+
*/
|
1020
|
+
function baseProperty(key) {
|
1021
|
+
return function(object) {
|
1022
|
+
return object == null ? undefined : object[key];
|
1023
|
+
};
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* Gets the "length" property value of `object`.
|
1028
|
+
*
|
1029
|
+
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
1030
|
+
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
1031
|
+
*
|
1032
|
+
* @private
|
1033
|
+
* @param {Object} object The object to query.
|
1034
|
+
* @returns {*} Returns the "length" value.
|
1035
|
+
*/
|
1036
|
+
var getLength = baseProperty('length');
|
1037
|
+
|
1038
|
+
/**
|
1039
|
+
* Checks if `value` is array-like.
|
1040
|
+
*
|
1041
|
+
* @private
|
1042
|
+
* @param {*} value The value to check.
|
1043
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
1044
|
+
*/
|
1045
|
+
function isArrayLike(value) {
|
1046
|
+
return value != null && isLength(getLength(value));
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
/**
|
1050
|
+
* Checks if `value` is a valid array-like index.
|
1051
|
+
*
|
1052
|
+
* @private
|
1053
|
+
* @param {*} value The value to check.
|
1054
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
1055
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
1056
|
+
*/
|
1057
|
+
function isIndex(value, length) {
|
1058
|
+
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
1059
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
1060
|
+
return value > -1 && value % 1 == 0 && value < length;
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* Checks if `value` is a valid array-like length.
|
1065
|
+
*
|
1066
|
+
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
1067
|
+
*
|
1068
|
+
* @private
|
1069
|
+
* @param {*} value The value to check.
|
1070
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
1071
|
+
*/
|
1072
|
+
function isLength(value) {
|
1073
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
/**
|
1077
|
+
* A fallback implementation of `Object.keys` which creates an array of the
|
1078
|
+
* own enumerable property names of `object`.
|
1079
|
+
*
|
1080
|
+
* @private
|
1081
|
+
* @param {Object} object The object to query.
|
1082
|
+
* @returns {Array} Returns the array of property names.
|
1083
|
+
*/
|
1084
|
+
function shimKeys(object) {
|
1085
|
+
var props = keysIn(object),
|
1086
|
+
propsLength = props.length,
|
1087
|
+
length = propsLength && object.length;
|
1088
|
+
|
1089
|
+
var allowIndexes = !!length && isLength(length) &&
|
1090
|
+
(isArray(object) || isArguments(object));
|
1091
|
+
|
1092
|
+
var index = -1,
|
1093
|
+
result = [];
|
1094
|
+
|
1095
|
+
while (++index < propsLength) {
|
1096
|
+
var key = props[index];
|
1097
|
+
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
|
1098
|
+
result.push(key);
|
1099
|
+
}
|
1100
|
+
}
|
1101
|
+
return result;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
/**
|
1105
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
1106
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
1107
|
+
*
|
1108
|
+
* @static
|
1109
|
+
* @memberOf _
|
1110
|
+
* @category Lang
|
1111
|
+
* @param {*} value The value to check.
|
1112
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
1113
|
+
* @example
|
1114
|
+
*
|
1115
|
+
* _.isObject({});
|
1116
|
+
* // => true
|
1117
|
+
*
|
1118
|
+
* _.isObject([1, 2, 3]);
|
1119
|
+
* // => true
|
1120
|
+
*
|
1121
|
+
* _.isObject(1);
|
1122
|
+
* // => false
|
1123
|
+
*/
|
1124
|
+
function isObject(value) {
|
1125
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
1126
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
1127
|
+
var type = typeof value;
|
1128
|
+
return !!value && (type == 'object' || type == 'function');
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
/**
|
1132
|
+
* Creates an array of the own enumerable property names of `object`.
|
1133
|
+
*
|
1134
|
+
* **Note:** Non-object values are coerced to objects. See the
|
1135
|
+
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
|
1136
|
+
* for more details.
|
1137
|
+
*
|
1138
|
+
* @static
|
1139
|
+
* @memberOf _
|
1140
|
+
* @category Object
|
1141
|
+
* @param {Object} object The object to query.
|
1142
|
+
* @returns {Array} Returns the array of property names.
|
1143
|
+
* @example
|
1144
|
+
*
|
1145
|
+
* function Foo() {
|
1146
|
+
* this.a = 1;
|
1147
|
+
* this.b = 2;
|
1148
|
+
* }
|
1149
|
+
*
|
1150
|
+
* Foo.prototype.c = 3;
|
1151
|
+
*
|
1152
|
+
* _.keys(new Foo);
|
1153
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
1154
|
+
*
|
1155
|
+
* _.keys('hi');
|
1156
|
+
* // => ['0', '1']
|
1157
|
+
*/
|
1158
|
+
var keys = !nativeKeys ? shimKeys : function(object) {
|
1159
|
+
var Ctor = object == null ? undefined : object.constructor;
|
1160
|
+
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
1161
|
+
(typeof object != 'function' && isArrayLike(object))) {
|
1162
|
+
return shimKeys(object);
|
1163
|
+
}
|
1164
|
+
return isObject(object) ? nativeKeys(object) : [];
|
1165
|
+
};
|
1166
|
+
|
1167
|
+
/**
|
1168
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
1169
|
+
*
|
1170
|
+
* **Note:** Non-object values are coerced to objects.
|
1171
|
+
*
|
1172
|
+
* @static
|
1173
|
+
* @memberOf _
|
1174
|
+
* @category Object
|
1175
|
+
* @param {Object} object The object to query.
|
1176
|
+
* @returns {Array} Returns the array of property names.
|
1177
|
+
* @example
|
1178
|
+
*
|
1179
|
+
* function Foo() {
|
1180
|
+
* this.a = 1;
|
1181
|
+
* this.b = 2;
|
1182
|
+
* }
|
1183
|
+
*
|
1184
|
+
* Foo.prototype.c = 3;
|
1185
|
+
*
|
1186
|
+
* _.keysIn(new Foo);
|
1187
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
1188
|
+
*/
|
1189
|
+
function keysIn(object) {
|
1190
|
+
if (object == null) {
|
1191
|
+
return [];
|
1192
|
+
}
|
1193
|
+
if (!isObject(object)) {
|
1194
|
+
object = Object(object);
|
1195
|
+
}
|
1196
|
+
var length = object.length;
|
1197
|
+
length = (length && isLength(length) &&
|
1198
|
+
(isArray(object) || isArguments(object)) && length) || 0;
|
1199
|
+
|
1200
|
+
var Ctor = object.constructor,
|
1201
|
+
index = -1,
|
1202
|
+
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
|
1203
|
+
result = Array(length),
|
1204
|
+
skipIndexes = length > 0;
|
1205
|
+
|
1206
|
+
while (++index < length) {
|
1207
|
+
result[index] = (index + '');
|
1208
|
+
}
|
1209
|
+
for (var key in object) {
|
1210
|
+
if (!(skipIndexes && isIndex(key, length)) &&
|
1211
|
+
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
1212
|
+
result.push(key);
|
1213
|
+
}
|
1214
|
+
}
|
1215
|
+
return result;
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
module.exports = keys;
|
1219
|
+
|
1220
|
+
},{"lodash._getnative":11,"lodash.isarguments":12,"lodash.isarray":13}],11:[function(_dereq_,module,exports){
|
1221
|
+
/**
|
1222
|
+
* lodash 3.9.1 (Custom Build) <https://lodash.com/>
|
1223
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
1224
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
1225
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
1226
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
1227
|
+
* Available under MIT license <https://lodash.com/license>
|
1228
|
+
*/
|
1229
|
+
|
1230
|
+
/** `Object#toString` result references. */
|
1231
|
+
var funcTag = '[object Function]';
|
1232
|
+
|
1233
|
+
/** Used to detect host constructors (Safari > 5). */
|
1234
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
1235
|
+
|
1236
|
+
/**
|
1237
|
+
* Checks if `value` is object-like.
|
1238
|
+
*
|
1239
|
+
* @private
|
1240
|
+
* @param {*} value The value to check.
|
1241
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
1242
|
+
*/
|
1243
|
+
function isObjectLike(value) {
|
1244
|
+
return !!value && typeof value == 'object';
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
/** Used for native method references. */
|
1248
|
+
var objectProto = Object.prototype;
|
1249
|
+
|
1250
|
+
/** Used to resolve the decompiled source of functions. */
|
1251
|
+
var fnToString = Function.prototype.toString;
|
1252
|
+
|
1253
|
+
/** Used to check objects for own properties. */
|
1254
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
1255
|
+
|
1256
|
+
/**
|
1257
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
1258
|
+
* of values.
|
1259
|
+
*/
|
1260
|
+
var objToString = objectProto.toString;
|
1261
|
+
|
1262
|
+
/** Used to detect if a method is native. */
|
1263
|
+
var reIsNative = RegExp('^' +
|
1264
|
+
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
1265
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
1266
|
+
);
|
1267
|
+
|
1268
|
+
/**
|
1269
|
+
* Gets the native function at `key` of `object`.
|
1270
|
+
*
|
1271
|
+
* @private
|
1272
|
+
* @param {Object} object The object to query.
|
1273
|
+
* @param {string} key The key of the method to get.
|
1274
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
1275
|
+
*/
|
1276
|
+
function getNative(object, key) {
|
1277
|
+
var value = object == null ? undefined : object[key];
|
1278
|
+
return isNative(value) ? value : undefined;
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
/**
|
1282
|
+
* Checks if `value` is classified as a `Function` object.
|
1283
|
+
*
|
1284
|
+
* @static
|
1285
|
+
* @memberOf _
|
1286
|
+
* @category Lang
|
1287
|
+
* @param {*} value The value to check.
|
1288
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
1289
|
+
* @example
|
1290
|
+
*
|
1291
|
+
* _.isFunction(_);
|
1292
|
+
* // => true
|
1293
|
+
*
|
1294
|
+
* _.isFunction(/abc/);
|
1295
|
+
* // => false
|
1296
|
+
*/
|
1297
|
+
function isFunction(value) {
|
1298
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
1299
|
+
// in older versions of Chrome and Safari which return 'function' for regexes
|
1300
|
+
// and Safari 8 equivalents which return 'object' for typed array constructors.
|
1301
|
+
return isObject(value) && objToString.call(value) == funcTag;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
/**
|
1305
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
1306
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
1307
|
+
*
|
1308
|
+
* @static
|
1309
|
+
* @memberOf _
|
1310
|
+
* @category Lang
|
1311
|
+
* @param {*} value The value to check.
|
1312
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
1313
|
+
* @example
|
1314
|
+
*
|
1315
|
+
* _.isObject({});
|
1316
|
+
* // => true
|
1317
|
+
*
|
1318
|
+
* _.isObject([1, 2, 3]);
|
1319
|
+
* // => true
|
1320
|
+
*
|
1321
|
+
* _.isObject(1);
|
1322
|
+
* // => false
|
1323
|
+
*/
|
1324
|
+
function isObject(value) {
|
1325
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
1326
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
1327
|
+
var type = typeof value;
|
1328
|
+
return !!value && (type == 'object' || type == 'function');
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
/**
|
1332
|
+
* Checks if `value` is a native function.
|
1333
|
+
*
|
1334
|
+
* @static
|
1335
|
+
* @memberOf _
|
1336
|
+
* @category Lang
|
1337
|
+
* @param {*} value The value to check.
|
1338
|
+
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
|
1339
|
+
* @example
|
1340
|
+
*
|
1341
|
+
* _.isNative(Array.prototype.push);
|
1342
|
+
* // => true
|
1343
|
+
*
|
1344
|
+
* _.isNative(_);
|
1345
|
+
* // => false
|
1346
|
+
*/
|
1347
|
+
function isNative(value) {
|
1348
|
+
if (value == null) {
|
1349
|
+
return false;
|
1350
|
+
}
|
1351
|
+
if (isFunction(value)) {
|
1352
|
+
return reIsNative.test(fnToString.call(value));
|
1353
|
+
}
|
1354
|
+
return isObjectLike(value) && reIsHostCtor.test(value);
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
module.exports = getNative;
|
1358
|
+
|
1359
|
+
},{}],12:[function(_dereq_,module,exports){
|
1360
|
+
/**
|
1361
|
+
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
|
1362
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
1363
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
1364
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
1365
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
1366
|
+
* Available under MIT license <https://lodash.com/license>
|
1367
|
+
*/
|
1368
|
+
|
1369
|
+
/**
|
1370
|
+
* Checks if `value` is object-like.
|
1371
|
+
*
|
1372
|
+
* @private
|
1373
|
+
* @param {*} value The value to check.
|
1374
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
1375
|
+
*/
|
1376
|
+
function isObjectLike(value) {
|
1377
|
+
return !!value && typeof value == 'object';
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
/** Used for native method references. */
|
1381
|
+
var objectProto = Object.prototype;
|
1382
|
+
|
1383
|
+
/** Used to check objects for own properties. */
|
1384
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
1385
|
+
|
1386
|
+
/** Native method references. */
|
1387
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
1388
|
+
|
1389
|
+
/**
|
1390
|
+
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
|
1391
|
+
* of an array-like value.
|
1392
|
+
*/
|
1393
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
1394
|
+
|
1395
|
+
/**
|
1396
|
+
* The base implementation of `_.property` without support for deep paths.
|
1397
|
+
*
|
1398
|
+
* @private
|
1399
|
+
* @param {string} key The key of the property to get.
|
1400
|
+
* @returns {Function} Returns the new function.
|
1401
|
+
*/
|
1402
|
+
function baseProperty(key) {
|
1403
|
+
return function(object) {
|
1404
|
+
return object == null ? undefined : object[key];
|
1405
|
+
};
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
/**
|
1409
|
+
* Gets the "length" property value of `object`.
|
1410
|
+
*
|
1411
|
+
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
1412
|
+
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
1413
|
+
*
|
1414
|
+
* @private
|
1415
|
+
* @param {Object} object The object to query.
|
1416
|
+
* @returns {*} Returns the "length" value.
|
1417
|
+
*/
|
1418
|
+
var getLength = baseProperty('length');
|
1419
|
+
|
1420
|
+
/**
|
1421
|
+
* Checks if `value` is array-like.
|
1422
|
+
*
|
1423
|
+
* @private
|
1424
|
+
* @param {*} value The value to check.
|
1425
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
1426
|
+
*/
|
1427
|
+
function isArrayLike(value) {
|
1428
|
+
return value != null && isLength(getLength(value));
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
/**
|
1432
|
+
* Checks if `value` is a valid array-like length.
|
1433
|
+
*
|
1434
|
+
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
1435
|
+
*
|
1436
|
+
* @private
|
1437
|
+
* @param {*} value The value to check.
|
1438
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
1439
|
+
*/
|
1440
|
+
function isLength(value) {
|
1441
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
/**
|
1445
|
+
* Checks if `value` is classified as an `arguments` object.
|
1446
|
+
*
|
1447
|
+
* @static
|
1448
|
+
* @memberOf _
|
1449
|
+
* @category Lang
|
1450
|
+
* @param {*} value The value to check.
|
1451
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
1452
|
+
* @example
|
1453
|
+
*
|
1454
|
+
* _.isArguments(function() { return arguments; }());
|
1455
|
+
* // => true
|
1456
|
+
*
|
1457
|
+
* _.isArguments([1, 2, 3]);
|
1458
|
+
* // => false
|
1459
|
+
*/
|
1460
|
+
function isArguments(value) {
|
1461
|
+
return isObjectLike(value) && isArrayLike(value) &&
|
1462
|
+
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
module.exports = isArguments;
|
1466
|
+
|
1467
|
+
},{}],13:[function(_dereq_,module,exports){
|
1468
|
+
/**
|
1469
|
+
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
|
1470
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
1471
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
1472
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
1473
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
1474
|
+
* Available under MIT license <https://lodash.com/license>
|
1475
|
+
*/
|
1476
|
+
|
1477
|
+
/** `Object#toString` result references. */
|
1478
|
+
var arrayTag = '[object Array]',
|
1479
|
+
funcTag = '[object Function]';
|
1480
|
+
|
1481
|
+
/** Used to detect host constructors (Safari > 5). */
|
1482
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
1483
|
+
|
1484
|
+
/**
|
1485
|
+
* Checks if `value` is object-like.
|
1486
|
+
*
|
1487
|
+
* @private
|
1488
|
+
* @param {*} value The value to check.
|
1489
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
1490
|
+
*/
|
1491
|
+
function isObjectLike(value) {
|
1492
|
+
return !!value && typeof value == 'object';
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
/** Used for native method references. */
|
1496
|
+
var objectProto = Object.prototype;
|
1497
|
+
|
1498
|
+
/** Used to resolve the decompiled source of functions. */
|
1499
|
+
var fnToString = Function.prototype.toString;
|
1500
|
+
|
1501
|
+
/** Used to check objects for own properties. */
|
1502
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
1503
|
+
|
1504
|
+
/**
|
1505
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
1506
|
+
* of values.
|
1507
|
+
*/
|
1508
|
+
var objToString = objectProto.toString;
|
1509
|
+
|
1510
|
+
/** Used to detect if a method is native. */
|
1511
|
+
var reIsNative = RegExp('^' +
|
1512
|
+
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
1513
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
1514
|
+
);
|
1515
|
+
|
1516
|
+
/* Native method references for those with the same name as other `lodash` methods. */
|
1517
|
+
var nativeIsArray = getNative(Array, 'isArray');
|
1518
|
+
|
1519
|
+
/**
|
1520
|
+
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
|
1521
|
+
* of an array-like value.
|
1522
|
+
*/
|
1523
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
1524
|
+
|
1525
|
+
/**
|
1526
|
+
* Gets the native function at `key` of `object`.
|
1527
|
+
*
|
1528
|
+
* @private
|
1529
|
+
* @param {Object} object The object to query.
|
1530
|
+
* @param {string} key The key of the method to get.
|
1531
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
1532
|
+
*/
|
1533
|
+
function getNative(object, key) {
|
1534
|
+
var value = object == null ? undefined : object[key];
|
1535
|
+
return isNative(value) ? value : undefined;
|
1536
|
+
}
|
1537
|
+
|
1538
|
+
/**
|
1539
|
+
* Checks if `value` is a valid array-like length.
|
1540
|
+
*
|
1541
|
+
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
1542
|
+
*
|
1543
|
+
* @private
|
1544
|
+
* @param {*} value The value to check.
|
1545
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
1546
|
+
*/
|
1547
|
+
function isLength(value) {
|
1548
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
/**
|
1552
|
+
* Checks if `value` is classified as an `Array` object.
|
1553
|
+
*
|
1554
|
+
* @static
|
1555
|
+
* @memberOf _
|
1556
|
+
* @category Lang
|
1557
|
+
* @param {*} value The value to check.
|
1558
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
1559
|
+
* @example
|
1560
|
+
*
|
1561
|
+
* _.isArray([1, 2, 3]);
|
1562
|
+
* // => true
|
1563
|
+
*
|
1564
|
+
* _.isArray(function() { return arguments; }());
|
1565
|
+
* // => false
|
1566
|
+
*/
|
1567
|
+
var isArray = nativeIsArray || function(value) {
|
1568
|
+
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
|
1569
|
+
};
|
1570
|
+
|
1571
|
+
/**
|
1572
|
+
* Checks if `value` is classified as a `Function` object.
|
1573
|
+
*
|
1574
|
+
* @static
|
1575
|
+
* @memberOf _
|
1576
|
+
* @category Lang
|
1577
|
+
* @param {*} value The value to check.
|
1578
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
1579
|
+
* @example
|
1580
|
+
*
|
1581
|
+
* _.isFunction(_);
|
1582
|
+
* // => true
|
1583
|
+
*
|
1584
|
+
* _.isFunction(/abc/);
|
1585
|
+
* // => false
|
1586
|
+
*/
|
1587
|
+
function isFunction(value) {
|
1588
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
1589
|
+
// in older versions of Chrome and Safari which return 'function' for regexes
|
1590
|
+
// and Safari 8 equivalents which return 'object' for typed array constructors.
|
1591
|
+
return isObject(value) && objToString.call(value) == funcTag;
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
/**
|
1595
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
1596
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
1597
|
+
*
|
1598
|
+
* @static
|
1599
|
+
* @memberOf _
|
1600
|
+
* @category Lang
|
1601
|
+
* @param {*} value The value to check.
|
1602
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
1603
|
+
* @example
|
1604
|
+
*
|
1605
|
+
* _.isObject({});
|
1606
|
+
* // => true
|
1607
|
+
*
|
1608
|
+
* _.isObject([1, 2, 3]);
|
1609
|
+
* // => true
|
1610
|
+
*
|
1611
|
+
* _.isObject(1);
|
1612
|
+
* // => false
|
1613
|
+
*/
|
1614
|
+
function isObject(value) {
|
1615
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
1616
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
1617
|
+
var type = typeof value;
|
1618
|
+
return !!value && (type == 'object' || type == 'function');
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
/**
|
1622
|
+
* Checks if `value` is a native function.
|
1623
|
+
*
|
1624
|
+
* @static
|
1625
|
+
* @memberOf _
|
1626
|
+
* @category Lang
|
1627
|
+
* @param {*} value The value to check.
|
1628
|
+
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
|
1629
|
+
* @example
|
1630
|
+
*
|
1631
|
+
* _.isNative(Array.prototype.push);
|
1632
|
+
* // => true
|
1633
|
+
*
|
1634
|
+
* _.isNative(_);
|
1635
|
+
* // => false
|
1636
|
+
*/
|
1637
|
+
function isNative(value) {
|
1638
|
+
if (value == null) {
|
1639
|
+
return false;
|
1640
|
+
}
|
1641
|
+
if (isFunction(value)) {
|
1642
|
+
return reIsNative.test(fnToString.call(value));
|
1643
|
+
}
|
1644
|
+
return isObjectLike(value) && reIsHostCtor.test(value);
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
module.exports = isArray;
|
1648
|
+
|
1649
|
+
},{}],14:[function(_dereq_,module,exports){
|
1650
|
+
/**
|
1651
|
+
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
|
1652
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
1653
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
1654
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
1655
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
1656
|
+
* Available under MIT license <https://lodash.com/license>
|
1657
|
+
*/
|
1658
|
+
var baseIsEqual = _dereq_('lodash._baseisequal'),
|
1659
|
+
bindCallback = _dereq_('lodash._bindcallback');
|
1660
|
+
|
1661
|
+
/**
|
1662
|
+
* Performs a deep comparison between two values to determine if they are
|
1663
|
+
* equivalent. If `customizer` is provided it is invoked to compare values.
|
1664
|
+
* If `customizer` returns `undefined` comparisons are handled by the method
|
1665
|
+
* instead. The `customizer` is bound to `thisArg` and invoked with three
|
1666
|
+
* arguments: (value, other [, index|key]).
|
1667
|
+
*
|
1668
|
+
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
1669
|
+
* numbers, `Object` objects, regexes, and strings. Objects are compared by
|
1670
|
+
* their own, not inherited, enumerable properties. Functions and DOM nodes
|
1671
|
+
* are **not** supported. Provide a customizer function to extend support
|
1672
|
+
* for comparing other values.
|
1673
|
+
*
|
1674
|
+
* @static
|
1675
|
+
* @memberOf _
|
1676
|
+
* @alias eq
|
1677
|
+
* @category Lang
|
1678
|
+
* @param {*} value The value to compare.
|
1679
|
+
* @param {*} other The other value to compare.
|
1680
|
+
* @param {Function} [customizer] The function to customize value comparisons.
|
1681
|
+
* @param {*} [thisArg] The `this` binding of `customizer`.
|
1682
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
1683
|
+
* @example
|
1684
|
+
*
|
1685
|
+
* var object = { 'user': 'fred' };
|
1686
|
+
* var other = { 'user': 'fred' };
|
1687
|
+
*
|
1688
|
+
* object == other;
|
1689
|
+
* // => false
|
1690
|
+
*
|
1691
|
+
* _.isEqual(object, other);
|
1692
|
+
* // => true
|
1693
|
+
*
|
1694
|
+
* // using a customizer callback
|
1695
|
+
* var array = ['hello', 'goodbye'];
|
1696
|
+
* var other = ['hi', 'goodbye'];
|
1697
|
+
*
|
1698
|
+
* _.isEqual(array, other, function(value, other) {
|
1699
|
+
* if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
|
1700
|
+
* return true;
|
1701
|
+
* }
|
1702
|
+
* });
|
1703
|
+
* // => true
|
1704
|
+
*/
|
1705
|
+
function isEqual(value, other, customizer, thisArg) {
|
1706
|
+
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
|
1707
|
+
var result = customizer ? customizer(value, other) : undefined;
|
1708
|
+
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
module.exports = isEqual;
|
1712
|
+
|
1713
|
+
},{"lodash._baseisequal":15,"lodash._bindcallback":21}],15:[function(_dereq_,module,exports){
|
1714
|
+
/**
|
1715
|
+
* lodash 3.0.7 (Custom Build) <https://lodash.com/>
|
1716
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
1717
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
1718
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
1719
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
1720
|
+
* Available under MIT license <https://lodash.com/license>
|
1721
|
+
*/
|
1722
|
+
var isArray = _dereq_('lodash.isarray'),
|
1723
|
+
isTypedArray = _dereq_('lodash.istypedarray'),
|
1724
|
+
keys = _dereq_('lodash.keys');
|
1725
|
+
|
1726
|
+
/** `Object#toString` result references. */
|
1727
|
+
var argsTag = '[object Arguments]',
|
1728
|
+
arrayTag = '[object Array]',
|
1729
|
+
boolTag = '[object Boolean]',
|
1730
|
+
dateTag = '[object Date]',
|
1731
|
+
errorTag = '[object Error]',
|
1732
|
+
numberTag = '[object Number]',
|
1733
|
+
objectTag = '[object Object]',
|
1734
|
+
regexpTag = '[object RegExp]',
|
1735
|
+
stringTag = '[object String]';
|
1736
|
+
|
1737
|
+
/**
|
1738
|
+
* Checks if `value` is object-like.
|
1739
|
+
*
|
1740
|
+
* @private
|
1741
|
+
* @param {*} value The value to check.
|
1742
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
1743
|
+
*/
|
1744
|
+
function isObjectLike(value) {
|
1745
|
+
return !!value && typeof value == 'object';
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
/** Used for native method references. */
|
1749
|
+
var objectProto = Object.prototype;
|
1750
|
+
|
1751
|
+
/** Used to check objects for own properties. */
|
1752
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
1753
|
+
|
1754
|
+
/**
|
1755
|
+
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
1756
|
+
* of values.
|
1757
|
+
*/
|
1758
|
+
var objToString = objectProto.toString;
|
1759
|
+
|
1760
|
+
/**
|
1761
|
+
* A specialized version of `_.some` for arrays without support for callback
|
1762
|
+
* shorthands and `this` binding.
|
1763
|
+
*
|
1764
|
+
* @private
|
1765
|
+
* @param {Array} array The array to iterate over.
|
1766
|
+
* @param {Function} predicate The function invoked per iteration.
|
1767
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
1768
|
+
* else `false`.
|
1769
|
+
*/
|
1770
|
+
function arraySome(array, predicate) {
|
1771
|
+
var index = -1,
|
1772
|
+
length = array.length;
|
1773
|
+
|
1774
|
+
while (++index < length) {
|
1775
|
+
if (predicate(array[index], index, array)) {
|
1776
|
+
return true;
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
return false;
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
/**
|
1783
|
+
* The base implementation of `_.isEqual` without support for `this` binding
|
1784
|
+
* `customizer` functions.
|
1785
|
+
*
|
1786
|
+
* @private
|
1787
|
+
* @param {*} value The value to compare.
|
1788
|
+
* @param {*} other The other value to compare.
|
1789
|
+
* @param {Function} [customizer] The function to customize comparing values.
|
1790
|
+
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
1791
|
+
* @param {Array} [stackA] Tracks traversed `value` objects.
|
1792
|
+
* @param {Array} [stackB] Tracks traversed `other` objects.
|
1793
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
1794
|
+
*/
|
1795
|
+
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
|
1796
|
+
if (value === other) {
|
1797
|
+
return true;
|
1798
|
+
}
|
1799
|
+
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
1800
|
+
return value !== value && other !== other;
|
1801
|
+
}
|
1802
|
+
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
|
1803
|
+
}
|
1804
|
+
|
1805
|
+
/**
|
1806
|
+
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
1807
|
+
* deep comparisons and tracks traversed objects enabling objects with circular
|
1808
|
+
* references to be compared.
|
1809
|
+
*
|
1810
|
+
* @private
|
1811
|
+
* @param {Object} object The object to compare.
|
1812
|
+
* @param {Object} other The other object to compare.
|
1813
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
1814
|
+
* @param {Function} [customizer] The function to customize comparing objects.
|
1815
|
+
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
1816
|
+
* @param {Array} [stackA=[]] Tracks traversed `value` objects.
|
1817
|
+
* @param {Array} [stackB=[]] Tracks traversed `other` objects.
|
1818
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
1819
|
+
*/
|
1820
|
+
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
1821
|
+
var objIsArr = isArray(object),
|
1822
|
+
othIsArr = isArray(other),
|
1823
|
+
objTag = arrayTag,
|
1824
|
+
othTag = arrayTag;
|
1825
|
+
|
1826
|
+
if (!objIsArr) {
|
1827
|
+
objTag = objToString.call(object);
|
1828
|
+
if (objTag == argsTag) {
|
1829
|
+
objTag = objectTag;
|
1830
|
+
} else if (objTag != objectTag) {
|
1831
|
+
objIsArr = isTypedArray(object);
|
1832
|
+
}
|
1833
|
+
}
|
1834
|
+
if (!othIsArr) {
|
1835
|
+
othTag = objToString.call(other);
|
1836
|
+
if (othTag == argsTag) {
|
1837
|
+
othTag = objectTag;
|
1838
|
+
} else if (othTag != objectTag) {
|
1839
|
+
othIsArr = isTypedArray(other);
|
1840
|
+
}
|
1841
|
+
}
|
1842
|
+
var objIsObj = objTag == objectTag,
|
1843
|
+
othIsObj = othTag == objectTag,
|
1844
|
+
isSameTag = objTag == othTag;
|
1845
|
+
|
1846
|
+
if (isSameTag && !(objIsArr || objIsObj)) {
|
1847
|
+
return equalByTag(object, other, objTag);
|
1848
|
+
}
|
1849
|
+
if (!isLoose) {
|
1850
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
1851
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
1852
|
+
|
1853
|
+
if (objIsWrapped || othIsWrapped) {
|
1854
|
+
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
if (!isSameTag) {
|
1858
|
+
return false;
|
1859
|
+
}
|
1860
|
+
// Assume cyclic values are equal.
|
1861
|
+
// For more information on detecting circular references see https://es5.github.io/#JO.
|
1862
|
+
stackA || (stackA = []);
|
1863
|
+
stackB || (stackB = []);
|
1864
|
+
|
1865
|
+
var length = stackA.length;
|
1866
|
+
while (length--) {
|
1867
|
+
if (stackA[length] == object) {
|
1868
|
+
return stackB[length] == other;
|
1869
|
+
}
|
1870
|
+
}
|
1871
|
+
// Add `object` and `other` to the stack of traversed objects.
|
1872
|
+
stackA.push(object);
|
1873
|
+
stackB.push(other);
|
1874
|
+
|
1875
|
+
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
|
1876
|
+
|
1877
|
+
stackA.pop();
|
1878
|
+
stackB.pop();
|
1879
|
+
|
1880
|
+
return result;
|
1881
|
+
}
|
1882
|
+
|
1883
|
+
/**
|
1884
|
+
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
1885
|
+
* partial deep comparisons.
|
1886
|
+
*
|
1887
|
+
* @private
|
1888
|
+
* @param {Array} array The array to compare.
|
1889
|
+
* @param {Array} other The other array to compare.
|
1890
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
1891
|
+
* @param {Function} [customizer] The function to customize comparing arrays.
|
1892
|
+
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
1893
|
+
* @param {Array} [stackA] Tracks traversed `value` objects.
|
1894
|
+
* @param {Array} [stackB] Tracks traversed `other` objects.
|
1895
|
+
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
1896
|
+
*/
|
1897
|
+
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
1898
|
+
var index = -1,
|
1899
|
+
arrLength = array.length,
|
1900
|
+
othLength = other.length;
|
1901
|
+
|
1902
|
+
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
|
1903
|
+
return false;
|
1904
|
+
}
|
1905
|
+
// Ignore non-index properties.
|
1906
|
+
while (++index < arrLength) {
|
1907
|
+
var arrValue = array[index],
|
1908
|
+
othValue = other[index],
|
1909
|
+
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
|
1910
|
+
|
1911
|
+
if (result !== undefined) {
|
1912
|
+
if (result) {
|
1913
|
+
continue;
|
1914
|
+
}
|
1915
|
+
return false;
|
1916
|
+
}
|
1917
|
+
// Recursively compare arrays (susceptible to call stack limits).
|
1918
|
+
if (isLoose) {
|
1919
|
+
if (!arraySome(other, function(othValue) {
|
1920
|
+
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
1921
|
+
})) {
|
1922
|
+
return false;
|
1923
|
+
}
|
1924
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
|
1925
|
+
return false;
|
1926
|
+
}
|
1927
|
+
}
|
1928
|
+
return true;
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
/**
|
1932
|
+
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
1933
|
+
* the same `toStringTag`.
|
1934
|
+
*
|
1935
|
+
* **Note:** This function only supports comparing values with tags of
|
1936
|
+
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
1937
|
+
*
|
1938
|
+
* @private
|
1939
|
+
* @param {Object} value The object to compare.
|
1940
|
+
* @param {Object} other The other object to compare.
|
1941
|
+
* @param {string} tag The `toStringTag` of the objects to compare.
|
1942
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
1943
|
+
*/
|
1944
|
+
function equalByTag(object, other, tag) {
|
1945
|
+
switch (tag) {
|
1946
|
+
case boolTag:
|
1947
|
+
case dateTag:
|
1948
|
+
// Coerce dates and booleans to numbers, dates to milliseconds and booleans
|
1949
|
+
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
|
1950
|
+
return +object == +other;
|
1951
|
+
|
1952
|
+
case errorTag:
|
1953
|
+
return object.name == other.name && object.message == other.message;
|
1954
|
+
|
1955
|
+
case numberTag:
|
1956
|
+
// Treat `NaN` vs. `NaN` as equal.
|
1957
|
+
return (object != +object)
|
1958
|
+
? other != +other
|
1959
|
+
: object == +other;
|
1960
|
+
|
1961
|
+
case regexpTag:
|
1962
|
+
case stringTag:
|
1963
|
+
// Coerce regexes to strings and treat strings primitives and string
|
1964
|
+
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
|
1965
|
+
return object == (other + '');
|
1966
|
+
}
|
1967
|
+
return false;
|
1968
|
+
}
|
1969
|
+
|
1970
|
+
/**
|
1971
|
+
* A specialized version of `baseIsEqualDeep` for objects with support for
|
1972
|
+
* partial deep comparisons.
|
1973
|
+
*
|
1974
|
+
* @private
|
1975
|
+
* @param {Object} object The object to compare.
|
1976
|
+
* @param {Object} other The other object to compare.
|
1977
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
1978
|
+
* @param {Function} [customizer] The function to customize comparing values.
|
1979
|
+
* @param {boolean} [isLoose] Specify performing partial comparisons.
|
1980
|
+
* @param {Array} [stackA] Tracks traversed `value` objects.
|
1981
|
+
* @param {Array} [stackB] Tracks traversed `other` objects.
|
1982
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
1983
|
+
*/
|
1984
|
+
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
1985
|
+
var objProps = keys(object),
|
1986
|
+
objLength = objProps.length,
|
1987
|
+
othProps = keys(other),
|
1988
|
+
othLength = othProps.length;
|
1989
|
+
|
1990
|
+
if (objLength != othLength && !isLoose) {
|
1991
|
+
return false;
|
1992
|
+
}
|
1993
|
+
var index = objLength;
|
1994
|
+
while (index--) {
|
1995
|
+
var key = objProps[index];
|
1996
|
+
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
|
1997
|
+
return false;
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
var skipCtor = isLoose;
|
2001
|
+
while (++index < objLength) {
|
2002
|
+
key = objProps[index];
|
2003
|
+
var objValue = object[key],
|
2004
|
+
othValue = other[key],
|
2005
|
+
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
|
2006
|
+
|
2007
|
+
// Recursively compare objects (susceptible to call stack limits).
|
2008
|
+
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
|
2009
|
+
return false;
|
2010
|
+
}
|
2011
|
+
skipCtor || (skipCtor = key == 'constructor');
|
2012
|
+
}
|
2013
|
+
if (!skipCtor) {
|
2014
|
+
var objCtor = object.constructor,
|
2015
|
+
othCtor = other.constructor;
|
2016
|
+
|
2017
|
+
// Non `Object` object instances with different constructors are not equal.
|
2018
|
+
if (objCtor != othCtor &&
|
2019
|
+
('constructor' in object && 'constructor' in other) &&
|
2020
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
2021
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
2022
|
+
return false;
|
2023
|
+
}
|
2024
|
+
}
|
2025
|
+
return true;
|
2026
|
+
}
|
2027
|
+
|
2028
|
+
/**
|
2029
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
2030
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
2031
|
+
*
|
2032
|
+
* @static
|
2033
|
+
* @memberOf _
|
2034
|
+
* @category Lang
|
2035
|
+
* @param {*} value The value to check.
|
2036
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
2037
|
+
* @example
|
2038
|
+
*
|
2039
|
+
* _.isObject({});
|
2040
|
+
* // => true
|
2041
|
+
*
|
2042
|
+
* _.isObject([1, 2, 3]);
|
2043
|
+
* // => true
|
2044
|
+
*
|
2045
|
+
* _.isObject(1);
|
2046
|
+
* // => false
|
2047
|
+
*/
|
2048
|
+
function isObject(value) {
|
2049
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
2050
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
2051
|
+
var type = typeof value;
|
2052
|
+
return !!value && (type == 'object' || type == 'function');
|
2053
|
+
}
|
2054
|
+
|
2055
|
+
module.exports = baseIsEqual;
|
2056
|
+
|
2057
|
+
},{"lodash.isarray":16,"lodash.istypedarray":17,"lodash.keys":18}],16:[function(_dereq_,module,exports){
|
2058
|
+
arguments[4][13][0].apply(exports,arguments)
|
2059
|
+
},{"dup":13}],17:[function(_dereq_,module,exports){
|
2060
|
+
/**
|
2061
|
+
* lodash 3.0.2 (Custom Build) <https://lodash.com/>
|
2062
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2063
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2064
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2065
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2066
|
+
* Available under MIT license <https://lodash.com/license>
|
2067
|
+
*/
|
2068
|
+
|
2069
|
+
/** `Object#toString` result references. */
|
2070
|
+
var argsTag = '[object Arguments]',
|
2071
|
+
arrayTag = '[object Array]',
|
2072
|
+
boolTag = '[object Boolean]',
|
2073
|
+
dateTag = '[object Date]',
|
2074
|
+
errorTag = '[object Error]',
|
2075
|
+
funcTag = '[object Function]',
|
2076
|
+
mapTag = '[object Map]',
|
2077
|
+
numberTag = '[object Number]',
|
2078
|
+
objectTag = '[object Object]',
|
2079
|
+
regexpTag = '[object RegExp]',
|
2080
|
+
setTag = '[object Set]',
|
2081
|
+
stringTag = '[object String]',
|
2082
|
+
weakMapTag = '[object WeakMap]';
|
2083
|
+
|
2084
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
2085
|
+
float32Tag = '[object Float32Array]',
|
2086
|
+
float64Tag = '[object Float64Array]',
|
2087
|
+
int8Tag = '[object Int8Array]',
|
2088
|
+
int16Tag = '[object Int16Array]',
|
2089
|
+
int32Tag = '[object Int32Array]',
|
2090
|
+
uint8Tag = '[object Uint8Array]',
|
2091
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
2092
|
+
uint16Tag = '[object Uint16Array]',
|
2093
|
+
uint32Tag = '[object Uint32Array]';
|
2094
|
+
|
2095
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
2096
|
+
var typedArrayTags = {};
|
2097
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
2098
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
2099
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
2100
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
2101
|
+
typedArrayTags[uint32Tag] = true;
|
2102
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
2103
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
2104
|
+
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
|
2105
|
+
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
|
2106
|
+
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
|
2107
|
+
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
|
2108
|
+
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
2109
|
+
|
2110
|
+
/**
|
2111
|
+
* Checks if `value` is object-like.
|
2112
|
+
*
|
2113
|
+
* @private
|
2114
|
+
* @param {*} value The value to check.
|
2115
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
2116
|
+
*/
|
2117
|
+
function isObjectLike(value) {
|
2118
|
+
return !!value && typeof value == 'object';
|
2119
|
+
}
|
2120
|
+
|
2121
|
+
/** Used for native method references. */
|
2122
|
+
var objectProto = Object.prototype;
|
2123
|
+
|
2124
|
+
/**
|
2125
|
+
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
2126
|
+
* of values.
|
2127
|
+
*/
|
2128
|
+
var objToString = objectProto.toString;
|
2129
|
+
|
2130
|
+
/**
|
2131
|
+
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
2132
|
+
* of an array-like value.
|
2133
|
+
*/
|
2134
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
2135
|
+
|
2136
|
+
/**
|
2137
|
+
* Checks if `value` is a valid array-like length.
|
2138
|
+
*
|
2139
|
+
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
|
2140
|
+
*
|
2141
|
+
* @private
|
2142
|
+
* @param {*} value The value to check.
|
2143
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
2144
|
+
*/
|
2145
|
+
function isLength(value) {
|
2146
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
2147
|
+
}
|
2148
|
+
|
2149
|
+
/**
|
2150
|
+
* Checks if `value` is classified as a typed array.
|
2151
|
+
*
|
2152
|
+
* @static
|
2153
|
+
* @memberOf _
|
2154
|
+
* @category Lang
|
2155
|
+
* @param {*} value The value to check.
|
2156
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
2157
|
+
* @example
|
2158
|
+
*
|
2159
|
+
* _.isTypedArray(new Uint8Array);
|
2160
|
+
* // => true
|
2161
|
+
*
|
2162
|
+
* _.isTypedArray([]);
|
2163
|
+
* // => false
|
2164
|
+
*/
|
2165
|
+
function isTypedArray(value) {
|
2166
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
|
2167
|
+
}
|
2168
|
+
|
2169
|
+
module.exports = isTypedArray;
|
2170
|
+
|
2171
|
+
},{}],18:[function(_dereq_,module,exports){
|
2172
|
+
arguments[4][10][0].apply(exports,arguments)
|
2173
|
+
},{"dup":10,"lodash._getnative":19,"lodash.isarguments":20,"lodash.isarray":16}],19:[function(_dereq_,module,exports){
|
2174
|
+
arguments[4][11][0].apply(exports,arguments)
|
2175
|
+
},{"dup":11}],20:[function(_dereq_,module,exports){
|
2176
|
+
arguments[4][12][0].apply(exports,arguments)
|
2177
|
+
},{"dup":12}],21:[function(_dereq_,module,exports){
|
2178
|
+
arguments[4][7][0].apply(exports,arguments)
|
2179
|
+
},{"dup":7}],22:[function(_dereq_,module,exports){
|
2180
|
+
/**
|
2181
|
+
* lodash 3.1.0 (Custom Build) <https://lodash.com/>
|
2182
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2183
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2184
|
+
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
|
2185
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2186
|
+
* Available under MIT license <https://lodash.com/license>
|
2187
|
+
*/
|
2188
|
+
var baseFlatten = _dereq_('lodash._baseflatten'),
|
2189
|
+
bindCallback = _dereq_('lodash._bindcallback'),
|
2190
|
+
pickByArray = _dereq_('lodash._pickbyarray'),
|
2191
|
+
pickByCallback = _dereq_('lodash._pickbycallback'),
|
2192
|
+
restParam = _dereq_('lodash.restparam');
|
2193
|
+
|
2194
|
+
/**
|
2195
|
+
* Creates an object composed of the picked `object` properties. Property
|
2196
|
+
* names may be specified as individual arguments or as arrays of property
|
2197
|
+
* names. If `predicate` is provided it is invoked for each property of `object`
|
2198
|
+
* picking the properties `predicate` returns truthy for. The predicate is
|
2199
|
+
* bound to `thisArg` and invoked with three arguments: (value, key, object).
|
2200
|
+
*
|
2201
|
+
* @static
|
2202
|
+
* @memberOf _
|
2203
|
+
* @category Object
|
2204
|
+
* @param {Object} object The source object.
|
2205
|
+
* @param {Function|...(string|string[])} [predicate] The function invoked per
|
2206
|
+
* iteration or property names to pick, specified as individual property
|
2207
|
+
* names or arrays of property names.
|
2208
|
+
* @param {*} [thisArg] The `this` binding of `predicate`.
|
2209
|
+
* @returns {Object} Returns the new object.
|
2210
|
+
* @example
|
2211
|
+
*
|
2212
|
+
* var object = { 'user': 'fred', 'age': 40 };
|
2213
|
+
*
|
2214
|
+
* _.pick(object, 'user');
|
2215
|
+
* // => { 'user': 'fred' }
|
2216
|
+
*
|
2217
|
+
* _.pick(object, _.isString);
|
2218
|
+
* // => { 'user': 'fred' }
|
2219
|
+
*/
|
2220
|
+
var pick = restParam(function(object, props) {
|
2221
|
+
if (object == null) {
|
2222
|
+
return {};
|
2223
|
+
}
|
2224
|
+
return typeof props[0] == 'function'
|
2225
|
+
? pickByCallback(object, bindCallback(props[0], props[1], 3))
|
2226
|
+
: pickByArray(object, baseFlatten(props));
|
2227
|
+
});
|
2228
|
+
|
2229
|
+
module.exports = pick;
|
2230
|
+
|
2231
|
+
},{"lodash._baseflatten":23,"lodash._bindcallback":26,"lodash._pickbyarray":27,"lodash._pickbycallback":28,"lodash.restparam":33}],23:[function(_dereq_,module,exports){
|
2232
|
+
/**
|
2233
|
+
* lodash 3.1.4 (Custom Build) <https://lodash.com/>
|
2234
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2235
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2236
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2237
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2238
|
+
* Available under MIT license <https://lodash.com/license>
|
2239
|
+
*/
|
2240
|
+
var isArguments = _dereq_('lodash.isarguments'),
|
2241
|
+
isArray = _dereq_('lodash.isarray');
|
2242
|
+
|
2243
|
+
/**
|
2244
|
+
* Checks if `value` is object-like.
|
2245
|
+
*
|
2246
|
+
* @private
|
2247
|
+
* @param {*} value The value to check.
|
2248
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
2249
|
+
*/
|
2250
|
+
function isObjectLike(value) {
|
2251
|
+
return !!value && typeof value == 'object';
|
2252
|
+
}
|
2253
|
+
|
2254
|
+
/**
|
2255
|
+
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
|
2256
|
+
* of an array-like value.
|
2257
|
+
*/
|
2258
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
2259
|
+
|
2260
|
+
/**
|
2261
|
+
* Appends the elements of `values` to `array`.
|
2262
|
+
*
|
2263
|
+
* @private
|
2264
|
+
* @param {Array} array The array to modify.
|
2265
|
+
* @param {Array} values The values to append.
|
2266
|
+
* @returns {Array} Returns `array`.
|
2267
|
+
*/
|
2268
|
+
function arrayPush(array, values) {
|
2269
|
+
var index = -1,
|
2270
|
+
length = values.length,
|
2271
|
+
offset = array.length;
|
2272
|
+
|
2273
|
+
while (++index < length) {
|
2274
|
+
array[offset + index] = values[index];
|
2275
|
+
}
|
2276
|
+
return array;
|
2277
|
+
}
|
2278
|
+
|
2279
|
+
/**
|
2280
|
+
* The base implementation of `_.flatten` with added support for restricting
|
2281
|
+
* flattening and specifying the start index.
|
2282
|
+
*
|
2283
|
+
* @private
|
2284
|
+
* @param {Array} array The array to flatten.
|
2285
|
+
* @param {boolean} [isDeep] Specify a deep flatten.
|
2286
|
+
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
|
2287
|
+
* @param {Array} [result=[]] The initial result value.
|
2288
|
+
* @returns {Array} Returns the new flattened array.
|
2289
|
+
*/
|
2290
|
+
function baseFlatten(array, isDeep, isStrict, result) {
|
2291
|
+
result || (result = []);
|
2292
|
+
|
2293
|
+
var index = -1,
|
2294
|
+
length = array.length;
|
2295
|
+
|
2296
|
+
while (++index < length) {
|
2297
|
+
var value = array[index];
|
2298
|
+
if (isObjectLike(value) && isArrayLike(value) &&
|
2299
|
+
(isStrict || isArray(value) || isArguments(value))) {
|
2300
|
+
if (isDeep) {
|
2301
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
2302
|
+
baseFlatten(value, isDeep, isStrict, result);
|
2303
|
+
} else {
|
2304
|
+
arrayPush(result, value);
|
2305
|
+
}
|
2306
|
+
} else if (!isStrict) {
|
2307
|
+
result[result.length] = value;
|
2308
|
+
}
|
2309
|
+
}
|
2310
|
+
return result;
|
2311
|
+
}
|
2312
|
+
|
2313
|
+
/**
|
2314
|
+
* The base implementation of `_.property` without support for deep paths.
|
2315
|
+
*
|
2316
|
+
* @private
|
2317
|
+
* @param {string} key The key of the property to get.
|
2318
|
+
* @returns {Function} Returns the new function.
|
2319
|
+
*/
|
2320
|
+
function baseProperty(key) {
|
2321
|
+
return function(object) {
|
2322
|
+
return object == null ? undefined : object[key];
|
2323
|
+
};
|
2324
|
+
}
|
2325
|
+
|
2326
|
+
/**
|
2327
|
+
* Gets the "length" property value of `object`.
|
2328
|
+
*
|
2329
|
+
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
2330
|
+
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
2331
|
+
*
|
2332
|
+
* @private
|
2333
|
+
* @param {Object} object The object to query.
|
2334
|
+
* @returns {*} Returns the "length" value.
|
2335
|
+
*/
|
2336
|
+
var getLength = baseProperty('length');
|
2337
|
+
|
2338
|
+
/**
|
2339
|
+
* Checks if `value` is array-like.
|
2340
|
+
*
|
2341
|
+
* @private
|
2342
|
+
* @param {*} value The value to check.
|
2343
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
2344
|
+
*/
|
2345
|
+
function isArrayLike(value) {
|
2346
|
+
return value != null && isLength(getLength(value));
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
/**
|
2350
|
+
* Checks if `value` is a valid array-like length.
|
2351
|
+
*
|
2352
|
+
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
2353
|
+
*
|
2354
|
+
* @private
|
2355
|
+
* @param {*} value The value to check.
|
2356
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
2357
|
+
*/
|
2358
|
+
function isLength(value) {
|
2359
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
2360
|
+
}
|
2361
|
+
|
2362
|
+
module.exports = baseFlatten;
|
2363
|
+
|
2364
|
+
},{"lodash.isarguments":24,"lodash.isarray":25}],24:[function(_dereq_,module,exports){
|
2365
|
+
arguments[4][12][0].apply(exports,arguments)
|
2366
|
+
},{"dup":12}],25:[function(_dereq_,module,exports){
|
2367
|
+
arguments[4][13][0].apply(exports,arguments)
|
2368
|
+
},{"dup":13}],26:[function(_dereq_,module,exports){
|
2369
|
+
arguments[4][7][0].apply(exports,arguments)
|
2370
|
+
},{"dup":7}],27:[function(_dereq_,module,exports){
|
2371
|
+
/**
|
2372
|
+
* lodash 3.0.2 (Custom Build) <https://lodash.com/>
|
2373
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2374
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2375
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2376
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2377
|
+
* Available under MIT license <https://lodash.com/license>
|
2378
|
+
*/
|
2379
|
+
|
2380
|
+
/**
|
2381
|
+
* A specialized version of `_.pick` which picks `object` properties specified
|
2382
|
+
* by `props`.
|
2383
|
+
*
|
2384
|
+
* @private
|
2385
|
+
* @param {Object} object The source object.
|
2386
|
+
* @param {string[]} props The property names to pick.
|
2387
|
+
* @returns {Object} Returns the new object.
|
2388
|
+
*/
|
2389
|
+
function pickByArray(object, props) {
|
2390
|
+
object = toObject(object);
|
2391
|
+
|
2392
|
+
var index = -1,
|
2393
|
+
length = props.length,
|
2394
|
+
result = {};
|
2395
|
+
|
2396
|
+
while (++index < length) {
|
2397
|
+
var key = props[index];
|
2398
|
+
if (key in object) {
|
2399
|
+
result[key] = object[key];
|
2400
|
+
}
|
2401
|
+
}
|
2402
|
+
return result;
|
2403
|
+
}
|
2404
|
+
|
2405
|
+
/**
|
2406
|
+
* Converts `value` to an object if it's not one.
|
2407
|
+
*
|
2408
|
+
* @private
|
2409
|
+
* @param {*} value The value to process.
|
2410
|
+
* @returns {Object} Returns the object.
|
2411
|
+
*/
|
2412
|
+
function toObject(value) {
|
2413
|
+
return isObject(value) ? value : Object(value);
|
2414
|
+
}
|
2415
|
+
|
2416
|
+
/**
|
2417
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
2418
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
2419
|
+
*
|
2420
|
+
* @static
|
2421
|
+
* @memberOf _
|
2422
|
+
* @category Lang
|
2423
|
+
* @param {*} value The value to check.
|
2424
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
2425
|
+
* @example
|
2426
|
+
*
|
2427
|
+
* _.isObject({});
|
2428
|
+
* // => true
|
2429
|
+
*
|
2430
|
+
* _.isObject([1, 2, 3]);
|
2431
|
+
* // => true
|
2432
|
+
*
|
2433
|
+
* _.isObject(1);
|
2434
|
+
* // => false
|
2435
|
+
*/
|
2436
|
+
function isObject(value) {
|
2437
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
2438
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
2439
|
+
var type = typeof value;
|
2440
|
+
return !!value && (type == 'object' || type == 'function');
|
2441
|
+
}
|
2442
|
+
|
2443
|
+
module.exports = pickByArray;
|
2444
|
+
|
2445
|
+
},{}],28:[function(_dereq_,module,exports){
|
2446
|
+
/**
|
2447
|
+
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
2448
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2449
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2450
|
+
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
2451
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2452
|
+
* Available under MIT license <https://lodash.com/license>
|
2453
|
+
*/
|
2454
|
+
var baseFor = _dereq_('lodash._basefor'),
|
2455
|
+
keysIn = _dereq_('lodash.keysin');
|
2456
|
+
|
2457
|
+
/**
|
2458
|
+
* The base implementation of `_.forIn` without support for callback
|
2459
|
+
* shorthands and `this` binding.
|
2460
|
+
*
|
2461
|
+
* @private
|
2462
|
+
* @param {Object} object The object to iterate over.
|
2463
|
+
* @param {Function} iteratee The function invoked per iteration.
|
2464
|
+
* @returns {Object} Returns `object`.
|
2465
|
+
*/
|
2466
|
+
function baseForIn(object, iteratee) {
|
2467
|
+
return baseFor(object, iteratee, keysIn);
|
2468
|
+
}
|
2469
|
+
|
2470
|
+
/**
|
2471
|
+
* A specialized version of `_.pick` that picks `object` properties `predicate`
|
2472
|
+
* returns truthy for.
|
2473
|
+
*
|
2474
|
+
* @private
|
2475
|
+
* @param {Object} object The source object.
|
2476
|
+
* @param {Function} predicate The function invoked per iteration.
|
2477
|
+
* @returns {Object} Returns the new object.
|
2478
|
+
*/
|
2479
|
+
function pickByCallback(object, predicate) {
|
2480
|
+
var result = {};
|
2481
|
+
baseForIn(object, function(value, key, object) {
|
2482
|
+
if (predicate(value, key, object)) {
|
2483
|
+
result[key] = value;
|
2484
|
+
}
|
2485
|
+
});
|
2486
|
+
return result;
|
2487
|
+
}
|
2488
|
+
|
2489
|
+
module.exports = pickByCallback;
|
2490
|
+
|
2491
|
+
},{"lodash._basefor":29,"lodash.keysin":30}],29:[function(_dereq_,module,exports){
|
2492
|
+
/**
|
2493
|
+
* lodash 3.0.2 (Custom Build) <https://lodash.com/>
|
2494
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2495
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2496
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2497
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2498
|
+
* Available under MIT license <https://lodash.com/license>
|
2499
|
+
*/
|
2500
|
+
|
2501
|
+
/**
|
2502
|
+
* The base implementation of `baseForIn` and `baseForOwn` which iterates
|
2503
|
+
* over `object` properties returned by `keysFunc` invoking `iteratee` for
|
2504
|
+
* each property. Iteratee functions may exit iteration early by explicitly
|
2505
|
+
* returning `false`.
|
2506
|
+
*
|
2507
|
+
* @private
|
2508
|
+
* @param {Object} object The object to iterate over.
|
2509
|
+
* @param {Function} iteratee The function invoked per iteration.
|
2510
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
2511
|
+
* @returns {Object} Returns `object`.
|
2512
|
+
*/
|
2513
|
+
var baseFor = createBaseFor();
|
2514
|
+
|
2515
|
+
/**
|
2516
|
+
* Creates a base function for `_.forIn` or `_.forInRight`.
|
2517
|
+
*
|
2518
|
+
* @private
|
2519
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
2520
|
+
* @returns {Function} Returns the new base function.
|
2521
|
+
*/
|
2522
|
+
function createBaseFor(fromRight) {
|
2523
|
+
return function(object, iteratee, keysFunc) {
|
2524
|
+
var iterable = toObject(object),
|
2525
|
+
props = keysFunc(object),
|
2526
|
+
length = props.length,
|
2527
|
+
index = fromRight ? length : -1;
|
2528
|
+
|
2529
|
+
while ((fromRight ? index-- : ++index < length)) {
|
2530
|
+
var key = props[index];
|
2531
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
2532
|
+
break;
|
2533
|
+
}
|
2534
|
+
}
|
2535
|
+
return object;
|
2536
|
+
};
|
2537
|
+
}
|
2538
|
+
|
2539
|
+
/**
|
2540
|
+
* Converts `value` to an object if it's not one.
|
2541
|
+
*
|
2542
|
+
* @private
|
2543
|
+
* @param {*} value The value to process.
|
2544
|
+
* @returns {Object} Returns the object.
|
2545
|
+
*/
|
2546
|
+
function toObject(value) {
|
2547
|
+
return isObject(value) ? value : Object(value);
|
2548
|
+
}
|
2549
|
+
|
2550
|
+
/**
|
2551
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
2552
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
2553
|
+
*
|
2554
|
+
* @static
|
2555
|
+
* @memberOf _
|
2556
|
+
* @category Lang
|
2557
|
+
* @param {*} value The value to check.
|
2558
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
2559
|
+
* @example
|
2560
|
+
*
|
2561
|
+
* _.isObject({});
|
2562
|
+
* // => true
|
2563
|
+
*
|
2564
|
+
* _.isObject([1, 2, 3]);
|
2565
|
+
* // => true
|
2566
|
+
*
|
2567
|
+
* _.isObject(1);
|
2568
|
+
* // => false
|
2569
|
+
*/
|
2570
|
+
function isObject(value) {
|
2571
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
2572
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
2573
|
+
var type = typeof value;
|
2574
|
+
return !!value && (type == 'object' || type == 'function');
|
2575
|
+
}
|
2576
|
+
|
2577
|
+
module.exports = baseFor;
|
2578
|
+
|
2579
|
+
},{}],30:[function(_dereq_,module,exports){
|
2580
|
+
/**
|
2581
|
+
* lodash 3.0.8 (Custom Build) <https://lodash.com/>
|
2582
|
+
* Build: `lodash modern modularize exports="npm" -o ./`
|
2583
|
+
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
2584
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
2585
|
+
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
2586
|
+
* Available under MIT license <https://lodash.com/license>
|
2587
|
+
*/
|
2588
|
+
var isArguments = _dereq_('lodash.isarguments'),
|
2589
|
+
isArray = _dereq_('lodash.isarray');
|
2590
|
+
|
2591
|
+
/** Used to detect unsigned integer values. */
|
2592
|
+
var reIsUint = /^\d+$/;
|
2593
|
+
|
2594
|
+
/** Used for native method references. */
|
2595
|
+
var objectProto = Object.prototype;
|
2596
|
+
|
2597
|
+
/** Used to check objects for own properties. */
|
2598
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
2599
|
+
|
2600
|
+
/**
|
2601
|
+
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
2602
|
+
* of an array-like value.
|
2603
|
+
*/
|
2604
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
2605
|
+
|
2606
|
+
/**
|
2607
|
+
* Checks if `value` is a valid array-like index.
|
2608
|
+
*
|
2609
|
+
* @private
|
2610
|
+
* @param {*} value The value to check.
|
2611
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
2612
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
2613
|
+
*/
|
2614
|
+
function isIndex(value, length) {
|
2615
|
+
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
2616
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
2617
|
+
return value > -1 && value % 1 == 0 && value < length;
|
2618
|
+
}
|
2619
|
+
|
2620
|
+
/**
|
2621
|
+
* Checks if `value` is a valid array-like length.
|
2622
|
+
*
|
2623
|
+
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
|
2624
|
+
*
|
2625
|
+
* @private
|
2626
|
+
* @param {*} value The value to check.
|
2627
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
2628
|
+
*/
|
2629
|
+
function isLength(value) {
|
2630
|
+
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
2631
|
+
}
|
2632
|
+
|
2633
|
+
/**
|
2634
|
+
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
2635
|
+
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
2636
|
+
*
|
2637
|
+
* @static
|
2638
|
+
* @memberOf _
|
2639
|
+
* @category Lang
|
2640
|
+
* @param {*} value The value to check.
|
2641
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
2642
|
+
* @example
|
2643
|
+
*
|
2644
|
+
* _.isObject({});
|
2645
|
+
* // => true
|
2646
|
+
*
|
2647
|
+
* _.isObject([1, 2, 3]);
|
2648
|
+
* // => true
|
2649
|
+
*
|
2650
|
+
* _.isObject(1);
|
2651
|
+
* // => false
|
2652
|
+
*/
|
2653
|
+
function isObject(value) {
|
2654
|
+
// Avoid a V8 JIT bug in Chrome 19-20.
|
2655
|
+
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
2656
|
+
var type = typeof value;
|
2657
|
+
return !!value && (type == 'object' || type == 'function');
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
/**
|
2661
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
2662
|
+
*
|
2663
|
+
* **Note:** Non-object values are coerced to objects.
|
2664
|
+
*
|
2665
|
+
* @static
|
2666
|
+
* @memberOf _
|
2667
|
+
* @category Object
|
2668
|
+
* @param {Object} object The object to query.
|
2669
|
+
* @returns {Array} Returns the array of property names.
|
2670
|
+
* @example
|
2671
|
+
*
|
2672
|
+
* function Foo() {
|
2673
|
+
* this.a = 1;
|
2674
|
+
* this.b = 2;
|
2675
|
+
* }
|
2676
|
+
*
|
2677
|
+
* Foo.prototype.c = 3;
|
2678
|
+
*
|
2679
|
+
* _.keysIn(new Foo);
|
2680
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
2681
|
+
*/
|
2682
|
+
function keysIn(object) {
|
2683
|
+
if (object == null) {
|
2684
|
+
return [];
|
2685
|
+
}
|
2686
|
+
if (!isObject(object)) {
|
2687
|
+
object = Object(object);
|
2688
|
+
}
|
2689
|
+
var length = object.length;
|
2690
|
+
length = (length && isLength(length) &&
|
2691
|
+
(isArray(object) || isArguments(object)) && length) || 0;
|
2692
|
+
|
2693
|
+
var Ctor = object.constructor,
|
2694
|
+
index = -1,
|
2695
|
+
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
|
2696
|
+
result = Array(length),
|
2697
|
+
skipIndexes = length > 0;
|
2698
|
+
|
2699
|
+
while (++index < length) {
|
2700
|
+
result[index] = (index + '');
|
2701
|
+
}
|
2702
|
+
for (var key in object) {
|
2703
|
+
if (!(skipIndexes && isIndex(key, length)) &&
|
2704
|
+
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
2705
|
+
result.push(key);
|
2706
|
+
}
|
2707
|
+
}
|
2708
|
+
return result;
|
2709
|
+
}
|
2710
|
+
|
2711
|
+
module.exports = keysIn;
|
2712
|
+
|
2713
|
+
},{"lodash.isarguments":31,"lodash.isarray":32}],31:[function(_dereq_,module,exports){
|
2714
|
+
arguments[4][12][0].apply(exports,arguments)
|
2715
|
+
},{"dup":12}],32:[function(_dereq_,module,exports){
|
2716
|
+
arguments[4][13][0].apply(exports,arguments)
|
2717
|
+
},{"dup":13}],33:[function(_dereq_,module,exports){
|
2718
|
+
arguments[4][9][0].apply(exports,arguments)
|
2719
|
+
},{"dup":9}],34:[function(_dereq_,module,exports){
|
2720
|
+
"use strict";
|
2721
|
+
|
2722
|
+
var filter = _dereq_('lodash.pick'),
|
2723
|
+
isEqual = _dereq_('lodash.isequal');
|
2724
|
+
|
2725
|
+
|
2726
|
+
/**
|
2727
|
+
* Directly fetch `shouldComponentUpdate` mixin to use outside of Omniscient.
|
2728
|
+
* You can do this if you don't want to use Omniscients syntactic sugar.
|
2729
|
+
*
|
2730
|
+
* @param {Object} nextProps Next props. Can be objects of cursors, values or immutable structures
|
2731
|
+
* @param {Object} nextState Next state. Can be objects of values or immutable structures
|
2732
|
+
*
|
2733
|
+
* @property {Function} isCursor Get default isCursor
|
2734
|
+
* @property {Function} isEqualState Get default isEqualState
|
2735
|
+
* @property {Function} isEqualProps Get default isEqualProps
|
2736
|
+
* @property {Function} isEqualCursor Get default isEqualCursor
|
2737
|
+
* @property {Function} isImmutable Get default isImmutable
|
2738
|
+
* @property {Function} isIgnorable Get default isIgnorable
|
2739
|
+
* @property {Function} debug Get default debug
|
2740
|
+
*
|
2741
|
+
* @module shouldComponentUpdate
|
2742
|
+
* @returns {Component}
|
2743
|
+
* @api public
|
2744
|
+
*/
|
2745
|
+
module.exports = factory();
|
2746
|
+
|
2747
|
+
/**
|
2748
|
+
* Create a “local” instance of the shouldComponentUpdate with overriden defaults.
|
2749
|
+
*
|
2750
|
+
* ### Options
|
2751
|
+
* ```js
|
2752
|
+
* {
|
2753
|
+
* isCursor: function (cursor), // check if is props
|
2754
|
+
* isEqualCursor: function (oneCursor, otherCursor), // check cursor
|
2755
|
+
* isEqualState: function (currentState, nextState), // check state
|
2756
|
+
* isImmutable: function (currentState, nextState), // check if object is immutable
|
2757
|
+
* isEqualProps: function (currentProps, nextProps), // check props
|
2758
|
+
* isIgnorable: function (propertyValue, propertyKey), // check if property item is ignorable
|
2759
|
+
* unCursor: function (cursor) // convert from cursor to object
|
2760
|
+
* }
|
2761
|
+
* ```
|
2762
|
+
*
|
2763
|
+
* @param {Object} [Options] Options with defaults to override
|
2764
|
+
*
|
2765
|
+
* @module shouldComponentUpdate.withDefaults
|
2766
|
+
* @returns {Function} shouldComponentUpdate with overriden defaults
|
2767
|
+
* @api public
|
2768
|
+
*/
|
2769
|
+
module.exports.withDefaults = factory;
|
2770
|
+
|
2771
|
+
function factory (methods) {
|
2772
|
+
var debug;
|
2773
|
+
methods = methods || {};
|
2774
|
+
|
2775
|
+
var _isCursor = methods.isCursor || isCursor,
|
2776
|
+
_isEqualCursor = methods.isEqualCursor || isEqualCursor,
|
2777
|
+
_isEqualState = methods.isEqualState || isEqualState,
|
2778
|
+
_isEqualProps = methods.isEqualProps || isEqualProps,
|
2779
|
+
_isImmutable = methods.isImmutable || isImmutable,
|
2780
|
+
_isIgnorable = methods.isIgnorable || isIgnorable,
|
2781
|
+
_unCursor = methods.unCursor || unCursor;
|
2782
|
+
|
2783
|
+
var isNotIgnorable = not(or(_isIgnorable, isChildren));
|
2784
|
+
|
2785
|
+
shouldComponentUpdate.isCursor = _isCursor;
|
2786
|
+
shouldComponentUpdate.isEqualState = _isEqualState;
|
2787
|
+
shouldComponentUpdate.isEqualProps = _isEqualProps;
|
2788
|
+
shouldComponentUpdate.isEqualCursor = _isEqualCursor;
|
2789
|
+
shouldComponentUpdate.isImmutable = _isImmutable;
|
2790
|
+
shouldComponentUpdate.debug = debugFn;
|
2791
|
+
|
2792
|
+
return shouldComponentUpdate;
|
2793
|
+
|
2794
|
+
function shouldComponentUpdate (nextProps, nextState) {
|
2795
|
+
if (nextProps === this.props && nextState === this.state) {
|
2796
|
+
if (debug) debug.call(this, 'shouldComponentUpdate => false (equal input)');
|
2797
|
+
return false;
|
2798
|
+
}
|
2799
|
+
|
2800
|
+
if (!_isEqualState(this.state, nextState)) {
|
2801
|
+
if (debug) debug.call(this, 'shouldComponentUpdate => true (state has changed)');
|
2802
|
+
return true;
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
var filteredNextProps = filter(nextProps, isNotIgnorable),
|
2806
|
+
filteredCurrentProps = filter(this.props, isNotIgnorable);
|
2807
|
+
|
2808
|
+
if (!_isEqualProps(filteredCurrentProps, filteredNextProps)) {
|
2809
|
+
if (debug) debug.call(this, 'shouldComponentUpdate => true (props have changed)');
|
2810
|
+
return true;
|
2811
|
+
}
|
2812
|
+
|
2813
|
+
if (debug) debug.call(this, 'shouldComponentUpdate => false');
|
2814
|
+
return false;
|
2815
|
+
}
|
2816
|
+
|
2817
|
+
/**
|
2818
|
+
* Predicate to check if state is equal. Checks in the tree for immutable structures
|
2819
|
+
* and if it is, check by reference. Does not support cursors.
|
2820
|
+
*
|
2821
|
+
* Override through `shouldComponentUpdate.withDefaults`.
|
2822
|
+
*
|
2823
|
+
* @param {Object} value
|
2824
|
+
* @param {Object} other
|
2825
|
+
*
|
2826
|
+
* @module shouldComponentUpdate.isEqualState
|
2827
|
+
* @returns {Boolean}
|
2828
|
+
* @api public
|
2829
|
+
*/
|
2830
|
+
function isEqualState (value, other) {
|
2831
|
+
return isEqual(value, other, function (current, next) {
|
2832
|
+
if (current === next) return true;
|
2833
|
+
return compare(current, next, _isImmutable, isEqualImmutable);
|
2834
|
+
});
|
2835
|
+
}
|
2836
|
+
|
2837
|
+
/**
|
2838
|
+
* Predicate to check if props are equal. Checks in the tree for cursors and immutable structures
|
2839
|
+
* and if it is, check by reference.
|
2840
|
+
*
|
2841
|
+
* Override through `shouldComponentUpdate.withDefaults`.
|
2842
|
+
*
|
2843
|
+
* @param {Object} value
|
2844
|
+
* @param {Object} other
|
2845
|
+
*
|
2846
|
+
* @module shouldComponentUpdate.isEqualProps
|
2847
|
+
* @returns {Boolean}
|
2848
|
+
* @api public
|
2849
|
+
*/
|
2850
|
+
function isEqualProps (value, other) {
|
2851
|
+
if (value === other) return true;
|
2852
|
+
|
2853
|
+
var cursorsEqual = compare(value, other, _isCursor, _isEqualCursor);
|
2854
|
+
if (cursorsEqual !== void 0) return cursorsEqual;
|
2855
|
+
|
2856
|
+
var immutableEqual = compare(value, other, _isImmutable, isEqualImmutable);
|
2857
|
+
if (immutableEqual !== void 0) return immutableEqual;
|
2858
|
+
|
2859
|
+
return isEqual(value, other, function (current, next) {
|
2860
|
+
if (current === next) return true;
|
2861
|
+
|
2862
|
+
var cursorsEqual = compare(current, next, _isCursor, _isEqualCursor);
|
2863
|
+
if (cursorsEqual !== void 0) return cursorsEqual;
|
2864
|
+
|
2865
|
+
return compare(current, next, _isImmutable, isEqualImmutable);
|
2866
|
+
});
|
2867
|
+
}
|
2868
|
+
|
2869
|
+
/**
|
2870
|
+
* Predicate to check if cursors are equal through reference checks. Uses `unCursor`.
|
2871
|
+
* Override through `shouldComponentUpdate.withDefaults` to support different cursor
|
2872
|
+
* implementations.
|
2873
|
+
*
|
2874
|
+
* @param {Cursor} a
|
2875
|
+
* @param {Cursor} b
|
2876
|
+
*
|
2877
|
+
* @module shouldComponentUpdate.isEqualCursor
|
2878
|
+
* @returns {Boolean}
|
2879
|
+
* @api public
|
2880
|
+
*/
|
2881
|
+
function isEqualCursor (a, b) {
|
2882
|
+
return _unCursor(a) === _unCursor(b);
|
2883
|
+
}
|
2884
|
+
|
2885
|
+
function debugFn (pattern, logFn) {
|
2886
|
+
if (typeof pattern === 'function') {
|
2887
|
+
logFn = pattern;
|
2888
|
+
pattern = void 0;
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
var logger = logFn;
|
2892
|
+
if (!logger && console.debug) {
|
2893
|
+
logger = console.debug.bind(console);
|
2894
|
+
}
|
2895
|
+
if (!logger && console.info) {
|
2896
|
+
logger = console.info.bind(console);
|
2897
|
+
}
|
2898
|
+
|
2899
|
+
var regex = new RegExp(pattern || '.*');
|
2900
|
+
debug = function (str) {
|
2901
|
+
var element = this._currentElement;
|
2902
|
+
if (this._reactInternalInstance && this._reactInternalInstance._currentElement) {
|
2903
|
+
element = this._reactInternalInstance._currentElement;
|
2904
|
+
}
|
2905
|
+
var key = element && element.key ? ' key=' + element.key : '';
|
2906
|
+
var name = this.constructor.displayName;
|
2907
|
+
if (!key && !name) {
|
2908
|
+
name = 'Unknown';
|
2909
|
+
}
|
2910
|
+
var tag = name + key;
|
2911
|
+
if (regex.test(tag)) logger('<' + tag + '>: ' + str);
|
2912
|
+
};
|
2913
|
+
return debug;
|
2914
|
+
}
|
2915
|
+
}
|
2916
|
+
|
2917
|
+
function compare (current, next, typeCheck, equalCheck) {
|
2918
|
+
var isCurrent = typeCheck(current);
|
2919
|
+
var isNext = typeCheck(next);
|
2920
|
+
|
2921
|
+
if (isCurrent && isNext) {
|
2922
|
+
return equalCheck(current, next);
|
2923
|
+
}
|
2924
|
+
if (isCurrent || isNext) {
|
2925
|
+
return false;
|
2926
|
+
}
|
2927
|
+
return void 0;
|
2928
|
+
}
|
2929
|
+
|
2930
|
+
function isEqualImmutable (a, b) {
|
2931
|
+
return a === b;
|
2932
|
+
}
|
2933
|
+
|
2934
|
+
/**
|
2935
|
+
* Predicate to check if a potential is an immutable structure or not.
|
2936
|
+
* Override through `shouldComponentUpdate.withDefaults` to support different cursor
|
2937
|
+
* implementations.
|
2938
|
+
*
|
2939
|
+
* @param {maybeImmutable} value to check if it is immutable.
|
2940
|
+
*
|
2941
|
+
* @module shouldComponentUpdate.isImmutable
|
2942
|
+
* @returns {Boolean}
|
2943
|
+
* @api public
|
2944
|
+
*/
|
2945
|
+
var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
|
2946
|
+
function isImmutable(maybeImmutable) {
|
2947
|
+
return !!(maybeImmutable && maybeImmutable[IS_ITERABLE_SENTINEL]);
|
2948
|
+
}
|
2949
|
+
|
2950
|
+
/**
|
2951
|
+
* Transforming function to take in cursor and return a non-cursor.
|
2952
|
+
* Override through `shouldComponentUpdate.withDefaults` to support different cursor
|
2953
|
+
* implementations.
|
2954
|
+
*
|
2955
|
+
* @param {cursor} cursor to transform
|
2956
|
+
*
|
2957
|
+
* @module shouldComponentUpdate.unCursor
|
2958
|
+
* @returns {Object|Number|String|Boolean}
|
2959
|
+
* @api public
|
2960
|
+
*/
|
2961
|
+
function unCursor(cursor) {
|
2962
|
+
return !isCursor(cursor) ? cursor : cursor.deref();
|
2963
|
+
}
|
2964
|
+
|
2965
|
+
/**
|
2966
|
+
* Predicate to check if `potential` is Immutable cursor or not (defaults to duck testing
|
2967
|
+
* Immutable.js cursors). Can override through `.withDefaults()`.
|
2968
|
+
*
|
2969
|
+
* @param {potential} potential to check if is cursor
|
2970
|
+
*
|
2971
|
+
* @module shouldComponentUpdate.isCursor
|
2972
|
+
* @returns {Boolean}
|
2973
|
+
* @api public
|
2974
|
+
*/
|
2975
|
+
function isCursor (potential) {
|
2976
|
+
return !!(potential && typeof potential.deref === 'function');
|
2977
|
+
}
|
2978
|
+
|
2979
|
+
function not (fn) {
|
2980
|
+
return function () {
|
2981
|
+
return !fn.apply(fn, arguments);
|
2982
|
+
};
|
2983
|
+
}
|
2984
|
+
|
2985
|
+
/**
|
2986
|
+
* Predicate to check if a property on props should be ignored or not.
|
2987
|
+
* For now this defaults to ignore if property key is `statics`, but that
|
2988
|
+
* is deprecated behaviour, and will be removed by the next major release.
|
2989
|
+
*
|
2990
|
+
* Override through `shouldComponentUpdate.withDefaults`.
|
2991
|
+
*
|
2992
|
+
* @param {Object} value
|
2993
|
+
* @param {String} key
|
2994
|
+
*
|
2995
|
+
* @module shouldComponentUpdate.isIgnorable
|
2996
|
+
* @returns {Boolean}
|
2997
|
+
* @api public
|
2998
|
+
*/
|
2999
|
+
function isIgnorable (_, key) {
|
3000
|
+
return false;
|
3001
|
+
}
|
3002
|
+
|
3003
|
+
function isChildren (_, key) {
|
3004
|
+
return key === 'children';
|
3005
|
+
}
|
3006
|
+
|
3007
|
+
function or (fn1, fn2) {
|
3008
|
+
return function () {
|
3009
|
+
return fn1.apply(null, arguments) || fn2.apply(null, arguments);
|
3010
|
+
};
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
},{"lodash.isequal":14,"lodash.pick":22}]},{},[2])(2)
|
3014
|
+
});
|