discourse-ember-source 3.5.1.1 → 3.5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ember/version.rb +1 -1
- metadata +2 -740
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/README +0 -18
- data/README.md +0 -39
- data/Rakefile +0 -27
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/discourse-ember-source-3.5.1.0.gem +0 -0
- data/dist/ember-all.debug.map +0 -1
- data/dist/ember-template-compiler.map +0 -1
- data/dist/ember-testing.map +0 -1
- data/dist/ember-tests.map +0 -1
- data/dist/ember-tests.prod.map +0 -1
- data/dist/ember.debug.map +0 -1
- data/dist/ember.min.map +0 -1
- data/dist/ember.prod.map +0 -1
- data/dist/es/@ember/application/globals-resolver.js +0 -425
- data/dist/es/@ember/application/index.js +0 -3
- data/dist/es/@ember/application/instance.js +0 -513
- data/dist/es/@ember/application/lib/application.js +0 -1139
- data/dist/es/@ember/application/lib/lazy_load.js +0 -69
- data/dist/es/@ember/application/lib/validate-type.js +0 -24
- data/dist/es/@ember/application/tests/application_instance_test.js +0 -230
- data/dist/es/@ember/application/tests/application_test.js +0 -470
- data/dist/es/@ember/application/tests/bootstrap-test.js +0 -28
- data/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js +0 -32
- data/dist/es/@ember/application/tests/dependency_injection/default_resolver_test.js +0 -363
- data/dist/es/@ember/application/tests/dependency_injection/normalization_test.js +0 -70
- data/dist/es/@ember/application/tests/dependency_injection/to_string_test.js +0 -71
- data/dist/es/@ember/application/tests/dependency_injection_test.js +0 -93
- data/dist/es/@ember/application/tests/initializers_test.js +0 -391
- data/dist/es/@ember/application/tests/instance_initializers_test.js +0 -395
- data/dist/es/@ember/application/tests/lazy_load_test.js +0 -79
- data/dist/es/@ember/application/tests/logging_test.js +0 -179
- data/dist/es/@ember/application/tests/readiness_test.js +0 -138
- data/dist/es/@ember/application/tests/reset_test.js +0 -185
- data/dist/es/@ember/application/tests/visit_test.js +0 -783
- data/dist/es/@ember/canary-features/index.js +0 -76
- data/dist/es/@ember/controller/index.js +0 -50
- data/dist/es/@ember/controller/lib/controller_mixin.js +0 -42
- data/dist/es/@ember/controller/tests/controller_test.js +0 -209
- data/dist/es/@ember/debug/index.js +0 -264
- data/dist/es/@ember/debug/lib/deprecate.js +0 -198
- data/dist/es/@ember/debug/lib/handlers.js +0 -22
- data/dist/es/@ember/debug/lib/testing.js +0 -7
- data/dist/es/@ember/debug/lib/warn.js +0 -107
- data/dist/es/@ember/debug/tests/handlers-test.js +0 -144
- data/dist/es/@ember/debug/tests/main_test.js +0 -444
- data/dist/es/@ember/deprecated-features/index.js +0 -21
- data/dist/es/@ember/engine/index.js +0 -532
- data/dist/es/@ember/engine/instance.js +0 -228
- data/dist/es/@ember/engine/lib/engine-parent.js +0 -32
- data/dist/es/@ember/engine/tests/engine_initializers_test.js +0 -366
- data/dist/es/@ember/engine/tests/engine_instance_initializers_test.js +0 -409
- data/dist/es/@ember/engine/tests/engine_instance_test.js +0 -115
- data/dist/es/@ember/engine/tests/engine_parent_test.js +0 -20
- data/dist/es/@ember/engine/tests/engine_test.js +0 -121
- data/dist/es/@ember/error/index.js +0 -36
- data/dist/es/@ember/error/tests/index_test.js +0 -19
- data/dist/es/@ember/instrumentation/index.js +0 -240
- data/dist/es/@ember/instrumentation/tests/index-test.js +0 -214
- data/dist/es/@ember/map/index.js +0 -218
- data/dist/es/@ember/map/lib/ordered-set.js +0 -186
- data/dist/es/@ember/map/lib/utils.js +0 -29
- data/dist/es/@ember/map/tests/map_test.js +0 -578
- data/dist/es/@ember/map/with-default.js +0 -87
- data/dist/es/@ember/object/computed.js +0 -35
- data/dist/es/@ember/object/lib/computed/computed_macros.js +0 -742
- data/dist/es/@ember/object/lib/computed/reduce_computed_macros.js +0 -894
- data/dist/es/@ember/object/tests/computed/computed_macros_test.js +0 -533
- data/dist/es/@ember/object/tests/computed/reduce_computed_macros_test.js +0 -2243
- data/dist/es/@ember/polyfills/index.js +0 -3
- data/dist/es/@ember/polyfills/lib/assign.js +0 -43
- data/dist/es/@ember/polyfills/lib/merge.js +0 -35
- data/dist/es/@ember/polyfills/tests/assign_test.js +0 -64
- data/dist/es/@ember/runloop/index.js +0 -749
- data/dist/es/@ember/runloop/tests/debounce_test.js +0 -87
- data/dist/es/@ember/runloop/tests/later_test.js +0 -264
- data/dist/es/@ember/runloop/tests/next_test.js +0 -56
- data/dist/es/@ember/runloop/tests/once_test.js +0 -62
- data/dist/es/@ember/runloop/tests/onerror_test.js +0 -59
- data/dist/es/@ember/runloop/tests/run_bind_test.js +0 -59
- data/dist/es/@ember/runloop/tests/run_test.js +0 -28
- data/dist/es/@ember/runloop/tests/schedule_test.js +0 -86
- data/dist/es/@ember/runloop/tests/sync_test.js +0 -32
- data/dist/es/@ember/runloop/tests/unwind_test.js +0 -54
- data/dist/es/@ember/service/index.js +0 -57
- data/dist/es/@ember/string/index.js +0 -362
- data/dist/es/@ember/string/lib/string_registry.js +0 -13
- data/dist/es/@ember/string/tests/camelize_test.js +0 -53
- data/dist/es/@ember/string/tests/capitalize_test.js +0 -58
- data/dist/es/@ember/string/tests/classify_test.js +0 -79
- data/dist/es/@ember/string/tests/dasherize_test.js +0 -57
- data/dist/es/@ember/string/tests/decamelize_test.js +0 -51
- data/dist/es/@ember/string/tests/loc_test.js +0 -76
- data/dist/es/@ember/string/tests/underscore_test.js +0 -51
- data/dist/es/@ember/string/tests/w_test.js +0 -39
- data/dist/es/@glimmer/compiler.js +0 -1226
- data/dist/es/@glimmer/encoder.js +0 -39
- data/dist/es/@glimmer/low-level.js +0 -82
- data/dist/es/@glimmer/node.js +0 -112
- data/dist/es/@glimmer/opcode-compiler.js +0 -1999
- data/dist/es/@glimmer/program.js +0 -405
- data/dist/es/@glimmer/reference.js +0 -478
- data/dist/es/@glimmer/runtime.js +0 -4086
- data/dist/es/@glimmer/syntax.js +0 -1424
- data/dist/es/@glimmer/util.js +0 -189
- data/dist/es/@glimmer/vm.js +0 -27
- data/dist/es/@glimmer/wire-format.js +0 -56
- data/dist/es/backburner.js +0 -936
- data/dist/es/container/index.js +0 -8
- data/dist/es/container/lib/container.js +0 -437
- data/dist/es/container/lib/registry.js +0 -646
- data/dist/es/container/tests/container_test.js +0 -872
- data/dist/es/container/tests/owner_test.js +0 -20
- data/dist/es/container/tests/registry_test.js +0 -943
- data/dist/es/dag-map.js +0 -209
- data/dist/es/ember-browser-environment/index.js +0 -8
- data/dist/es/ember-browser-environment/lib/has-dom.js +0 -19
- data/dist/es/ember-console/index.js +0 -177
- data/dist/es/ember-environment/index.js +0 -3
- data/dist/es/ember-environment/lib/context.js +0 -20
- data/dist/es/ember-environment/lib/env.js +0 -185
- data/dist/es/ember-environment/lib/global.js +0 -14
- data/dist/es/ember-error-handling/index.js +0 -22
- data/dist/es/ember-extension-support/index.js +0 -2
- data/dist/es/ember-extension-support/lib/container_debug_adapter.js +0 -99
- data/dist/es/ember-extension-support/lib/data_adapter.js +0 -493
- data/dist/es/ember-extension-support/tests/container_debug_adapter_test.js +0 -73
- data/dist/es/ember-extension-support/tests/data_adapter_test.js +0 -301
- data/dist/es/ember-glimmer/index.js +0 -286
- data/dist/es/ember-glimmer/lib/compile-time-lookup.js +0 -37
- data/dist/es/ember-glimmer/lib/component-managers/abstract.js +0 -49
- data/dist/es/ember-glimmer/lib/component-managers/curly.js +0 -395
- data/dist/es/ember-glimmer/lib/component-managers/custom.js +0 -145
- data/dist/es/ember-glimmer/lib/component-managers/definition-state.js +0 -1
- data/dist/es/ember-glimmer/lib/component-managers/mount.js +0 -103
- data/dist/es/ember-glimmer/lib/component-managers/outlet.js +0 -114
- data/dist/es/ember-glimmer/lib/component-managers/render.js +0 -112
- data/dist/es/ember-glimmer/lib/component-managers/root.js +0 -74
- data/dist/es/ember-glimmer/lib/component-managers/template-only.js +0 -46
- data/dist/es/ember-glimmer/lib/component.js +0 -633
- data/dist/es/ember-glimmer/lib/components/checkbox.js +0 -57
- data/dist/es/ember-glimmer/lib/components/link-to.js +0 -777
- data/dist/es/ember-glimmer/lib/components/text_area.js +0 -236
- data/dist/es/ember-glimmer/lib/components/text_field.js +0 -145
- data/dist/es/ember-glimmer/lib/dom.js +0 -3
- data/dist/es/ember-glimmer/lib/environment.js +0 -102
- data/dist/es/ember-glimmer/lib/helper.js +0 -128
- data/dist/es/ember-glimmer/lib/helpers/-class.js +0 -23
- data/dist/es/ember-glimmer/lib/helpers/-html-safe.js +0 -9
- data/dist/es/ember-glimmer/lib/helpers/-input-type.js +0 -11
- data/dist/es/ember-glimmer/lib/helpers/-normalize-class.js +0 -22
- data/dist/es/ember-glimmer/lib/helpers/action.js +0 -360
- data/dist/es/ember-glimmer/lib/helpers/component.js +0 -135
- data/dist/es/ember-glimmer/lib/helpers/concat.js +0 -38
- data/dist/es/ember-glimmer/lib/helpers/each-in.js +0 -126
- data/dist/es/ember-glimmer/lib/helpers/get.js +0 -100
- data/dist/es/ember-glimmer/lib/helpers/hash.js +0 -44
- data/dist/es/ember-glimmer/lib/helpers/if-unless.js +0 -142
- data/dist/es/ember-glimmer/lib/helpers/loc.js +0 -40
- data/dist/es/ember-glimmer/lib/helpers/log.js +0 -25
- data/dist/es/ember-glimmer/lib/helpers/mut.js +0 -107
- data/dist/es/ember-glimmer/lib/helpers/query-param.js +0 -31
- data/dist/es/ember-glimmer/lib/helpers/readonly.js +0 -104
- data/dist/es/ember-glimmer/lib/helpers/unbound.js +0 -36
- data/dist/es/ember-glimmer/lib/modifiers/action.js +0 -185
- data/dist/es/ember-glimmer/lib/protocol-for-url.js +0 -48
- data/dist/es/ember-glimmer/lib/renderer.js +0 -371
- data/dist/es/ember-glimmer/lib/resolver.js +0 -290
- data/dist/es/ember-glimmer/lib/setup-registry.js +0 -77
- data/dist/es/ember-glimmer/lib/syntax.js +0 -73
- data/dist/es/ember-glimmer/lib/syntax/-text-area.js +0 -8
- data/dist/es/ember-glimmer/lib/syntax/input.js +0 -173
- data/dist/es/ember-glimmer/lib/syntax/let.js +0 -50
- data/dist/es/ember-glimmer/lib/syntax/mount.js +0 -101
- data/dist/es/ember-glimmer/lib/syntax/outlet.js +0 -120
- data/dist/es/ember-glimmer/lib/syntax/render.js +0 -140
- data/dist/es/ember-glimmer/lib/syntax/utils.js +0 -6
- data/dist/es/ember-glimmer/lib/template-compiler.js +0 -7
- data/dist/es/ember-glimmer/lib/template.js +0 -16
- data/dist/es/ember-glimmer/lib/template_registry.js +0 -18
- data/dist/es/ember-glimmer/lib/templates/component.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/empty.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/link-to.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/outlet.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/root.js +0 -2
- data/dist/es/ember-glimmer/lib/utils/bindings.js +0 -180
- data/dist/es/ember-glimmer/lib/utils/curly-component-state-bucket.js +0 -36
- data/dist/es/ember-glimmer/lib/utils/custom-component-manager.js +0 -20
- data/dist/es/ember-glimmer/lib/utils/debug-stack.js +0 -57
- data/dist/es/ember-glimmer/lib/utils/iterable.js +0 -358
- data/dist/es/ember-glimmer/lib/utils/outlet.js +0 -89
- data/dist/es/ember-glimmer/lib/utils/process-args.js +0 -40
- data/dist/es/ember-glimmer/lib/utils/references.js +0 -325
- data/dist/es/ember-glimmer/lib/utils/serialization-first-node-helpers.js +0 -1
- data/dist/es/ember-glimmer/lib/utils/string.js +0 -98
- data/dist/es/ember-glimmer/lib/utils/to-bool.js +0 -9
- data/dist/es/ember-glimmer/lib/views/outlet.js +0 -71
- data/dist/es/ember-glimmer/tests/integration/application/actions-test.js +0 -107
- data/dist/es/ember-glimmer/tests/integration/application/engine-test.js +0 -912
- data/dist/es/ember-glimmer/tests/integration/application/rendering-test.js +0 -530
- data/dist/es/ember-glimmer/tests/integration/components/angle-bracket-invocation-test.js +0 -852
- data/dist/es/ember-glimmer/tests/integration/components/append-test.js +0 -742
- data/dist/es/ember-glimmer/tests/integration/components/attribute-bindings-test.js +0 -999
- data/dist/es/ember-glimmer/tests/integration/components/attrs-lookup-test.js +0 -268
- data/dist/es/ember-glimmer/tests/integration/components/class-bindings-test.js +0 -849
- data/dist/es/ember-glimmer/tests/integration/components/contextual-components-test.js +0 -1493
- data/dist/es/ember-glimmer/tests/integration/components/curly-components-test.js +0 -3705
- data/dist/es/ember-glimmer/tests/integration/components/destroy-test.js +0 -33
- data/dist/es/ember-glimmer/tests/integration/components/dynamic-components-test.js +0 -896
- data/dist/es/ember-glimmer/tests/integration/components/error-handling-test.js +0 -164
- data/dist/es/ember-glimmer/tests/integration/components/fragment-components-test.js +0 -285
- data/dist/es/ember-glimmer/tests/integration/components/instrumentation-compile-test.js +0 -108
- data/dist/es/ember-glimmer/tests/integration/components/instrumentation-test.js +0 -157
- data/dist/es/ember-glimmer/tests/integration/components/life-cycle-test.js +0 -1653
- data/dist/es/ember-glimmer/tests/integration/components/link-to-test.js +0 -218
- data/dist/es/ember-glimmer/tests/integration/components/local-lookup-test.js +0 -414
- data/dist/es/ember-glimmer/tests/integration/components/namespaced-lookup-test.js +0 -185
- data/dist/es/ember-glimmer/tests/integration/components/render-to-element-test.js +0 -0
- data/dist/es/ember-glimmer/tests/integration/components/target-action-test.js +0 -779
- data/dist/es/ember-glimmer/tests/integration/components/template-only-components-test.js +0 -225
- data/dist/es/ember-glimmer/tests/integration/components/to-string-test.js +0 -27
- data/dist/es/ember-glimmer/tests/integration/components/utils-test.js +0 -401
- data/dist/es/ember-glimmer/tests/integration/components/web-component-fallback-test.js +0 -35
- data/dist/es/ember-glimmer/tests/integration/components/will-destroy-element-hook-test.js +0 -40
- data/dist/es/ember-glimmer/tests/integration/content-test.js +0 -1759
- data/dist/es/ember-glimmer/tests/integration/custom-component-manager-test.js +0 -508
- data/dist/es/ember-glimmer/tests/integration/event-dispatcher-test.js +0 -607
- data/dist/es/ember-glimmer/tests/integration/helpers/-class-test.js +0 -76
- data/dist/es/ember-glimmer/tests/integration/helpers/closure-action-test.js +0 -1240
- data/dist/es/ember-glimmer/tests/integration/helpers/concat-test.js +0 -106
- data/dist/es/ember-glimmer/tests/integration/helpers/custom-helper-test.js +0 -672
- data/dist/es/ember-glimmer/tests/integration/helpers/element-action-test.js +0 -1595
- data/dist/es/ember-glimmer/tests/integration/helpers/get-test.js +0 -618
- data/dist/es/ember-glimmer/tests/integration/helpers/hash-test.js +0 -188
- data/dist/es/ember-glimmer/tests/integration/helpers/if-unless-test.js +0 -149
- data/dist/es/ember-glimmer/tests/integration/helpers/input-test.js +0 -827
- data/dist/es/ember-glimmer/tests/integration/helpers/loc-test.js +0 -103
- data/dist/es/ember-glimmer/tests/integration/helpers/log-test.js +0 -61
- data/dist/es/ember-glimmer/tests/integration/helpers/mut-test.js +0 -580
- data/dist/es/ember-glimmer/tests/integration/helpers/partial-test.js +0 -386
- data/dist/es/ember-glimmer/tests/integration/helpers/readonly-test.js +0 -293
- data/dist/es/ember-glimmer/tests/integration/helpers/render-test.js +0 -522
- data/dist/es/ember-glimmer/tests/integration/helpers/text-area-test.js +0 -166
- data/dist/es/ember-glimmer/tests/integration/helpers/unbound-test.js +0 -650
- data/dist/es/ember-glimmer/tests/integration/helpers/yield-test.js +0 -275
- data/dist/es/ember-glimmer/tests/integration/input-test.js +0 -242
- data/dist/es/ember-glimmer/tests/integration/mount-test.js +0 -424
- data/dist/es/ember-glimmer/tests/integration/outlet-test.js +0 -318
- data/dist/es/ember-glimmer/tests/integration/refinements-test.js +0 -74
- data/dist/es/ember-glimmer/tests/integration/render-settled-test.js +0 -72
- data/dist/es/ember-glimmer/tests/integration/svg-test.js +0 -158
- data/dist/es/ember-glimmer/tests/integration/syntax/each-in-test.js +0 -697
- data/dist/es/ember-glimmer/tests/integration/syntax/each-test.js +0 -1251
- data/dist/es/ember-glimmer/tests/integration/syntax/experimental-syntax-test.js +0 -42
- data/dist/es/ember-glimmer/tests/integration/syntax/if-unless-test.js +0 -108
- data/dist/es/ember-glimmer/tests/integration/syntax/in-element-test.js +0 -119
- data/dist/es/ember-glimmer/tests/integration/syntax/let-test.js +0 -390
- data/dist/es/ember-glimmer/tests/integration/syntax/with-dynamic-var-test.js +0 -36
- data/dist/es/ember-glimmer/tests/integration/syntax/with-test.js +0 -422
- data/dist/es/ember-glimmer/tests/unit/outlet-test.js +0 -48
- data/dist/es/ember-glimmer/tests/unit/runtime-resolver-cache-test.js +0 -263
- data/dist/es/ember-glimmer/tests/unit/template-factory-test.js +0 -67
- data/dist/es/ember-glimmer/tests/unit/utils/debug-stack-test.js +0 -38
- data/dist/es/ember-glimmer/tests/utils/abstract-test-case.js +0 -1
- data/dist/es/ember-glimmer/tests/utils/helpers.js +0 -15
- data/dist/es/ember-glimmer/tests/utils/shared-conditional-tests.js +0 -965
- data/dist/es/ember-glimmer/tests/utils/string-test.js +0 -47
- data/dist/es/ember-glimmer/tests/utils/test-case.js +0 -6
- data/dist/es/ember-glimmer/tests/utils/test-helpers.js +0 -1
- data/dist/es/ember-meta/index.js +0 -1
- data/dist/es/ember-meta/lib/meta.js +0 -623
- data/dist/es/ember-meta/tests/meta_test.js +0 -169
- data/dist/es/ember-metal/index.js +0 -33
- data/dist/es/ember-metal/lib/alias.js +0 -80
- data/dist/es/ember-metal/lib/array.js +0 -55
- data/dist/es/ember-metal/lib/array_events.js +0 -65
- data/dist/es/ember-metal/lib/chains.js +0 -315
- data/dist/es/ember-metal/lib/change_event.js +0 -4
- data/dist/es/ember-metal/lib/computed.js +0 -526
- data/dist/es/ember-metal/lib/computed_cache.js +0 -58
- data/dist/es/ember-metal/lib/dependent_keys.js +0 -34
- data/dist/es/ember-metal/lib/deprecate_property.js +0 -34
- data/dist/es/ember-metal/lib/descriptor.js +0 -28
- data/dist/es/ember-metal/lib/each_proxy.js +0 -106
- data/dist/es/ember-metal/lib/each_proxy_events.js +0 -13
- data/dist/es/ember-metal/lib/events.js +0 -174
- data/dist/es/ember-metal/lib/expand_properties.js +0 -64
- data/dist/es/ember-metal/lib/get_properties.js +0 -45
- data/dist/es/ember-metal/lib/injected_property.js +0 -53
- data/dist/es/ember-metal/lib/is_blank.js +0 -34
- data/dist/es/ember-metal/lib/is_empty.js +0 -63
- data/dist/es/ember-metal/lib/is_none.js +0 -27
- data/dist/es/ember-metal/lib/is_present.js +0 -38
- data/dist/es/ember-metal/lib/libraries.js +0 -80
- data/dist/es/ember-metal/lib/mixin.js +0 -646
- data/dist/es/ember-metal/lib/namespace_search.js +0 -166
- data/dist/es/ember-metal/lib/observer.js +0 -34
- data/dist/es/ember-metal/lib/observer_set.js +0 -48
- data/dist/es/ember-metal/lib/path_cache.js +0 -5
- data/dist/es/ember-metal/lib/properties.js +0 -192
- data/dist/es/ember-metal/lib/property_events.js +0 -198
- data/dist/es/ember-metal/lib/property_get.js +0 -160
- data/dist/es/ember-metal/lib/property_set.js +0 -157
- data/dist/es/ember-metal/lib/set_properties.js +0 -43
- data/dist/es/ember-metal/lib/tags.js +0 -81
- data/dist/es/ember-metal/lib/tracked.js +0 -201
- data/dist/es/ember-metal/lib/transaction.js +0 -137
- data/dist/es/ember-metal/lib/watch_key.js +0 -113
- data/dist/es/ember-metal/lib/watch_path.js +0 -24
- data/dist/es/ember-metal/lib/watching.js +0 -54
- data/dist/es/ember-metal/tests/accessors/get_path_test.js +0 -82
- data/dist/es/ember-metal/tests/accessors/get_properties_test.js +0 -36
- data/dist/es/ember-metal/tests/accessors/get_test.js +0 -335
- data/dist/es/ember-metal/tests/accessors/mandatory_setters_test.js +0 -470
- data/dist/es/ember-metal/tests/accessors/set_path_test.js +0 -97
- data/dist/es/ember-metal/tests/accessors/set_test.js +0 -128
- data/dist/es/ember-metal/tests/alias_test.js +0 -167
- data/dist/es/ember-metal/tests/chains_test.js +0 -210
- data/dist/es/ember-metal/tests/computed_test.js +0 -1040
- data/dist/es/ember-metal/tests/descriptor_test.js +0 -368
- data/dist/es/ember-metal/tests/events_test.js +0 -210
- data/dist/es/ember-metal/tests/expand_properties_test.js +0 -119
- data/dist/es/ember-metal/tests/injected_property_test.js +0 -76
- data/dist/es/ember-metal/tests/is_blank_test.js +0 -29
- data/dist/es/ember-metal/tests/is_empty_test.js +0 -55
- data/dist/es/ember-metal/tests/is_none_test.js +0 -23
- data/dist/es/ember-metal/tests/is_present_test.js +0 -30
- data/dist/es/ember-metal/tests/libraries_test.js +0 -99
- data/dist/es/ember-metal/tests/main_test.js +0 -31
- data/dist/es/ember-metal/tests/mixin/alias_method_test.js +0 -91
- data/dist/es/ember-metal/tests/mixin/apply_test.js +0 -40
- data/dist/es/ember-metal/tests/mixin/computed_test.js +0 -166
- data/dist/es/ember-metal/tests/mixin/concatenated_properties_test.js +0 -117
- data/dist/es/ember-metal/tests/mixin/detect_test.js +0 -40
- data/dist/es/ember-metal/tests/mixin/introspection_test.js +0 -75
- data/dist/es/ember-metal/tests/mixin/merged_properties_test.js +0 -200
- data/dist/es/ember-metal/tests/mixin/method_test.js +0 -252
- data/dist/es/ember-metal/tests/mixin/observer_test.js +0 -202
- data/dist/es/ember-metal/tests/mixin/reopen_test.js +0 -53
- data/dist/es/ember-metal/tests/mixin/without_test.js +0 -22
- data/dist/es/ember-metal/tests/namespace_search_test.js +0 -16
- data/dist/es/ember-metal/tests/observer_test.js +0 -961
- data/dist/es/ember-metal/tests/performance_test.js +0 -81
- data/dist/es/ember-metal/tests/properties_test.js +0 -120
- data/dist/es/ember-metal/tests/property_did_change_hook.js +0 -73
- data/dist/es/ember-metal/tests/set_properties_test.js +0 -49
- data/dist/es/ember-metal/tests/tracked/computed_test.js +0 -67
- data/dist/es/ember-metal/tests/tracked/get_test.js +0 -86
- data/dist/es/ember-metal/tests/tracked/set_test.js +0 -44
- data/dist/es/ember-metal/tests/tracked/support.js +0 -37
- data/dist/es/ember-metal/tests/tracked/validation_test.js +0 -233
- data/dist/es/ember-metal/tests/watching/is_watching_test.js +0 -97
- data/dist/es/ember-metal/tests/watching/unwatch_test.js +0 -109
- data/dist/es/ember-metal/tests/watching/watch_test.js +0 -255
- data/dist/es/ember-owner/index.js +0 -66
- data/dist/es/ember-routing/index.js +0 -21
- data/dist/es/ember-routing/lib/ext/controller.js +0 -222
- data/dist/es/ember-routing/lib/location/api.js +0 -118
- data/dist/es/ember-routing/lib/location/auto_location.js +0 -323
- data/dist/es/ember-routing/lib/location/hash_location.js +0 -171
- data/dist/es/ember-routing/lib/location/history_location.js +0 -298
- data/dist/es/ember-routing/lib/location/none_location.js +0 -122
- data/dist/es/ember-routing/lib/location/util.js +0 -114
- data/dist/es/ember-routing/lib/services/router.js +0 -243
- data/dist/es/ember-routing/lib/services/routing.js +0 -101
- data/dist/es/ember-routing/lib/system/cache.js +0 -40
- data/dist/es/ember-routing/lib/system/controller_for.js +0 -14
- data/dist/es/ember-routing/lib/system/dsl.js +0 -208
- data/dist/es/ember-routing/lib/system/generate_controller.js +0 -54
- data/dist/es/ember-routing/lib/system/query_params.js +0 -6
- data/dist/es/ember-routing/lib/system/route.js +0 -2476
- data/dist/es/ember-routing/lib/system/router.js +0 -1607
- data/dist/es/ember-routing/lib/system/router_state.js +0 -26
- data/dist/es/ember-routing/lib/system/transition.js +0 -153
- data/dist/es/ember-routing/lib/utils.js +0 -230
- data/dist/es/ember-routing/tests/ext/controller_test.js +0 -85
- data/dist/es/ember-routing/tests/location/auto_location_test.js +0 -379
- data/dist/es/ember-routing/tests/location/hash_location_test.js +0 -207
- data/dist/es/ember-routing/tests/location/history_location_test.js +0 -322
- data/dist/es/ember-routing/tests/location/none_location_test.js +0 -88
- data/dist/es/ember-routing/tests/location/util_test.js +0 -159
- data/dist/es/ember-routing/tests/system/cache_test.js +0 -54
- data/dist/es/ember-routing/tests/system/controller_for_test.js +0 -75
- data/dist/es/ember-routing/tests/system/dsl_test.js +0 -413
- data/dist/es/ember-routing/tests/system/route_test.js +0 -587
- data/dist/es/ember-routing/tests/system/router_test.js +0 -287
- data/dist/es/ember-routing/tests/utils_test.js +0 -37
- data/dist/es/ember-runtime/.gitignore +0 -1
- data/dist/es/ember-runtime/README +0 -12
- data/dist/es/ember-runtime/index.js +0 -35
- data/dist/es/ember-runtime/lib/compare.js +0 -149
- data/dist/es/ember-runtime/lib/copy.js +0 -106
- data/dist/es/ember-runtime/lib/ext/function.js +0 -154
- data/dist/es/ember-runtime/lib/ext/rsvp.js +0 -59
- data/dist/es/ember-runtime/lib/is-equal.js +0 -60
- data/dist/es/ember-runtime/lib/mixins/-proxy.js +0 -109
- data/dist/es/ember-runtime/lib/mixins/action_handler.js +0 -222
- data/dist/es/ember-runtime/lib/mixins/array.js +0 -1661
- data/dist/es/ember-runtime/lib/mixins/comparable.js +0 -38
- data/dist/es/ember-runtime/lib/mixins/container_proxy.js +0 -154
- data/dist/es/ember-runtime/lib/mixins/copyable.js +0 -34
- data/dist/es/ember-runtime/lib/mixins/enumerable.js +0 -16
- data/dist/es/ember-runtime/lib/mixins/evented.js +0 -149
- data/dist/es/ember-runtime/lib/mixins/mutable_enumerable.js +0 -18
- data/dist/es/ember-runtime/lib/mixins/observable.js +0 -482
- data/dist/es/ember-runtime/lib/mixins/promise_proxy.js +0 -224
- data/dist/es/ember-runtime/lib/mixins/registry_proxy.js +0 -265
- data/dist/es/ember-runtime/lib/mixins/target_action_support.js +0 -172
- data/dist/es/ember-runtime/lib/system/array_proxy.js +0 -298
- data/dist/es/ember-runtime/lib/system/core_object.js +0 -1037
- data/dist/es/ember-runtime/lib/system/namespace.js +0 -69
- data/dist/es/ember-runtime/lib/system/object.js +0 -73
- data/dist/es/ember-runtime/lib/system/object_proxy.js +0 -81
- data/dist/es/ember-runtime/lib/type-of.js +0 -107
- data/dist/es/ember-runtime/tests/array/any-test.js +0 -55
- data/dist/es/ember-runtime/tests/array/compact-test.js +0 -12
- data/dist/es/ember-runtime/tests/array/every-test.js +0 -82
- data/dist/es/ember-runtime/tests/array/filter-test.js +0 -123
- data/dist/es/ember-runtime/tests/array/find-test.js +0 -86
- data/dist/es/ember-runtime/tests/array/firstObject-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/forEach-test.js +0 -68
- data/dist/es/ember-runtime/tests/array/includes-test.js +0 -46
- data/dist/es/ember-runtime/tests/array/indexOf-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/invoke-test.js +0 -60
- data/dist/es/ember-runtime/tests/array/isAny-test.js +0 -53
- data/dist/es/ember-runtime/tests/array/lastIndexOf-test.js +0 -78
- data/dist/es/ember-runtime/tests/array/lastObject-test.js +0 -31
- data/dist/es/ember-runtime/tests/array/map-test.js +0 -68
- data/dist/es/ember-runtime/tests/array/mapBy-test.js +0 -16
- data/dist/es/ember-runtime/tests/array/objectAt-test.js +0 -34
- data/dist/es/ember-runtime/tests/array/reduce-test.js +0 -24
- data/dist/es/ember-runtime/tests/array/reject-test.js +0 -134
- data/dist/es/ember-runtime/tests/array/sortBy-test.js +0 -23
- data/dist/es/ember-runtime/tests/array/toArray-test.js +0 -11
- data/dist/es/ember-runtime/tests/array/uniq-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/uniqBy-test.js +0 -33
- data/dist/es/ember-runtime/tests/array/without-test.js +0 -39
- data/dist/es/ember-runtime/tests/copyable-array/copy-test.js +0 -12
- data/dist/es/ember-runtime/tests/core/compare_test.js +0 -89
- data/dist/es/ember-runtime/tests/core/copy_test.js +0 -47
- data/dist/es/ember-runtime/tests/core/isEqual_test.js +0 -65
- data/dist/es/ember-runtime/tests/core/is_array_test.js +0 -59
- data/dist/es/ember-runtime/tests/core/is_empty_test.js +0 -15
- data/dist/es/ember-runtime/tests/core/type_of_test.js +0 -54
- data/dist/es/ember-runtime/tests/ext/function_test.js +0 -121
- data/dist/es/ember-runtime/tests/ext/rsvp_test.js +0 -269
- data/dist/es/ember-runtime/tests/helpers/array.js +0 -336
- data/dist/es/ember-runtime/tests/inject_test.js +0 -51
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js +0 -63
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js +0 -892
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +0 -142
- data/dist/es/ember-runtime/tests/legacy_1x/system/object/base_test.js +0 -98
- data/dist/es/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js +0 -131
- data/dist/es/ember-runtime/tests/mixins/array_test.js +0 -400
- data/dist/es/ember-runtime/tests/mixins/comparable_test.js +0 -37
- data/dist/es/ember-runtime/tests/mixins/container_proxy_test.js +0 -48
- data/dist/es/ember-runtime/tests/mixins/enumerable_test.js +0 -17
- data/dist/es/ember-runtime/tests/mixins/evented_test.js +0 -23
- data/dist/es/ember-runtime/tests/mixins/mutable_enumerable_test.js +0 -17
- data/dist/es/ember-runtime/tests/mixins/observable_test.js +0 -137
- data/dist/es/ember-runtime/tests/mixins/promise_proxy_test.js +0 -593
- data/dist/es/ember-runtime/tests/mixins/target_action_support_test.js +0 -237
- data/dist/es/ember-runtime/tests/mutable-array/addObject-test.js +0 -76
- data/dist/es/ember-runtime/tests/mutable-array/clear-test.js +0 -64
- data/dist/es/ember-runtime/tests/mutable-array/insertAt-test.js +0 -216
- data/dist/es/ember-runtime/tests/mutable-array/popObject-test.js +0 -91
- data/dist/es/ember-runtime/tests/mutable-array/pushObject-test.js +0 -98
- data/dist/es/ember-runtime/tests/mutable-array/pushObjects-test.js +0 -12
- data/dist/es/ember-runtime/tests/mutable-array/removeAt-test.js +0 -187
- data/dist/es/ember-runtime/tests/mutable-array/removeObject-test.js +0 -77
- data/dist/es/ember-runtime/tests/mutable-array/removeObjects-test.js +0 -202
- data/dist/es/ember-runtime/tests/mutable-array/replace-test.js +0 -221
- data/dist/es/ember-runtime/tests/mutable-array/reverseObjects-test.js +0 -35
- data/dist/es/ember-runtime/tests/mutable-array/setObjects-test.js +0 -63
- data/dist/es/ember-runtime/tests/mutable-array/shiftObject-test.js +0 -105
- data/dist/es/ember-runtime/tests/mutable-array/unshiftObject-test.js +0 -99
- data/dist/es/ember-runtime/tests/mutable-array/unshiftObjects-test.js +0 -102
- data/dist/es/ember-runtime/tests/system/array_proxy/arranged_content_test.js +0 -275
- data/dist/es/ember-runtime/tests/system/array_proxy/array_observer_test.js +0 -51
- data/dist/es/ember-runtime/tests/system/array_proxy/content_change_test.js +0 -85
- data/dist/es/ember-runtime/tests/system/array_proxy/length_test.js +0 -201
- data/dist/es/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js +0 -157
- data/dist/es/ember-runtime/tests/system/core_object_test.js +0 -114
- data/dist/es/ember-runtime/tests/system/namespace/base_test.js +0 -175
- data/dist/es/ember-runtime/tests/system/native_array/a_test.js +0 -16
- data/dist/es/ember-runtime/tests/system/native_array/copyable_suite_test.js +0 -19
- data/dist/es/ember-runtime/tests/system/native_array/replace_test.js +0 -17
- data/dist/es/ember-runtime/tests/system/object/computed_test.js +0 -352
- data/dist/es/ember-runtime/tests/system/object/create_test.js +0 -135
- data/dist/es/ember-runtime/tests/system/object/destroy_test.js +0 -146
- data/dist/es/ember-runtime/tests/system/object/detectInstance_test.js +0 -38
- data/dist/es/ember-runtime/tests/system/object/detect_test.js +0 -33
- data/dist/es/ember-runtime/tests/system/object/es-compatibility-test.js +0 -469
- data/dist/es/ember-runtime/tests/system/object/events_test.js +0 -156
- data/dist/es/ember-runtime/tests/system/object/extend_test.js +0 -153
- data/dist/es/ember-runtime/tests/system/object/observer_test.js +0 -216
- data/dist/es/ember-runtime/tests/system/object/reopenClass_test.js +0 -36
- data/dist/es/ember-runtime/tests/system/object/reopen_test.js +0 -48
- data/dist/es/ember-runtime/tests/system/object/strict-mode-test.js +0 -31
- data/dist/es/ember-runtime/tests/system/object/toString_test.js +0 -125
- data/dist/es/ember-runtime/tests/system/object_proxy_test.js +0 -314
- data/dist/es/ember-template-compiler/index.js +0 -26
- data/dist/es/ember-template-compiler/lib/compat.js +0 -16
- data/dist/es/ember-template-compiler/lib/plugins/assert-if-helper-without-arguments.js +0 -38
- data/dist/es/ember-template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -20
- data/dist/es/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -26
- data/dist/es/ember-template-compiler/lib/plugins/assert-splattribute-expression.js +0 -27
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-render-model.js +0 -38
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-render.js +0 -41
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-send-action.js +0 -42
- data/dist/es/ember-template-compiler/lib/plugins/index.js +0 -50
- data/dist/es/ember-template-compiler/lib/plugins/transform-action-syntax.js +0 -52
- data/dist/es/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js +0 -10
- data/dist/es/ember-template-compiler/lib/plugins/transform-attrs-into-args.js +0 -62
- data/dist/es/ember-template-compiler/lib/plugins/transform-dot-component-invocation.js +0 -88
- data/dist/es/ember-template-compiler/lib/plugins/transform-each-in-into-each.js +0 -48
- data/dist/es/ember-template-compiler/lib/plugins/transform-has-block-syntax.js +0 -46
- data/dist/es/ember-template-compiler/lib/plugins/transform-in-element.js +0 -83
- data/dist/es/ember-template-compiler/lib/plugins/transform-inline-link-to.js +0 -31
- data/dist/es/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +0 -52
- data/dist/es/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js +0 -48
- data/dist/es/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js +0 -102
- data/dist/es/ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js +0 -34
- data/dist/es/ember-template-compiler/lib/plugins/transform-top-level-components.js +0 -41
- data/dist/es/ember-template-compiler/lib/system/bootstrap.js +0 -44
- data/dist/es/ember-template-compiler/lib/system/calculate-location-display.js +0 -20
- data/dist/es/ember-template-compiler/lib/system/compile-options.js +0 -71
- data/dist/es/ember-template-compiler/lib/system/compile.js +0 -28
- data/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js +0 -13
- data/dist/es/ember-template-compiler/lib/system/initializer.js +0 -22
- data/dist/es/ember-template-compiler/lib/system/precompile.js +0 -18
- data/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js +0 -51
- data/dist/es/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js +0 -17
- data/dist/es/ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js +0 -416
- data/dist/es/ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js +0 -57
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-model-test.js +0 -19
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-test.js +0 -19
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-send-action-test.js +0 -29
- data/dist/es/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js +0 -27
- data/dist/es/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js +0 -15
- data/dist/es/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js +0 -25
- data/dist/es/ember-template-compiler/tests/system/bootstrap-test.js +0 -155
- data/dist/es/ember-template-compiler/tests/system/compile_options_test.js +0 -115
- data/dist/es/ember-template-compiler/tests/system/dasherize-component-name-test.js +0 -19
- data/dist/es/ember-testing/index.js +0 -10
- data/dist/es/ember-testing/lib/adapters/adapter.js +0 -58
- data/dist/es/ember-testing/lib/adapters/qunit.js +0 -47
- data/dist/es/ember-testing/lib/events.js +0 -136
- data/dist/es/ember-testing/lib/ext/application.js +0 -191
- data/dist/es/ember-testing/lib/ext/rsvp.js +0 -19
- data/dist/es/ember-testing/lib/helpers.js +0 -30
- data/dist/es/ember-testing/lib/helpers/-is-form-control.js +0 -16
- data/dist/es/ember-testing/lib/helpers/and_then.js +0 -3
- data/dist/es/ember-testing/lib/helpers/click.js +0 -36
- data/dist/es/ember-testing/lib/helpers/current_path.js +0 -27
- data/dist/es/ember-testing/lib/helpers/current_route_name.js +0 -25
- data/dist/es/ember-testing/lib/helpers/current_url.js +0 -27
- data/dist/es/ember-testing/lib/helpers/fill_in.js +0 -46
- data/dist/es/ember-testing/lib/helpers/find.js +0 -41
- data/dist/es/ember-testing/lib/helpers/find_with_assert.js +0 -34
- data/dist/es/ember-testing/lib/helpers/key_event.js +0 -36
- data/dist/es/ember-testing/lib/helpers/pause_test.js +0 -65
- data/dist/es/ember-testing/lib/helpers/trigger_event.js +0 -62
- data/dist/es/ember-testing/lib/helpers/visit.js +0 -42
- data/dist/es/ember-testing/lib/helpers/wait.js +0 -72
- data/dist/es/ember-testing/lib/initializers.js +0 -17
- data/dist/es/ember-testing/lib/setup_for_testing.js +0 -44
- data/dist/es/ember-testing/lib/support.js +0 -62
- data/dist/es/ember-testing/lib/test.js +0 -70
- data/dist/es/ember-testing/lib/test/adapter.js +0 -33
- data/dist/es/ember-testing/lib/test/helpers.js +0 -125
- data/dist/es/ember-testing/lib/test/on_inject_helpers.js +0 -38
- data/dist/es/ember-testing/lib/test/pending_requests.js +0 -24
- data/dist/es/ember-testing/lib/test/promise.js +0 -79
- data/dist/es/ember-testing/lib/test/run.js +0 -9
- data/dist/es/ember-testing/lib/test/waiters.js +0 -117
- data/dist/es/ember-testing/tests/acceptance_test.js +0 -478
- data/dist/es/ember-testing/tests/adapters/adapter_test.js +0 -31
- data/dist/es/ember-testing/tests/adapters/qunit_test.js +0 -50
- data/dist/es/ember-testing/tests/adapters_test.js +0 -405
- data/dist/es/ember-testing/tests/ext/rsvp_test.js +0 -124
- data/dist/es/ember-testing/tests/helper_registration_test.js +0 -98
- data/dist/es/ember-testing/tests/helpers_test.js +0 -1228
- data/dist/es/ember-testing/tests/integration_test.js +0 -106
- data/dist/es/ember-testing/tests/reexports_test.js +0 -26
- data/dist/es/ember-testing/tests/test/waiters-test.js +0 -145
- data/dist/es/ember-utils/index.js +0 -28
- data/dist/es/ember-utils/lib/cache.js +0 -36
- data/dist/es/ember-utils/lib/dictionary.js +0 -11
- data/dist/es/ember-utils/lib/guid.js +0 -120
- data/dist/es/ember-utils/lib/inspect.js +0 -112
- data/dist/es/ember-utils/lib/intern.js +0 -49
- data/dist/es/ember-utils/lib/invoke.js +0 -53
- data/dist/es/ember-utils/lib/is_proxy.js +0 -14
- data/dist/es/ember-utils/lib/lookup-descriptor.js +0 -11
- data/dist/es/ember-utils/lib/make-array.js +0 -7
- data/dist/es/ember-utils/lib/name.js +0 -9
- data/dist/es/ember-utils/lib/proxy-utils.js +0 -1
- data/dist/es/ember-utils/lib/spec.js +0 -14
- data/dist/es/ember-utils/lib/super.js +0 -83
- data/dist/es/ember-utils/lib/symbol-utils.js +0 -8
- data/dist/es/ember-utils/lib/symbol.js +0 -15
- data/dist/es/ember-utils/lib/to-string.js +0 -35
- data/dist/es/ember-utils/lib/weak_set.js +0 -18
- data/dist/es/ember-utils/tests/cache_test.js +0 -77
- data/dist/es/ember-utils/tests/can_invoke_test.js +0 -46
- data/dist/es/ember-utils/tests/checkHasSuper_test.js +0 -17
- data/dist/es/ember-utils/tests/generate_guid_test.js +0 -13
- data/dist/es/ember-utils/tests/guid_for_test.js +0 -101
- data/dist/es/ember-utils/tests/inspect_test.js +0 -146
- data/dist/es/ember-utils/tests/is_proxy_test.js +0 -18
- data/dist/es/ember-utils/tests/make_array_test.js +0 -41
- data/dist/es/ember-utils/tests/to-string-test.js +0 -32
- data/dist/es/ember-utils/tests/try_invoke_test.js +0 -48
- data/dist/es/ember-views/index.js +0 -28
- data/dist/es/ember-views/lib/compat/attrs.js +0 -3
- data/dist/es/ember-views/lib/compat/fallback-view-registry.js +0 -3
- data/dist/es/ember-views/lib/component_lookup.js +0 -27
- data/dist/es/ember-views/lib/mixins/action_support.js +0 -189
- data/dist/es/ember-views/lib/mixins/child_views_support.js +0 -27
- data/dist/es/ember-views/lib/mixins/class_names_support.js +0 -102
- data/dist/es/ember-views/lib/mixins/text_support.js +0 -333
- data/dist/es/ember-views/lib/mixins/view_state_support.js +0 -19
- data/dist/es/ember-views/lib/mixins/view_support.js +0 -452
- data/dist/es/ember-views/lib/system/action_manager.js +0 -14
- data/dist/es/ember-views/lib/system/event_dispatcher.js +0 -454
- data/dist/es/ember-views/lib/system/jquery.js +0 -29
- data/dist/es/ember-views/lib/system/jquery_event_deprecation.js +0 -61
- data/dist/es/ember-views/lib/system/lookup_partial.js +0 -55
- data/dist/es/ember-views/lib/system/utils.js +0 -201
- data/dist/es/ember-views/lib/utils/lookup-component.js +0 -58
- data/dist/es/ember-views/lib/views/core_view.js +0 -83
- data/dist/es/ember-views/lib/views/states.js +0 -48
- data/dist/es/ember-views/lib/views/states/default.js +0 -17
- data/dist/es/ember-views/lib/views/states/destroying.js +0 -16
- data/dist/es/ember-views/lib/views/states/has_element.js +0 -31
- data/dist/es/ember-views/lib/views/states/in_dom.js +0 -28
- data/dist/es/ember-views/lib/views/states/pre_render.js +0 -3
- data/dist/es/ember/index.js +0 -645
- data/dist/es/ember/tests/application_lifecycle_test.js +0 -188
- data/dist/es/ember/tests/component_context_test.js +0 -255
- data/dist/es/ember/tests/component_registration_test.js +0 -252
- data/dist/es/ember/tests/controller_test.js +0 -44
- data/dist/es/ember/tests/error_handler_test.js +0 -581
- data/dist/es/ember/tests/helpers/helper_registration_test.js +0 -103
- data/dist/es/ember/tests/helpers/link_to_test.js +0 -2103
- data/dist/es/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +0 -342
- data/dist/es/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +0 -694
- data/dist/es/ember/tests/homepage_example_test.js +0 -47
- data/dist/es/ember/tests/integration/multiple-app-test.js +0 -101
- data/dist/es/ember/tests/production_build_test.js +0 -34
- data/dist/es/ember/tests/reexports_test.js +0 -307
- data/dist/es/ember/tests/routing/decoupled_basic_test.js +0 -4506
- data/dist/es/ember/tests/routing/query_params_test.js +0 -1579
- data/dist/es/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +0 -1117
- data/dist/es/ember/tests/routing/query_params_test/overlapping_query_params_test.js +0 -185
- data/dist/es/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js +0 -327
- data/dist/es/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +0 -37
- data/dist/es/ember/tests/routing/query_params_test/shared_state_test.js +0 -84
- data/dist/es/ember/tests/routing/router_map_test.js +0 -46
- data/dist/es/ember/tests/routing/router_service_test/basic_test.js +0 -95
- data/dist/es/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js +0 -149
- data/dist/es/ember/tests/routing/router_service_test/isActive_test.js +0 -113
- data/dist/es/ember/tests/routing/router_service_test/replaceWith_test.js +0 -144
- data/dist/es/ember/tests/routing/router_service_test/transitionTo_test.js +0 -370
- data/dist/es/ember/tests/routing/router_service_test/urlFor_test.js +0 -307
- data/dist/es/ember/tests/routing/substates_test.js +0 -1110
- data/dist/es/ember/tests/routing/toplevel_dom_test.js +0 -37
- data/dist/es/ember/tests/service_injection_test.js +0 -278
- data/dist/es/ember/tests/view_instrumentation_test.js +0 -47
- data/dist/es/ember/version.js +0 -1
- data/dist/es/handlebars.js +0 -1268
- data/dist/es/internal-test-helpers/index.js +0 -31
- data/dist/es/internal-test-helpers/lib/.gitkeep +0 -0
- data/dist/es/internal-test-helpers/lib/apply-mixins.js +0 -37
- data/dist/es/internal-test-helpers/lib/browser-detect.js +0 -4
- data/dist/es/internal-test-helpers/lib/build-owner.js +0 -49
- data/dist/es/internal-test-helpers/lib/confirm-export.js +0 -45
- data/dist/es/internal-test-helpers/lib/ember-dev/assertion.js +0 -87
- data/dist/es/internal-test-helpers/lib/ember-dev/containers.js +0 -34
- data/dist/es/internal-test-helpers/lib/ember-dev/debug.js +0 -47
- data/dist/es/internal-test-helpers/lib/ember-dev/deprecation.js +0 -71
- data/dist/es/internal-test-helpers/lib/ember-dev/index.js +0 -19
- data/dist/es/internal-test-helpers/lib/ember-dev/method-call-tracker.js +0 -127
- data/dist/es/internal-test-helpers/lib/ember-dev/namespaces.js +0 -34
- data/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js +0 -28
- data/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js +0 -26
- data/dist/es/internal-test-helpers/lib/ember-dev/utils.js +0 -33
- data/dist/es/internal-test-helpers/lib/ember-dev/warning.js +0 -71
- data/dist/es/internal-test-helpers/lib/equal-inner-html.js +0 -37
- data/dist/es/internal-test-helpers/lib/equal-tokens.js +0 -53
- data/dist/es/internal-test-helpers/lib/factory.js +0 -65
- data/dist/es/internal-test-helpers/lib/get-all-property-names.js +0 -12
- data/dist/es/internal-test-helpers/lib/get-text-of.js +0 -3
- data/dist/es/internal-test-helpers/lib/matchers.js +0 -167
- data/dist/es/internal-test-helpers/lib/module-for.js +0 -89
- data/dist/es/internal-test-helpers/lib/registry-check.js +0 -28
- data/dist/es/internal-test-helpers/lib/run.js +0 -11
- data/dist/es/internal-test-helpers/lib/strip.js +0 -12
- data/dist/es/internal-test-helpers/lib/system/synthetic-events.js +0 -183
- data/dist/es/internal-test-helpers/lib/test-cases/abstract-application.js +0 -70
- data/dist/es/internal-test-helpers/lib/test-cases/abstract-rendering.js +0 -203
- data/dist/es/internal-test-helpers/lib/test-cases/abstract.js +0 -222
- data/dist/es/internal-test-helpers/lib/test-cases/application.js +0 -39
- data/dist/es/internal-test-helpers/lib/test-cases/autoboot-application.js +0 -34
- data/dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js +0 -43
- data/dist/es/internal-test-helpers/lib/test-cases/node-query.js +0 -120
- data/dist/es/internal-test-helpers/lib/test-cases/query-param.js +0 -124
- data/dist/es/internal-test-helpers/lib/test-cases/rendering.js +0 -14
- data/dist/es/internal-test-helpers/lib/test-cases/router.js +0 -26
- data/dist/es/internal-test-helpers/lib/test-cases/test-resolver-application.js +0 -40
- data/dist/es/internal-test-helpers/lib/test-resolver.js +0 -86
- data/dist/es/internal-test-helpers/tests/index-test.js +0 -10
- data/dist/es/route-recognizer.js +0 -685
- data/dist/es/router.js +0 -2454
- data/dist/es/rsvp.js +0 -2394
- data/dist/es/simple-html-tokenizer.js +0 -638
- data/dist/jquery/jquery.js +0 -10364
- data/dist/node/app-boot-test.js +0 -146
- data/dist/node/build-info-test.js +0 -177
- data/dist/node/component-rendering-test.js +0 -34
- data/dist/node/helpers/app-module.js +0 -198
- data/dist/node/helpers/assert-html-matches.js +0 -25
- data/dist/node/helpers/build-owner.js +0 -28
- data/dist/node/helpers/component-module.js +0 -137
- data/dist/node/sourcemap-test.js +0 -27
- data/dist/node/template-compiler-test.js +0 -45
- data/dist/node/visit-test.js +0 -349
- data/dist/qunit/qunit.css +0 -436
- data/dist/qunit/qunit.js +0 -5188
- data/dist/tests/index.html +0 -254
- data/ember-source.gemspec +0 -28
- data/node_modules/.yarn-integrity +0 -10
- data/yarn.lock +0 -4
@@ -1,222 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
@module ember
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { Mixin, get } from 'ember-metal';
|
6
|
-
import { assert } from '@ember/debug';
|
7
|
-
|
8
|
-
/**
|
9
|
-
`Ember.ActionHandler` is available on some familiar classes including
|
10
|
-
`Route`, `Component`, and `Controller`.
|
11
|
-
(Internally the mixin is used by `Ember.CoreView`, `Ember.ControllerMixin`,
|
12
|
-
and `Route` and available to the above classes through
|
13
|
-
inheritance.)
|
14
|
-
|
15
|
-
@class ActionHandler
|
16
|
-
@namespace Ember
|
17
|
-
@private
|
18
|
-
*/
|
19
|
-
const ActionHandler = Mixin.create({
|
20
|
-
mergedProperties: ['actions'],
|
21
|
-
|
22
|
-
/**
|
23
|
-
The collection of functions, keyed by name, available on this
|
24
|
-
`ActionHandler` as action targets.
|
25
|
-
|
26
|
-
These functions will be invoked when a matching `{{action}}` is triggered
|
27
|
-
from within a template and the application's current route is this route.
|
28
|
-
|
29
|
-
Actions can also be invoked from other parts of your application
|
30
|
-
via `ActionHandler#send`.
|
31
|
-
|
32
|
-
The `actions` hash will inherit action handlers from
|
33
|
-
the `actions` hash defined on extended parent classes
|
34
|
-
or mixins rather than just replace the entire hash, e.g.:
|
35
|
-
|
36
|
-
```app/mixins/can-display-banner.js
|
37
|
-
import Mixin from '@ember/mixin';
|
38
|
-
|
39
|
-
export default Mixin.create({
|
40
|
-
actions: {
|
41
|
-
displayBanner(msg) {
|
42
|
-
// ...
|
43
|
-
}
|
44
|
-
}
|
45
|
-
});
|
46
|
-
```
|
47
|
-
|
48
|
-
```app/routes/welcome.js
|
49
|
-
import Route from '@ember/routing/route';
|
50
|
-
import CanDisplayBanner from '../mixins/can-display-banner';
|
51
|
-
|
52
|
-
export default Route.extend(CanDisplayBanner, {
|
53
|
-
actions: {
|
54
|
-
playMusic() {
|
55
|
-
// ...
|
56
|
-
}
|
57
|
-
}
|
58
|
-
});
|
59
|
-
|
60
|
-
// `WelcomeRoute`, when active, will be able to respond
|
61
|
-
// to both actions, since the actions hash is merged rather
|
62
|
-
// then replaced when extending mixins / parent classes.
|
63
|
-
this.send('displayBanner');
|
64
|
-
this.send('playMusic');
|
65
|
-
```
|
66
|
-
|
67
|
-
Within a Controller, Route or Component's action handler,
|
68
|
-
the value of the `this` context is the Controller, Route or
|
69
|
-
Component object:
|
70
|
-
|
71
|
-
```app/routes/song.js
|
72
|
-
import Route from '@ember/routing/route';
|
73
|
-
|
74
|
-
export default Route.extend({
|
75
|
-
actions: {
|
76
|
-
myAction() {
|
77
|
-
this.controllerFor("song");
|
78
|
-
this.transitionTo("other.route");
|
79
|
-
...
|
80
|
-
}
|
81
|
-
}
|
82
|
-
});
|
83
|
-
```
|
84
|
-
|
85
|
-
It is also possible to call `this._super(...arguments)` from within an
|
86
|
-
action handler if it overrides a handler defined on a parent
|
87
|
-
class or mixin:
|
88
|
-
|
89
|
-
Take for example the following routes:
|
90
|
-
|
91
|
-
```app/mixins/debug-route.js
|
92
|
-
import Mixin from '@ember/mixin';
|
93
|
-
|
94
|
-
export default Mixin.create({
|
95
|
-
actions: {
|
96
|
-
debugRouteInformation() {
|
97
|
-
console.debug("It's a-me, console.debug!");
|
98
|
-
}
|
99
|
-
}
|
100
|
-
});
|
101
|
-
```
|
102
|
-
|
103
|
-
```app/routes/annoying-debug.js
|
104
|
-
import Route from '@ember/routing/route';
|
105
|
-
import DebugRoute from '../mixins/debug-route';
|
106
|
-
|
107
|
-
export default Route.extend(DebugRoute, {
|
108
|
-
actions: {
|
109
|
-
debugRouteInformation() {
|
110
|
-
// also call the debugRouteInformation of mixed in DebugRoute
|
111
|
-
this._super(...arguments);
|
112
|
-
|
113
|
-
// show additional annoyance
|
114
|
-
window.alert(...);
|
115
|
-
}
|
116
|
-
}
|
117
|
-
});
|
118
|
-
```
|
119
|
-
|
120
|
-
## Bubbling
|
121
|
-
|
122
|
-
By default, an action will stop bubbling once a handler defined
|
123
|
-
on the `actions` hash handles it. To continue bubbling the action,
|
124
|
-
you must return `true` from the handler:
|
125
|
-
|
126
|
-
```app/router.js
|
127
|
-
Router.map(function() {
|
128
|
-
this.route("album", function() {
|
129
|
-
this.route("song");
|
130
|
-
});
|
131
|
-
});
|
132
|
-
```
|
133
|
-
|
134
|
-
```app/routes/album.js
|
135
|
-
import Route from '@ember/routing/route';
|
136
|
-
|
137
|
-
export default Route.extend({
|
138
|
-
actions: {
|
139
|
-
startPlaying: function() {
|
140
|
-
}
|
141
|
-
}
|
142
|
-
});
|
143
|
-
```
|
144
|
-
|
145
|
-
```app/routes/album-song.js
|
146
|
-
import Route from '@ember/routing/route';
|
147
|
-
|
148
|
-
export default Route.extend({
|
149
|
-
actions: {
|
150
|
-
startPlaying() {
|
151
|
-
// ...
|
152
|
-
|
153
|
-
if (actionShouldAlsoBeTriggeredOnParentRoute) {
|
154
|
-
return true;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
}
|
158
|
-
});
|
159
|
-
```
|
160
|
-
|
161
|
-
@property actions
|
162
|
-
@type Object
|
163
|
-
@default null
|
164
|
-
@public
|
165
|
-
*/
|
166
|
-
|
167
|
-
/**
|
168
|
-
Triggers a named action on the `ActionHandler`. Any parameters
|
169
|
-
supplied after the `actionName` string will be passed as arguments
|
170
|
-
to the action target function.
|
171
|
-
|
172
|
-
If the `ActionHandler` has its `target` property set, actions may
|
173
|
-
bubble to the `target`. Bubbling happens when an `actionName` can
|
174
|
-
not be found in the `ActionHandler`'s `actions` hash or if the
|
175
|
-
action target function returns `true`.
|
176
|
-
|
177
|
-
Example
|
178
|
-
|
179
|
-
```app/routes/welcome.js
|
180
|
-
import Route from '@ember/routing/route';
|
181
|
-
|
182
|
-
export default Route.extend({
|
183
|
-
actions: {
|
184
|
-
playTheme() {
|
185
|
-
this.send('playMusic', 'theme.mp3');
|
186
|
-
},
|
187
|
-
playMusic(track) {
|
188
|
-
// ...
|
189
|
-
}
|
190
|
-
}
|
191
|
-
});
|
192
|
-
```
|
193
|
-
|
194
|
-
@method send
|
195
|
-
@param {String} actionName The action to trigger
|
196
|
-
@param {*} context a context to send with the action
|
197
|
-
@public
|
198
|
-
*/
|
199
|
-
send(actionName, ...args) {
|
200
|
-
assert(
|
201
|
-
`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`,
|
202
|
-
!this.isDestroying && !this.isDestroyed
|
203
|
-
);
|
204
|
-
if (this.actions && this.actions[actionName]) {
|
205
|
-
let shouldBubble = this.actions[actionName].apply(this, args) === true;
|
206
|
-
if (!shouldBubble) {
|
207
|
-
return;
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
let target = get(this, 'target');
|
212
|
-
if (target) {
|
213
|
-
assert(
|
214
|
-
`The \`target\` for ${this} (${target}) does not have a \`send\` method`,
|
215
|
-
typeof target.send === 'function'
|
216
|
-
);
|
217
|
-
target.send(...arguments);
|
218
|
-
}
|
219
|
-
},
|
220
|
-
});
|
221
|
-
|
222
|
-
export default ActionHandler;
|
@@ -1,1661 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
@module @ember/array
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { ARRAY_AT_EACH } from '@ember/deprecated-features';
|
6
|
-
import { DEBUG } from '@glimmer/env';
|
7
|
-
import { PROXY_CONTENT } from 'ember-metal';
|
8
|
-
import { symbol, toString, HAS_NATIVE_PROXY, tryInvoke } from 'ember-utils';
|
9
|
-
import {
|
10
|
-
get,
|
11
|
-
set,
|
12
|
-
objectAt,
|
13
|
-
replaceInNativeArray,
|
14
|
-
computed,
|
15
|
-
aliasMethod,
|
16
|
-
Mixin,
|
17
|
-
hasListeners,
|
18
|
-
eachProxyFor,
|
19
|
-
beginPropertyChanges,
|
20
|
-
endPropertyChanges,
|
21
|
-
addArrayObserver,
|
22
|
-
removeArrayObserver,
|
23
|
-
arrayContentWillChange,
|
24
|
-
arrayContentDidChange,
|
25
|
-
} from 'ember-metal';
|
26
|
-
import { assert, deprecate } from '@ember/debug';
|
27
|
-
import Enumerable from './enumerable';
|
28
|
-
import compare from '../compare';
|
29
|
-
import { ENV } from 'ember-environment';
|
30
|
-
import Observable from '../mixins/observable';
|
31
|
-
import copy from '../copy';
|
32
|
-
import EmberError from '@ember/error';
|
33
|
-
import MutableEnumerable from './mutable_enumerable';
|
34
|
-
import { typeOf } from '../type-of';
|
35
|
-
|
36
|
-
const EMPTY_ARRAY = Object.freeze([]);
|
37
|
-
const EMBER_ARRAY = symbol('EMBER_ARRAY');
|
38
|
-
|
39
|
-
export function isEmberArray(obj) {
|
40
|
-
return obj && obj[EMBER_ARRAY];
|
41
|
-
}
|
42
|
-
|
43
|
-
const identityFunction = item => item;
|
44
|
-
|
45
|
-
export function uniqBy(array, key = identityFunction) {
|
46
|
-
assert(`first argument passed to \`uniqBy\` should be array`, isArray(array));
|
47
|
-
|
48
|
-
let ret = A();
|
49
|
-
let seen = new Set();
|
50
|
-
let getter = typeof key === 'function' ? key : item => get(item, key);
|
51
|
-
|
52
|
-
array.forEach(item => {
|
53
|
-
let val = getter(item);
|
54
|
-
if (!seen.has(val)) {
|
55
|
-
seen.add(val);
|
56
|
-
ret.push(item);
|
57
|
-
}
|
58
|
-
});
|
59
|
-
|
60
|
-
return ret;
|
61
|
-
}
|
62
|
-
|
63
|
-
function iter(key, value) {
|
64
|
-
let valueProvided = arguments.length === 2;
|
65
|
-
return valueProvided ? item => value === get(item, key) : item => !!get(item, key);
|
66
|
-
}
|
67
|
-
|
68
|
-
function findIndex(array, predicate, startAt) {
|
69
|
-
let len = array.length;
|
70
|
-
for (let index = startAt; index < len; index++) {
|
71
|
-
let item = objectAt(array, index);
|
72
|
-
if (predicate(item, index, array)) {
|
73
|
-
return index;
|
74
|
-
}
|
75
|
-
}
|
76
|
-
return -1;
|
77
|
-
}
|
78
|
-
|
79
|
-
function find(array, callback, target) {
|
80
|
-
let predicate = callback.bind(target);
|
81
|
-
let index = findIndex(array, predicate, 0);
|
82
|
-
return index === -1 ? undefined : objectAt(array, index);
|
83
|
-
}
|
84
|
-
|
85
|
-
function any(array, callback, target) {
|
86
|
-
let predicate = callback.bind(target);
|
87
|
-
return findIndex(array, predicate, 0) !== -1;
|
88
|
-
}
|
89
|
-
|
90
|
-
function every(array, callback, target) {
|
91
|
-
let cb = callback.bind(target);
|
92
|
-
let predicate = (item, index, array) => !cb(item, index, array);
|
93
|
-
return findIndex(array, predicate, 0) === -1;
|
94
|
-
}
|
95
|
-
|
96
|
-
function indexOf(array, val, startAt = 0, withNaNCheck) {
|
97
|
-
let len = array.length;
|
98
|
-
|
99
|
-
if (startAt < 0) {
|
100
|
-
startAt += len;
|
101
|
-
}
|
102
|
-
|
103
|
-
// SameValueZero comparison (NaN !== NaN)
|
104
|
-
let predicate = withNaNCheck && val !== val ? item => item !== item : item => item === val;
|
105
|
-
return findIndex(array, predicate, startAt);
|
106
|
-
}
|
107
|
-
|
108
|
-
/**
|
109
|
-
Returns true if the passed object is an array or Array-like.
|
110
|
-
|
111
|
-
Objects are considered Array-like if any of the following are true:
|
112
|
-
|
113
|
-
- the object is a native Array
|
114
|
-
- the object has an objectAt property
|
115
|
-
- the object is an Object, and has a length property
|
116
|
-
|
117
|
-
Unlike `typeOf` this method returns true even if the passed object is
|
118
|
-
not formally an array but appears to be array-like (i.e. implements `Array`)
|
119
|
-
|
120
|
-
```javascript
|
121
|
-
import { isArray } from '@ember/array';
|
122
|
-
import ArrayProxy from '@ember/array/proxy';
|
123
|
-
|
124
|
-
isArray(); // false
|
125
|
-
isArray([]); // true
|
126
|
-
isArray(ArrayProxy.create({ content: [] })); // true
|
127
|
-
```
|
128
|
-
|
129
|
-
@method isArray
|
130
|
-
@static
|
131
|
-
@for @ember/array
|
132
|
-
@param {Object} obj The object to test
|
133
|
-
@return {Boolean} true if the passed object is an array or Array-like
|
134
|
-
@public
|
135
|
-
*/
|
136
|
-
export function isArray(_obj) {
|
137
|
-
let obj = _obj;
|
138
|
-
if (DEBUG && HAS_NATIVE_PROXY && typeof _obj === 'object' && _obj !== null) {
|
139
|
-
let possibleProxyContent = _obj[PROXY_CONTENT];
|
140
|
-
if (possibleProxyContent !== undefined) {
|
141
|
-
obj = possibleProxyContent;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
if (!obj || obj.setInterval) {
|
146
|
-
return false;
|
147
|
-
}
|
148
|
-
if (Array.isArray(obj) || ArrayMixin.detect(obj)) {
|
149
|
-
return true;
|
150
|
-
}
|
151
|
-
|
152
|
-
let type = typeOf(obj);
|
153
|
-
if ('array' === type) {
|
154
|
-
return true;
|
155
|
-
}
|
156
|
-
let length = obj.length;
|
157
|
-
if (typeof length === 'number' && length === length && 'object' === type) {
|
158
|
-
return true;
|
159
|
-
}
|
160
|
-
return false;
|
161
|
-
}
|
162
|
-
|
163
|
-
// ..........................................................
|
164
|
-
// ARRAY
|
165
|
-
//
|
166
|
-
/**
|
167
|
-
This mixin implements Observer-friendly Array-like behavior. It is not a
|
168
|
-
concrete implementation, but it can be used up by other classes that want
|
169
|
-
to appear like arrays.
|
170
|
-
|
171
|
-
For example, ArrayProxy is a concrete classes that can
|
172
|
-
be instantiated to implement array-like behavior. Both of these classes use
|
173
|
-
the Array Mixin by way of the MutableArray mixin, which allows observable
|
174
|
-
changes to be made to the underlying array.
|
175
|
-
|
176
|
-
This mixin defines methods specifically for collections that provide
|
177
|
-
index-ordered access to their contents. When you are designing code that
|
178
|
-
needs to accept any kind of Array-like object, you should use these methods
|
179
|
-
instead of Array primitives because these will properly notify observers of
|
180
|
-
changes to the array.
|
181
|
-
|
182
|
-
Although these methods are efficient, they do add a layer of indirection to
|
183
|
-
your application so it is a good idea to use them only when you need the
|
184
|
-
flexibility of using both true JavaScript arrays and "virtual" arrays such
|
185
|
-
as controllers and collections.
|
186
|
-
|
187
|
-
You can use the methods defined in this module to access and modify array
|
188
|
-
contents in a KVO-friendly way. You can also be notified whenever the
|
189
|
-
membership of an array changes by using `.observes('myArray.[]')`.
|
190
|
-
|
191
|
-
To support `EmberArray` in your own class, you must override two
|
192
|
-
primitives to use it: `length()` and `objectAt()`.
|
193
|
-
|
194
|
-
@class EmberArray
|
195
|
-
@uses Enumerable
|
196
|
-
@since Ember 0.9.0
|
197
|
-
@public
|
198
|
-
*/
|
199
|
-
const ArrayMixin = Mixin.create(Enumerable, {
|
200
|
-
[EMBER_ARRAY]: true,
|
201
|
-
|
202
|
-
/**
|
203
|
-
__Required.__ You must implement this method to apply this mixin.
|
204
|
-
|
205
|
-
Your array must support the `length` property. Your replace methods should
|
206
|
-
set this property whenever it changes.
|
207
|
-
|
208
|
-
@property {Number} length
|
209
|
-
@public
|
210
|
-
*/
|
211
|
-
|
212
|
-
/**
|
213
|
-
Returns the object at the given `index`. If the given `index` is negative
|
214
|
-
or is greater or equal than the array length, returns `undefined`.
|
215
|
-
|
216
|
-
This is one of the primitives you must implement to support `EmberArray`.
|
217
|
-
If your object supports retrieving the value of an array item using `get()`
|
218
|
-
(i.e. `myArray.get(0)`), then you do not need to implement this method
|
219
|
-
yourself.
|
220
|
-
|
221
|
-
```javascript
|
222
|
-
let arr = ['a', 'b', 'c', 'd'];
|
223
|
-
|
224
|
-
arr.objectAt(0); // 'a'
|
225
|
-
arr.objectAt(3); // 'd'
|
226
|
-
arr.objectAt(-1); // undefined
|
227
|
-
arr.objectAt(4); // undefined
|
228
|
-
arr.objectAt(5); // undefined
|
229
|
-
```
|
230
|
-
|
231
|
-
@method objectAt
|
232
|
-
@param {Number} idx The index of the item to return.
|
233
|
-
@return {*} item at index or undefined
|
234
|
-
@public
|
235
|
-
*/
|
236
|
-
|
237
|
-
/**
|
238
|
-
This returns the objects at the specified indexes, using `objectAt`.
|
239
|
-
|
240
|
-
```javascript
|
241
|
-
let arr = ['a', 'b', 'c', 'd'];
|
242
|
-
|
243
|
-
arr.objectsAt([0, 1, 2]); // ['a', 'b', 'c']
|
244
|
-
arr.objectsAt([2, 3, 4]); // ['c', 'd', undefined]
|
245
|
-
```
|
246
|
-
|
247
|
-
@method objectsAt
|
248
|
-
@param {Array} indexes An array of indexes of items to return.
|
249
|
-
@return {Array}
|
250
|
-
@public
|
251
|
-
*/
|
252
|
-
objectsAt(indexes) {
|
253
|
-
return indexes.map(idx => objectAt(this, idx));
|
254
|
-
},
|
255
|
-
|
256
|
-
/**
|
257
|
-
This is the handler for the special array content property. If you get
|
258
|
-
this property, it will return this. If you set this property to a new
|
259
|
-
array, it will replace the current content.
|
260
|
-
|
261
|
-
@property []
|
262
|
-
@return this
|
263
|
-
@public
|
264
|
-
*/
|
265
|
-
'[]': computed({
|
266
|
-
get() {
|
267
|
-
return this;
|
268
|
-
},
|
269
|
-
set(key, value) {
|
270
|
-
this.replace(0, this.length, value);
|
271
|
-
return this;
|
272
|
-
},
|
273
|
-
}),
|
274
|
-
|
275
|
-
/**
|
276
|
-
The first object in the array, or `undefined` if the array is empty.
|
277
|
-
|
278
|
-
@property firstObject
|
279
|
-
@return {Object | undefined} The first object in the array
|
280
|
-
@public
|
281
|
-
*/
|
282
|
-
firstObject: computed(function() {
|
283
|
-
return objectAt(this, 0);
|
284
|
-
}).readOnly(),
|
285
|
-
|
286
|
-
/**
|
287
|
-
The last object in the array, or `undefined` if the array is empty.
|
288
|
-
|
289
|
-
@property lastObject
|
290
|
-
@return {Object | undefined} The last object in the array
|
291
|
-
@public
|
292
|
-
*/
|
293
|
-
lastObject: computed(function() {
|
294
|
-
return objectAt(this, this.length - 1);
|
295
|
-
}).readOnly(),
|
296
|
-
|
297
|
-
// Add any extra methods to EmberArray that are native to the built-in Array.
|
298
|
-
/**
|
299
|
-
Returns a new array that is a slice of the receiver. This implementation
|
300
|
-
uses the observable array methods to retrieve the objects for the new
|
301
|
-
slice.
|
302
|
-
|
303
|
-
```javascript
|
304
|
-
let arr = ['red', 'green', 'blue'];
|
305
|
-
|
306
|
-
arr.slice(0); // ['red', 'green', 'blue']
|
307
|
-
arr.slice(0, 2); // ['red', 'green']
|
308
|
-
arr.slice(1, 100); // ['green', 'blue']
|
309
|
-
```
|
310
|
-
|
311
|
-
@method slice
|
312
|
-
@param {Number} beginIndex (Optional) index to begin slicing from.
|
313
|
-
@param {Number} endIndex (Optional) index to end the slice at (but not included).
|
314
|
-
@return {Array} New array with specified slice
|
315
|
-
@public
|
316
|
-
*/
|
317
|
-
slice(beginIndex = 0, endIndex) {
|
318
|
-
let ret = A();
|
319
|
-
let length = this.length;
|
320
|
-
|
321
|
-
if (beginIndex < 0) {
|
322
|
-
beginIndex = length + beginIndex;
|
323
|
-
}
|
324
|
-
|
325
|
-
if (endIndex === undefined || endIndex > length) {
|
326
|
-
endIndex = length;
|
327
|
-
} else if (endIndex < 0) {
|
328
|
-
endIndex = length + endIndex;
|
329
|
-
}
|
330
|
-
|
331
|
-
while (beginIndex < endIndex) {
|
332
|
-
ret[ret.length] = objectAt(this, beginIndex++);
|
333
|
-
}
|
334
|
-
|
335
|
-
return ret;
|
336
|
-
},
|
337
|
-
|
338
|
-
/**
|
339
|
-
Returns the index of the given object's first occurrence.
|
340
|
-
If no `startAt` argument is given, the starting location to
|
341
|
-
search is 0. If it's negative, will count backward from
|
342
|
-
the end of the array. Returns -1 if no match is found.
|
343
|
-
|
344
|
-
```javascript
|
345
|
-
let arr = ['a', 'b', 'c', 'd', 'a'];
|
346
|
-
|
347
|
-
arr.indexOf('a'); // 0
|
348
|
-
arr.indexOf('z'); // -1
|
349
|
-
arr.indexOf('a', 2); // 4
|
350
|
-
arr.indexOf('a', -1); // 4
|
351
|
-
arr.indexOf('b', 3); // -1
|
352
|
-
arr.indexOf('a', 100); // -1
|
353
|
-
```
|
354
|
-
|
355
|
-
@method indexOf
|
356
|
-
@param {Object} object the item to search for
|
357
|
-
@param {Number} startAt optional starting location to search, default 0
|
358
|
-
@return {Number} index or -1 if not found
|
359
|
-
@public
|
360
|
-
*/
|
361
|
-
|
362
|
-
indexOf(object, startAt) {
|
363
|
-
return indexOf(this, object, startAt, false);
|
364
|
-
},
|
365
|
-
|
366
|
-
/**
|
367
|
-
Returns the index of the given object's last occurrence.
|
368
|
-
If no `startAt` argument is given, the search starts from
|
369
|
-
the last position. If it's negative, will count backward
|
370
|
-
from the end of the array. Returns -1 if no match is found.
|
371
|
-
|
372
|
-
```javascript
|
373
|
-
let arr = ['a', 'b', 'c', 'd', 'a'];
|
374
|
-
|
375
|
-
arr.lastIndexOf('a'); // 4
|
376
|
-
arr.lastIndexOf('z'); // -1
|
377
|
-
arr.lastIndexOf('a', 2); // 0
|
378
|
-
arr.lastIndexOf('a', -1); // 4
|
379
|
-
arr.lastIndexOf('b', 3); // 1
|
380
|
-
arr.lastIndexOf('a', 100); // 4
|
381
|
-
```
|
382
|
-
|
383
|
-
@method lastIndexOf
|
384
|
-
@param {Object} object the item to search for
|
385
|
-
@param {Number} startAt optional starting location to search, default 0
|
386
|
-
@return {Number} index or -1 if not found
|
387
|
-
@public
|
388
|
-
*/
|
389
|
-
lastIndexOf(object, startAt) {
|
390
|
-
let len = this.length;
|
391
|
-
|
392
|
-
if (startAt === undefined || startAt >= len) {
|
393
|
-
startAt = len - 1;
|
394
|
-
}
|
395
|
-
|
396
|
-
if (startAt < 0) {
|
397
|
-
startAt += len;
|
398
|
-
}
|
399
|
-
|
400
|
-
for (let idx = startAt; idx >= 0; idx--) {
|
401
|
-
if (objectAt(this, idx) === object) {
|
402
|
-
return idx;
|
403
|
-
}
|
404
|
-
}
|
405
|
-
|
406
|
-
return -1;
|
407
|
-
},
|
408
|
-
|
409
|
-
// ..........................................................
|
410
|
-
// ARRAY OBSERVERS
|
411
|
-
//
|
412
|
-
|
413
|
-
/**
|
414
|
-
Adds an array observer to the receiving array. The array observer object
|
415
|
-
normally must implement two methods:
|
416
|
-
|
417
|
-
* `arrayWillChange(observedObj, start, removeCount, addCount)` - This method will be
|
418
|
-
called just before the array is modified.
|
419
|
-
* `arrayDidChange(observedObj, start, removeCount, addCount)` - This method will be
|
420
|
-
called just after the array is modified.
|
421
|
-
|
422
|
-
Both callbacks will be passed the observed object, starting index of the
|
423
|
-
change as well as a count of the items to be removed and added. You can use
|
424
|
-
these callbacks to optionally inspect the array during the change, clear
|
425
|
-
caches, or do any other bookkeeping necessary.
|
426
|
-
|
427
|
-
In addition to passing a target, you can also include an options hash
|
428
|
-
which you can use to override the method names that will be invoked on the
|
429
|
-
target.
|
430
|
-
|
431
|
-
@method addArrayObserver
|
432
|
-
@param {Object} target The observer object.
|
433
|
-
@param {Object} opts Optional hash of configuration options including
|
434
|
-
`willChange` and `didChange` option.
|
435
|
-
@return {EmberArray} receiver
|
436
|
-
@public
|
437
|
-
*/
|
438
|
-
|
439
|
-
addArrayObserver(target, opts) {
|
440
|
-
return addArrayObserver(this, target, opts);
|
441
|
-
},
|
442
|
-
|
443
|
-
/**
|
444
|
-
Removes an array observer from the object if the observer is current
|
445
|
-
registered. Calling this method multiple times with the same object will
|
446
|
-
have no effect.
|
447
|
-
|
448
|
-
@method removeArrayObserver
|
449
|
-
@param {Object} target The object observing the array.
|
450
|
-
@param {Object} opts Optional hash of configuration options including
|
451
|
-
`willChange` and `didChange` option.
|
452
|
-
@return {EmberArray} receiver
|
453
|
-
@public
|
454
|
-
*/
|
455
|
-
removeArrayObserver(target, opts) {
|
456
|
-
return removeArrayObserver(this, target, opts);
|
457
|
-
},
|
458
|
-
|
459
|
-
/**
|
460
|
-
Becomes true whenever the array currently has observers watching changes
|
461
|
-
on the array.
|
462
|
-
|
463
|
-
@property {Boolean} hasArrayObservers
|
464
|
-
@public
|
465
|
-
*/
|
466
|
-
hasArrayObservers: computed(function() {
|
467
|
-
return hasListeners(this, '@array:change') || hasListeners(this, '@array:before');
|
468
|
-
}),
|
469
|
-
|
470
|
-
/**
|
471
|
-
If you are implementing an object that supports `EmberArray`, call this
|
472
|
-
method just before the array content changes to notify any observers and
|
473
|
-
invalidate any related properties. Pass the starting index of the change
|
474
|
-
as well as a delta of the amounts to change.
|
475
|
-
|
476
|
-
@method arrayContentWillChange
|
477
|
-
@param {Number} startIdx The starting index in the array that will change.
|
478
|
-
@param {Number} removeAmt The number of items that will be removed. If you
|
479
|
-
pass `null` assumes 0
|
480
|
-
@param {Number} addAmt The number of items that will be added. If you
|
481
|
-
pass `null` assumes 0.
|
482
|
-
@return {EmberArray} receiver
|
483
|
-
@public
|
484
|
-
*/
|
485
|
-
arrayContentWillChange(startIdx, removeAmt, addAmt) {
|
486
|
-
return arrayContentWillChange(this, startIdx, removeAmt, addAmt);
|
487
|
-
},
|
488
|
-
|
489
|
-
/**
|
490
|
-
If you are implementing an object that supports `EmberArray`, call this
|
491
|
-
method just after the array content changes to notify any observers and
|
492
|
-
invalidate any related properties. Pass the starting index of the change
|
493
|
-
as well as a delta of the amounts to change.
|
494
|
-
|
495
|
-
@method arrayContentDidChange
|
496
|
-
@param {Number} startIdx The starting index in the array that did change.
|
497
|
-
@param {Number} removeAmt The number of items that were removed. If you
|
498
|
-
pass `null` assumes 0
|
499
|
-
@param {Number} addAmt The number of items that were added. If you
|
500
|
-
pass `null` assumes 0.
|
501
|
-
@return {EmberArray} receiver
|
502
|
-
@public
|
503
|
-
*/
|
504
|
-
arrayContentDidChange(startIdx, removeAmt, addAmt) {
|
505
|
-
return arrayContentDidChange(this, startIdx, removeAmt, addAmt);
|
506
|
-
},
|
507
|
-
|
508
|
-
/**
|
509
|
-
Iterates through the array, calling the passed function on each
|
510
|
-
item. This method corresponds to the `forEach()` method defined in
|
511
|
-
JavaScript 1.6.
|
512
|
-
|
513
|
-
The callback method you provide should have the following signature (all
|
514
|
-
parameters are optional):
|
515
|
-
|
516
|
-
```javascript
|
517
|
-
function(item, index, array);
|
518
|
-
```
|
519
|
-
|
520
|
-
- `item` is the current item in the iteration.
|
521
|
-
- `index` is the current index in the iteration.
|
522
|
-
- `array` is the array itself.
|
523
|
-
|
524
|
-
Note that in addition to a callback, you can also pass an optional target
|
525
|
-
object that will be set as `this` on the context. This is a good way
|
526
|
-
to give your iterator function access to the current object.
|
527
|
-
|
528
|
-
@method forEach
|
529
|
-
@param {Function} callback The callback to execute
|
530
|
-
@param {Object} [target] The target object to use
|
531
|
-
@return {Object} receiver
|
532
|
-
@public
|
533
|
-
*/
|
534
|
-
forEach(callback, target = null) {
|
535
|
-
assert('`forEach` expects a function as first argument.', typeof callback === 'function');
|
536
|
-
|
537
|
-
let length = this.length;
|
538
|
-
|
539
|
-
for (let index = 0; index < length; index++) {
|
540
|
-
let item = this.objectAt(index);
|
541
|
-
callback.call(target, item, index, this);
|
542
|
-
}
|
543
|
-
|
544
|
-
return this;
|
545
|
-
},
|
546
|
-
|
547
|
-
/**
|
548
|
-
Alias for `mapBy`
|
549
|
-
|
550
|
-
@method getEach
|
551
|
-
@param {String} key name of the property
|
552
|
-
@return {Array} The mapped array.
|
553
|
-
@public
|
554
|
-
*/
|
555
|
-
getEach: aliasMethod('mapBy'),
|
556
|
-
|
557
|
-
/**
|
558
|
-
Sets the value on the named property for each member. This is more
|
559
|
-
ergonomic than using other methods defined on this helper. If the object
|
560
|
-
implements Observable, the value will be changed to `set(),` otherwise
|
561
|
-
it will be set directly. `null` objects are skipped.
|
562
|
-
|
563
|
-
@method setEach
|
564
|
-
@param {String} key The key to set
|
565
|
-
@param {Object} value The object to set
|
566
|
-
@return {Object} receiver
|
567
|
-
@public
|
568
|
-
*/
|
569
|
-
setEach(key, value) {
|
570
|
-
return this.forEach(item => set(item, key, value));
|
571
|
-
},
|
572
|
-
|
573
|
-
/**
|
574
|
-
Maps all of the items in the enumeration to another value, returning
|
575
|
-
a new array. This method corresponds to `map()` defined in JavaScript 1.6.
|
576
|
-
|
577
|
-
The callback method you provide should have the following signature (all
|
578
|
-
parameters are optional):
|
579
|
-
|
580
|
-
```javascript
|
581
|
-
function(item, index, array);
|
582
|
-
```
|
583
|
-
|
584
|
-
- `item` is the current item in the iteration.
|
585
|
-
- `index` is the current index in the iteration.
|
586
|
-
- `array` is the array itself.
|
587
|
-
|
588
|
-
It should return the mapped value.
|
589
|
-
|
590
|
-
Note that in addition to a callback, you can also pass an optional target
|
591
|
-
object that will be set as `this` on the context. This is a good way
|
592
|
-
to give your iterator function access to the current object.
|
593
|
-
|
594
|
-
@method map
|
595
|
-
@param {Function} callback The callback to execute
|
596
|
-
@param {Object} [target] The target object to use
|
597
|
-
@return {Array} The mapped array.
|
598
|
-
@public
|
599
|
-
*/
|
600
|
-
map(callback, target = null) {
|
601
|
-
assert('`map` expects a function as first argument.', typeof callback === 'function');
|
602
|
-
|
603
|
-
let ret = A();
|
604
|
-
|
605
|
-
this.forEach((x, idx, i) => (ret[idx] = callback.call(target, x, idx, i)));
|
606
|
-
|
607
|
-
return ret;
|
608
|
-
},
|
609
|
-
|
610
|
-
/**
|
611
|
-
Similar to map, this specialized function returns the value of the named
|
612
|
-
property on all items in the enumeration.
|
613
|
-
|
614
|
-
@method mapBy
|
615
|
-
@param {String} key name of the property
|
616
|
-
@return {Array} The mapped array.
|
617
|
-
@public
|
618
|
-
*/
|
619
|
-
mapBy(key) {
|
620
|
-
return this.map(next => get(next, key));
|
621
|
-
},
|
622
|
-
|
623
|
-
/**
|
624
|
-
Returns an array with all of the items in the enumeration that the passed
|
625
|
-
function returns true for. This method corresponds to `filter()` defined in
|
626
|
-
JavaScript 1.6.
|
627
|
-
|
628
|
-
The callback method you provide should have the following signature (all
|
629
|
-
parameters are optional):
|
630
|
-
|
631
|
-
```javascript
|
632
|
-
function(item, index, array);
|
633
|
-
```
|
634
|
-
|
635
|
-
- `item` is the current item in the iteration.
|
636
|
-
- `index` is the current index in the iteration.
|
637
|
-
- `array` is the array itself.
|
638
|
-
|
639
|
-
It should return `true` to include the item in the results, `false`
|
640
|
-
otherwise.
|
641
|
-
|
642
|
-
Note that in addition to a callback, you can also pass an optional target
|
643
|
-
object that will be set as `this` on the context. This is a good way
|
644
|
-
to give your iterator function access to the current object.
|
645
|
-
|
646
|
-
@method filter
|
647
|
-
@param {Function} callback The callback to execute
|
648
|
-
@param {Object} [target] The target object to use
|
649
|
-
@return {Array} A filtered array.
|
650
|
-
@public
|
651
|
-
*/
|
652
|
-
filter(callback, target = null) {
|
653
|
-
assert('`filter` expects a function as first argument.', typeof callback === 'function');
|
654
|
-
|
655
|
-
let ret = A();
|
656
|
-
|
657
|
-
this.forEach((x, idx, i) => {
|
658
|
-
if (callback.call(target, x, idx, i)) {
|
659
|
-
ret.push(x);
|
660
|
-
}
|
661
|
-
});
|
662
|
-
|
663
|
-
return ret;
|
664
|
-
},
|
665
|
-
|
666
|
-
/**
|
667
|
-
Returns an array with all of the items in the enumeration where the passed
|
668
|
-
function returns false. This method is the inverse of filter().
|
669
|
-
|
670
|
-
The callback method you provide should have the following signature (all
|
671
|
-
parameters are optional):
|
672
|
-
|
673
|
-
```javascript
|
674
|
-
function(item, index, array);
|
675
|
-
```
|
676
|
-
|
677
|
-
- *item* is the current item in the iteration.
|
678
|
-
- *index* is the current index in the iteration
|
679
|
-
- *array* is the array itself.
|
680
|
-
|
681
|
-
It should return a falsey value to include the item in the results.
|
682
|
-
|
683
|
-
Note that in addition to a callback, you can also pass an optional target
|
684
|
-
object that will be set as "this" on the context. This is a good way
|
685
|
-
to give your iterator function access to the current object.
|
686
|
-
|
687
|
-
@method reject
|
688
|
-
@param {Function} callback The callback to execute
|
689
|
-
@param {Object} [target] The target object to use
|
690
|
-
@return {Array} A rejected array.
|
691
|
-
@public
|
692
|
-
*/
|
693
|
-
reject(callback, target = null) {
|
694
|
-
assert('`reject` expects a function as first argument.', typeof callback === 'function');
|
695
|
-
return this.filter(function() {
|
696
|
-
return !callback.apply(target, arguments);
|
697
|
-
});
|
698
|
-
},
|
699
|
-
|
700
|
-
/**
|
701
|
-
Returns an array with just the items with the matched property. You
|
702
|
-
can pass an optional second argument with the target value. Otherwise
|
703
|
-
this will match any property that evaluates to `true`.
|
704
|
-
|
705
|
-
@method filterBy
|
706
|
-
@param {String} key the property to test
|
707
|
-
@param {*} [value] optional value to test against.
|
708
|
-
@return {Array} filtered array
|
709
|
-
@public
|
710
|
-
*/
|
711
|
-
filterBy() {
|
712
|
-
return this.filter(iter(...arguments));
|
713
|
-
},
|
714
|
-
|
715
|
-
/**
|
716
|
-
Returns an array with the items that do not have truthy values for
|
717
|
-
key. You can pass an optional second argument with the target value. Otherwise
|
718
|
-
this will match any property that evaluates to false.
|
719
|
-
|
720
|
-
@method rejectBy
|
721
|
-
@param {String} key the property to test
|
722
|
-
@param {*} [value] optional value to test against.
|
723
|
-
@return {Array} rejected array
|
724
|
-
@public
|
725
|
-
*/
|
726
|
-
rejectBy() {
|
727
|
-
return this.reject(iter(...arguments));
|
728
|
-
},
|
729
|
-
|
730
|
-
/**
|
731
|
-
Returns the first item in the array for which the callback returns true.
|
732
|
-
This method is similar to the `find()` method defined in ECMAScript 2015.
|
733
|
-
|
734
|
-
The callback method you provide should have the following signature (all
|
735
|
-
parameters are optional):
|
736
|
-
|
737
|
-
```javascript
|
738
|
-
function(item, index, array);
|
739
|
-
```
|
740
|
-
|
741
|
-
- `item` is the current item in the iteration.
|
742
|
-
- `index` is the current index in the iteration.
|
743
|
-
- `array` is the array itself.
|
744
|
-
|
745
|
-
It should return the `true` to include the item in the results, `false`
|
746
|
-
otherwise.
|
747
|
-
|
748
|
-
Note that in addition to a callback, you can also pass an optional target
|
749
|
-
object that will be set as `this` on the context. This is a good way
|
750
|
-
to give your iterator function access to the current object.
|
751
|
-
|
752
|
-
@method find
|
753
|
-
@param {Function} callback The callback to execute
|
754
|
-
@param {Object} [target] The target object to use
|
755
|
-
@return {Object} Found item or `undefined`.
|
756
|
-
@public
|
757
|
-
*/
|
758
|
-
find(callback, target = null) {
|
759
|
-
assert('`find` expects a function as first argument.', typeof callback === 'function');
|
760
|
-
return find(this, callback, target);
|
761
|
-
},
|
762
|
-
|
763
|
-
/**
|
764
|
-
Returns the first item with a property matching the passed value. You
|
765
|
-
can pass an optional second argument with the target value. Otherwise
|
766
|
-
this will match any property that evaluates to `true`.
|
767
|
-
|
768
|
-
This method works much like the more generic `find()` method.
|
769
|
-
|
770
|
-
@method findBy
|
771
|
-
@param {String} key the property to test
|
772
|
-
@param {String} [value] optional value to test against.
|
773
|
-
@return {Object} found item or `undefined`
|
774
|
-
@public
|
775
|
-
*/
|
776
|
-
findBy() {
|
777
|
-
return find(this, iter(...arguments));
|
778
|
-
},
|
779
|
-
|
780
|
-
/**
|
781
|
-
Returns `true` if the passed function returns true for every item in the
|
782
|
-
enumeration. This corresponds with the `every()` method in JavaScript 1.6.
|
783
|
-
|
784
|
-
The callback method you provide should have the following signature (all
|
785
|
-
parameters are optional):
|
786
|
-
|
787
|
-
```javascript
|
788
|
-
function(item, index, array);
|
789
|
-
```
|
790
|
-
|
791
|
-
- `item` is the current item in the iteration.
|
792
|
-
- `index` is the current index in the iteration.
|
793
|
-
- `array` is the array itself.
|
794
|
-
|
795
|
-
It should return the `true` or `false`.
|
796
|
-
|
797
|
-
Note that in addition to a callback, you can also pass an optional target
|
798
|
-
object that will be set as `this` on the context. This is a good way
|
799
|
-
to give your iterator function access to the current object.
|
800
|
-
|
801
|
-
Example Usage:
|
802
|
-
|
803
|
-
```javascript
|
804
|
-
if (people.every(isEngineer)) {
|
805
|
-
Paychecks.addBigBonus();
|
806
|
-
}
|
807
|
-
```
|
808
|
-
|
809
|
-
@method every
|
810
|
-
@param {Function} callback The callback to execute
|
811
|
-
@param {Object} [target] The target object to use
|
812
|
-
@return {Boolean}
|
813
|
-
@public
|
814
|
-
*/
|
815
|
-
every(callback, target = null) {
|
816
|
-
assert('`every` expects a function as first argument.', typeof callback === 'function');
|
817
|
-
return every(this, callback, target);
|
818
|
-
},
|
819
|
-
|
820
|
-
/**
|
821
|
-
Returns `true` if the passed property resolves to the value of the second
|
822
|
-
argument for all items in the array. This method is often simpler/faster
|
823
|
-
than using a callback.
|
824
|
-
|
825
|
-
Note that like the native `Array.every`, `isEvery` will return true when called
|
826
|
-
on any empty array.
|
827
|
-
|
828
|
-
@method isEvery
|
829
|
-
@param {String} key the property to test
|
830
|
-
@param {String} [value] optional value to test against. Defaults to `true`
|
831
|
-
@return {Boolean}
|
832
|
-
@since 1.3.0
|
833
|
-
@public
|
834
|
-
*/
|
835
|
-
isEvery() {
|
836
|
-
return every(this, iter(...arguments));
|
837
|
-
},
|
838
|
-
|
839
|
-
/**
|
840
|
-
Returns `true` if the passed function returns true for any item in the
|
841
|
-
enumeration.
|
842
|
-
|
843
|
-
The callback method you provide should have the following signature (all
|
844
|
-
parameters are optional):
|
845
|
-
|
846
|
-
```javascript
|
847
|
-
function(item, index, array);
|
848
|
-
```
|
849
|
-
|
850
|
-
- `item` is the current item in the iteration.
|
851
|
-
- `index` is the current index in the iteration.
|
852
|
-
- `array` is the array object itself.
|
853
|
-
|
854
|
-
It must return a truthy value (i.e. `true`) to include an item in the
|
855
|
-
results. Any non-truthy return value will discard the item from the
|
856
|
-
results.
|
857
|
-
|
858
|
-
Note that in addition to a callback, you can also pass an optional target
|
859
|
-
object that will be set as `this` on the context. This is a good way
|
860
|
-
to give your iterator function access to the current object.
|
861
|
-
|
862
|
-
Usage Example:
|
863
|
-
|
864
|
-
```javascript
|
865
|
-
if (people.any(isManager)) {
|
866
|
-
Paychecks.addBiggerBonus();
|
867
|
-
}
|
868
|
-
```
|
869
|
-
|
870
|
-
@method any
|
871
|
-
@param {Function} callback The callback to execute
|
872
|
-
@param {Object} [target] The target object to use
|
873
|
-
@return {Boolean} `true` if the passed function returns `true` for any item
|
874
|
-
@public
|
875
|
-
*/
|
876
|
-
any(callback, target = null) {
|
877
|
-
assert('`any` expects a function as first argument.', typeof callback === 'function');
|
878
|
-
return any(this, callback, target);
|
879
|
-
},
|
880
|
-
|
881
|
-
/**
|
882
|
-
Returns `true` if the passed property resolves to the value of the second
|
883
|
-
argument for any item in the array. This method is often simpler/faster
|
884
|
-
than using a callback.
|
885
|
-
|
886
|
-
@method isAny
|
887
|
-
@param {String} key the property to test
|
888
|
-
@param {String} [value] optional value to test against. Defaults to `true`
|
889
|
-
@return {Boolean}
|
890
|
-
@since 1.3.0
|
891
|
-
@public
|
892
|
-
*/
|
893
|
-
isAny() {
|
894
|
-
return any(this, iter(...arguments));
|
895
|
-
},
|
896
|
-
|
897
|
-
/**
|
898
|
-
This will combine the values of the enumerator into a single value. It
|
899
|
-
is a useful way to collect a summary value from an enumeration. This
|
900
|
-
corresponds to the `reduce()` method defined in JavaScript 1.8.
|
901
|
-
|
902
|
-
The callback method you provide should have the following signature (all
|
903
|
-
parameters are optional):
|
904
|
-
|
905
|
-
```javascript
|
906
|
-
function(previousValue, item, index, array);
|
907
|
-
```
|
908
|
-
|
909
|
-
- `previousValue` is the value returned by the last call to the iterator.
|
910
|
-
- `item` is the current item in the iteration.
|
911
|
-
- `index` is the current index in the iteration.
|
912
|
-
- `array` is the array itself.
|
913
|
-
|
914
|
-
Return the new cumulative value.
|
915
|
-
|
916
|
-
In addition to the callback you can also pass an `initialValue`. An error
|
917
|
-
will be raised if you do not pass an initial value and the enumerator is
|
918
|
-
empty.
|
919
|
-
|
920
|
-
Note that unlike the other methods, this method does not allow you to
|
921
|
-
pass a target object to set as this for the callback. It's part of the
|
922
|
-
spec. Sorry.
|
923
|
-
|
924
|
-
@method reduce
|
925
|
-
@param {Function} callback The callback to execute
|
926
|
-
@param {Object} initialValue Initial value for the reduce
|
927
|
-
@return {Object} The reduced value.
|
928
|
-
@public
|
929
|
-
*/
|
930
|
-
reduce(callback, initialValue) {
|
931
|
-
assert('`reduce` expects a function as first argument.', typeof callback === 'function');
|
932
|
-
|
933
|
-
let ret = initialValue;
|
934
|
-
|
935
|
-
this.forEach(function(item, i) {
|
936
|
-
ret = callback(ret, item, i, this);
|
937
|
-
}, this);
|
938
|
-
|
939
|
-
return ret;
|
940
|
-
},
|
941
|
-
|
942
|
-
/**
|
943
|
-
Invokes the named method on every object in the receiver that
|
944
|
-
implements it. This method corresponds to the implementation in
|
945
|
-
Prototype 1.6.
|
946
|
-
|
947
|
-
@method invoke
|
948
|
-
@param {String} methodName the name of the method
|
949
|
-
@param {Object...} args optional arguments to pass as well.
|
950
|
-
@return {Array} return values from calling invoke.
|
951
|
-
@public
|
952
|
-
*/
|
953
|
-
invoke(methodName, ...args) {
|
954
|
-
let ret = A();
|
955
|
-
|
956
|
-
this.forEach(item => ret.push(tryInvoke(item, methodName, args)));
|
957
|
-
|
958
|
-
return ret;
|
959
|
-
},
|
960
|
-
|
961
|
-
/**
|
962
|
-
Simply converts the object into a genuine array. The order is not
|
963
|
-
guaranteed. Corresponds to the method implemented by Prototype.
|
964
|
-
|
965
|
-
@method toArray
|
966
|
-
@return {Array} the object as an array.
|
967
|
-
@public
|
968
|
-
*/
|
969
|
-
toArray() {
|
970
|
-
return this.map(item => item);
|
971
|
-
},
|
972
|
-
|
973
|
-
/**
|
974
|
-
Returns a copy of the array with all `null` and `undefined` elements removed.
|
975
|
-
|
976
|
-
```javascript
|
977
|
-
let arr = ['a', null, 'c', undefined];
|
978
|
-
arr.compact(); // ['a', 'c']
|
979
|
-
```
|
980
|
-
|
981
|
-
@method compact
|
982
|
-
@return {Array} the array without null and undefined elements.
|
983
|
-
@public
|
984
|
-
*/
|
985
|
-
compact() {
|
986
|
-
return this.filter(value => value != null);
|
987
|
-
},
|
988
|
-
|
989
|
-
/**
|
990
|
-
Returns `true` if the passed object can be found in the array.
|
991
|
-
This method is a Polyfill for ES 2016 Array.includes.
|
992
|
-
If no `startAt` argument is given, the starting location to
|
993
|
-
search is 0. If it's negative, searches from the index of
|
994
|
-
`this.length + startAt` by asc.
|
995
|
-
|
996
|
-
```javascript
|
997
|
-
[1, 2, 3].includes(2); // true
|
998
|
-
[1, 2, 3].includes(4); // false
|
999
|
-
[1, 2, 3].includes(3, 2); // true
|
1000
|
-
[1, 2, 3].includes(3, 3); // false
|
1001
|
-
[1, 2, 3].includes(3, -1); // true
|
1002
|
-
[1, 2, 3].includes(1, -1); // false
|
1003
|
-
[1, 2, 3].includes(1, -4); // true
|
1004
|
-
[1, 2, NaN].includes(NaN); // true
|
1005
|
-
```
|
1006
|
-
|
1007
|
-
@method includes
|
1008
|
-
@param {Object} object The object to search for.
|
1009
|
-
@param {Number} startAt optional starting location to search, default 0
|
1010
|
-
@return {Boolean} `true` if object is found in the array.
|
1011
|
-
@public
|
1012
|
-
*/
|
1013
|
-
includes(object, startAt) {
|
1014
|
-
return indexOf(this, object, startAt, true) !== -1;
|
1015
|
-
},
|
1016
|
-
|
1017
|
-
/**
|
1018
|
-
Converts the array into an array and sorts by the keys
|
1019
|
-
specified in the argument.
|
1020
|
-
|
1021
|
-
You may provide multiple arguments to sort by multiple properties.
|
1022
|
-
|
1023
|
-
@method sortBy
|
1024
|
-
@param {String} property name(s) to sort on
|
1025
|
-
@return {Array} The sorted array.
|
1026
|
-
@since 1.2.0
|
1027
|
-
@public
|
1028
|
-
*/
|
1029
|
-
sortBy() {
|
1030
|
-
let sortKeys = arguments;
|
1031
|
-
|
1032
|
-
return this.toArray().sort((a, b) => {
|
1033
|
-
for (let i = 0; i < sortKeys.length; i++) {
|
1034
|
-
let key = sortKeys[i];
|
1035
|
-
let propA = get(a, key);
|
1036
|
-
let propB = get(b, key);
|
1037
|
-
// return 1 or -1 else continue to the next sortKey
|
1038
|
-
let compareValue = compare(propA, propB);
|
1039
|
-
|
1040
|
-
if (compareValue) {
|
1041
|
-
return compareValue;
|
1042
|
-
}
|
1043
|
-
}
|
1044
|
-
return 0;
|
1045
|
-
});
|
1046
|
-
},
|
1047
|
-
|
1048
|
-
/**
|
1049
|
-
Returns a new array that contains only unique values. The default
|
1050
|
-
implementation returns an array regardless of the receiver type.
|
1051
|
-
|
1052
|
-
```javascript
|
1053
|
-
let arr = ['a', 'a', 'b', 'b'];
|
1054
|
-
arr.uniq(); // ['a', 'b']
|
1055
|
-
```
|
1056
|
-
|
1057
|
-
This only works on primitive data types, e.g. Strings, Numbers, etc.
|
1058
|
-
|
1059
|
-
@method uniq
|
1060
|
-
@return {EmberArray}
|
1061
|
-
@public
|
1062
|
-
*/
|
1063
|
-
uniq() {
|
1064
|
-
return uniqBy(this);
|
1065
|
-
},
|
1066
|
-
|
1067
|
-
/**
|
1068
|
-
Returns a new array that contains only items containing a unique property value.
|
1069
|
-
The default implementation returns an array regardless of the receiver type.
|
1070
|
-
|
1071
|
-
```javascript
|
1072
|
-
let arr = [{ value: 'a' }, { value: 'a' }, { value: 'b' }, { value: 'b' }];
|
1073
|
-
arr.uniqBy('value'); // [{ value: 'a' }, { value: 'b' }]
|
1074
|
-
|
1075
|
-
let arr = [2.2, 2.1, 3.2, 3.3];
|
1076
|
-
arr.uniqBy(Math.floor); // [2.2, 3.2];
|
1077
|
-
```
|
1078
|
-
|
1079
|
-
@method uniqBy
|
1080
|
-
@param {String,Function} key
|
1081
|
-
@return {EmberArray}
|
1082
|
-
@public
|
1083
|
-
*/
|
1084
|
-
|
1085
|
-
uniqBy(key) {
|
1086
|
-
return uniqBy(this, key);
|
1087
|
-
},
|
1088
|
-
|
1089
|
-
/**
|
1090
|
-
Returns a new array that excludes the passed value. The default
|
1091
|
-
implementation returns an array regardless of the receiver type.
|
1092
|
-
If the receiver does not contain the value it returns the original array.
|
1093
|
-
|
1094
|
-
```javascript
|
1095
|
-
let arr = ['a', 'b', 'a', 'c'];
|
1096
|
-
arr.without('a'); // ['b', 'c']
|
1097
|
-
```
|
1098
|
-
|
1099
|
-
@method without
|
1100
|
-
@param {Object} value
|
1101
|
-
@return {EmberArray}
|
1102
|
-
@public
|
1103
|
-
*/
|
1104
|
-
without(value) {
|
1105
|
-
if (!this.includes(value)) {
|
1106
|
-
return this; // nothing to do
|
1107
|
-
}
|
1108
|
-
|
1109
|
-
// SameValueZero comparison (NaN !== NaN)
|
1110
|
-
let predicate = value === value ? item => item !== value : item => item === item;
|
1111
|
-
return this.filter(predicate);
|
1112
|
-
},
|
1113
|
-
|
1114
|
-
/**
|
1115
|
-
Returns a special object that can be used to observe individual properties
|
1116
|
-
on the array. Just get an equivalent property on this object and it will
|
1117
|
-
return an array that maps automatically to the named key on the
|
1118
|
-
member objects.
|
1119
|
-
|
1120
|
-
`@each` should only be used in a non-terminal context. Example:
|
1121
|
-
|
1122
|
-
```javascript
|
1123
|
-
myMethod: computed('posts.@each.author', function(){
|
1124
|
-
...
|
1125
|
-
});
|
1126
|
-
```
|
1127
|
-
|
1128
|
-
If you merely want to watch for the array being changed, like an object being
|
1129
|
-
replaced, added or removed, use `[]` instead of `@each`.
|
1130
|
-
|
1131
|
-
```javascript
|
1132
|
-
myMethod: computed('posts.[]', function(){
|
1133
|
-
...
|
1134
|
-
});
|
1135
|
-
```
|
1136
|
-
|
1137
|
-
@property @each
|
1138
|
-
@deprecated
|
1139
|
-
@public
|
1140
|
-
*/
|
1141
|
-
'@each': ARRAY_AT_EACH
|
1142
|
-
? computed(function() {
|
1143
|
-
deprecate(`Getting the '@each' property on object ${toString(this)} is deprecated`, false, {
|
1144
|
-
id: 'ember-metal.getting-each',
|
1145
|
-
until: '3.5.0',
|
1146
|
-
url: 'https://emberjs.com/deprecations/v3.x#toc_getting-the-each-property',
|
1147
|
-
});
|
1148
|
-
|
1149
|
-
return eachProxyFor(this);
|
1150
|
-
}).readOnly()
|
1151
|
-
: undefined,
|
1152
|
-
});
|
1153
|
-
|
1154
|
-
const OUT_OF_RANGE_EXCEPTION = 'Index out of range';
|
1155
|
-
|
1156
|
-
export function removeAt(array, start, len = 1) {
|
1157
|
-
if ('number' === typeof start) {
|
1158
|
-
if (start < 0 || start >= array.length) {
|
1159
|
-
throw new EmberError(OUT_OF_RANGE_EXCEPTION);
|
1160
|
-
}
|
1161
|
-
|
1162
|
-
array.replace(start, len, EMPTY_ARRAY);
|
1163
|
-
}
|
1164
|
-
|
1165
|
-
return array;
|
1166
|
-
}
|
1167
|
-
|
1168
|
-
/**
|
1169
|
-
This mixin defines the API for modifying array-like objects. These methods
|
1170
|
-
can be applied only to a collection that keeps its items in an ordered set.
|
1171
|
-
It builds upon the Array mixin and adds methods to modify the array.
|
1172
|
-
One concrete implementations of this class include ArrayProxy.
|
1173
|
-
|
1174
|
-
It is important to use the methods in this class to modify arrays so that
|
1175
|
-
changes are observable. This allows the binding system in Ember to function
|
1176
|
-
correctly.
|
1177
|
-
|
1178
|
-
|
1179
|
-
Note that an Array can change even if it does not implement this mixin.
|
1180
|
-
For example, one might implement a SparseArray that cannot be directly
|
1181
|
-
modified, but if its underlying enumerable changes, it will change also.
|
1182
|
-
|
1183
|
-
@class MutableArray
|
1184
|
-
@uses EmberArray
|
1185
|
-
@uses MutableEnumerable
|
1186
|
-
@public
|
1187
|
-
*/
|
1188
|
-
|
1189
|
-
const MutableArray = Mixin.create(ArrayMixin, MutableEnumerable, {
|
1190
|
-
/**
|
1191
|
-
__Required.__ You must implement this method to apply this mixin.
|
1192
|
-
|
1193
|
-
This is one of the primitives you must implement to support `Array`.
|
1194
|
-
You should replace amt objects started at idx with the objects in the
|
1195
|
-
passed array. You should also call `this.arrayContentDidChange()`
|
1196
|
-
|
1197
|
-
Note that this method is expected to validate the type(s) of objects that it expects.
|
1198
|
-
|
1199
|
-
@method replace
|
1200
|
-
@param {Number} idx Starting index in the array to replace. If
|
1201
|
-
idx >= length, then append to the end of the array.
|
1202
|
-
@param {Number} amt Number of elements that should be removed from
|
1203
|
-
the array, starting at *idx*.
|
1204
|
-
@param {EmberArray} objects An array of zero or more objects that should be
|
1205
|
-
inserted into the array at *idx*
|
1206
|
-
@public
|
1207
|
-
*/
|
1208
|
-
|
1209
|
-
/**
|
1210
|
-
Remove all elements from the array. This is useful if you
|
1211
|
-
want to reuse an existing array without having to recreate it.
|
1212
|
-
|
1213
|
-
```javascript
|
1214
|
-
let colors = ['red', 'green', 'blue'];
|
1215
|
-
|
1216
|
-
colors.length; // 3
|
1217
|
-
colors.clear(); // []
|
1218
|
-
colors.length; // 0
|
1219
|
-
```
|
1220
|
-
|
1221
|
-
@method clear
|
1222
|
-
@return {Array} An empty Array.
|
1223
|
-
@public
|
1224
|
-
*/
|
1225
|
-
clear() {
|
1226
|
-
let len = this.length;
|
1227
|
-
if (len === 0) {
|
1228
|
-
return this;
|
1229
|
-
}
|
1230
|
-
|
1231
|
-
this.replace(0, len, EMPTY_ARRAY);
|
1232
|
-
return this;
|
1233
|
-
},
|
1234
|
-
|
1235
|
-
/**
|
1236
|
-
This will use the primitive `replace()` method to insert an object at the
|
1237
|
-
specified index.
|
1238
|
-
|
1239
|
-
```javascript
|
1240
|
-
let colors = ['red', 'green', 'blue'];
|
1241
|
-
|
1242
|
-
colors.insertAt(2, 'yellow'); // ['red', 'green', 'yellow', 'blue']
|
1243
|
-
colors.insertAt(5, 'orange'); // Error: Index out of range
|
1244
|
-
```
|
1245
|
-
|
1246
|
-
@method insertAt
|
1247
|
-
@param {Number} idx index of insert the object at.
|
1248
|
-
@param {Object} object object to insert
|
1249
|
-
@return {EmberArray} receiver
|
1250
|
-
@public
|
1251
|
-
*/
|
1252
|
-
insertAt(idx, object) {
|
1253
|
-
if (idx > this.length) {
|
1254
|
-
throw new EmberError(OUT_OF_RANGE_EXCEPTION);
|
1255
|
-
}
|
1256
|
-
|
1257
|
-
this.replace(idx, 0, [object]);
|
1258
|
-
return this;
|
1259
|
-
},
|
1260
|
-
|
1261
|
-
/**
|
1262
|
-
Remove an object at the specified index using the `replace()` primitive
|
1263
|
-
method. You can pass either a single index, or a start and a length.
|
1264
|
-
|
1265
|
-
If you pass a start and length that is beyond the
|
1266
|
-
length this method will throw an `OUT_OF_RANGE_EXCEPTION`.
|
1267
|
-
|
1268
|
-
```javascript
|
1269
|
-
let colors = ['red', 'green', 'blue', 'yellow', 'orange'];
|
1270
|
-
|
1271
|
-
colors.removeAt(0); // ['green', 'blue', 'yellow', 'orange']
|
1272
|
-
colors.removeAt(2, 2); // ['green', 'blue']
|
1273
|
-
colors.removeAt(4, 2); // Error: Index out of range
|
1274
|
-
```
|
1275
|
-
|
1276
|
-
@method removeAt
|
1277
|
-
@param {Number} start index, start of range
|
1278
|
-
@param {Number} len length of passing range
|
1279
|
-
@return {EmberArray} receiver
|
1280
|
-
@public
|
1281
|
-
*/
|
1282
|
-
removeAt(start, len) {
|
1283
|
-
return removeAt(this, start, len);
|
1284
|
-
},
|
1285
|
-
|
1286
|
-
/**
|
1287
|
-
Push the object onto the end of the array. Works just like `push()` but it
|
1288
|
-
is KVO-compliant.
|
1289
|
-
|
1290
|
-
```javascript
|
1291
|
-
let colors = ['red', 'green'];
|
1292
|
-
|
1293
|
-
colors.pushObject('black'); // ['red', 'green', 'black']
|
1294
|
-
colors.pushObject(['yellow']); // ['red', 'green', ['yellow']]
|
1295
|
-
```
|
1296
|
-
|
1297
|
-
@method pushObject
|
1298
|
-
@param {*} obj object to push
|
1299
|
-
@return object same object passed as a param
|
1300
|
-
@public
|
1301
|
-
*/
|
1302
|
-
pushObject(obj) {
|
1303
|
-
this.insertAt(this.length, obj);
|
1304
|
-
return obj;
|
1305
|
-
},
|
1306
|
-
|
1307
|
-
/**
|
1308
|
-
Add the objects in the passed array to the end of the array. Defers
|
1309
|
-
notifying observers of the change until all objects are added.
|
1310
|
-
|
1311
|
-
```javascript
|
1312
|
-
let colors = ['red'];
|
1313
|
-
|
1314
|
-
colors.pushObjects(['yellow', 'orange']); // ['red', 'yellow', 'orange']
|
1315
|
-
```
|
1316
|
-
|
1317
|
-
@method pushObjects
|
1318
|
-
@param {EmberArray} objects the objects to add
|
1319
|
-
@return {EmberArray} receiver
|
1320
|
-
@public
|
1321
|
-
*/
|
1322
|
-
pushObjects(objects) {
|
1323
|
-
this.replace(this.length, 0, objects);
|
1324
|
-
return this;
|
1325
|
-
},
|
1326
|
-
|
1327
|
-
/**
|
1328
|
-
Pop object from array or nil if none are left. Works just like `pop()` but
|
1329
|
-
it is KVO-compliant.
|
1330
|
-
|
1331
|
-
```javascript
|
1332
|
-
let colors = ['red', 'green', 'blue'];
|
1333
|
-
|
1334
|
-
colors.popObject(); // 'blue'
|
1335
|
-
console.log(colors); // ['red', 'green']
|
1336
|
-
```
|
1337
|
-
|
1338
|
-
@method popObject
|
1339
|
-
@return object
|
1340
|
-
@public
|
1341
|
-
*/
|
1342
|
-
popObject() {
|
1343
|
-
let len = this.length;
|
1344
|
-
if (len === 0) {
|
1345
|
-
return null;
|
1346
|
-
}
|
1347
|
-
|
1348
|
-
let ret = objectAt(this, len - 1);
|
1349
|
-
this.removeAt(len - 1, 1);
|
1350
|
-
return ret;
|
1351
|
-
},
|
1352
|
-
|
1353
|
-
/**
|
1354
|
-
Shift an object from start of array or nil if none are left. Works just
|
1355
|
-
like `shift()` but it is KVO-compliant.
|
1356
|
-
|
1357
|
-
```javascript
|
1358
|
-
let colors = ['red', 'green', 'blue'];
|
1359
|
-
|
1360
|
-
colors.shiftObject(); // 'red'
|
1361
|
-
console.log(colors); // ['green', 'blue']
|
1362
|
-
```
|
1363
|
-
|
1364
|
-
@method shiftObject
|
1365
|
-
@return object
|
1366
|
-
@public
|
1367
|
-
*/
|
1368
|
-
shiftObject() {
|
1369
|
-
if (this.length === 0) {
|
1370
|
-
return null;
|
1371
|
-
}
|
1372
|
-
|
1373
|
-
let ret = objectAt(this, 0);
|
1374
|
-
this.removeAt(0);
|
1375
|
-
return ret;
|
1376
|
-
},
|
1377
|
-
|
1378
|
-
/**
|
1379
|
-
Unshift an object to start of array. Works just like `unshift()` but it is
|
1380
|
-
KVO-compliant.
|
1381
|
-
|
1382
|
-
```javascript
|
1383
|
-
let colors = ['red'];
|
1384
|
-
|
1385
|
-
colors.unshiftObject('yellow'); // ['yellow', 'red']
|
1386
|
-
colors.unshiftObject(['black']); // [['black'], 'yellow', 'red']
|
1387
|
-
```
|
1388
|
-
|
1389
|
-
@method unshiftObject
|
1390
|
-
@param {*} obj object to unshift
|
1391
|
-
@return object same object passed as a param
|
1392
|
-
@public
|
1393
|
-
*/
|
1394
|
-
unshiftObject(obj) {
|
1395
|
-
this.insertAt(0, obj);
|
1396
|
-
return obj;
|
1397
|
-
},
|
1398
|
-
|
1399
|
-
/**
|
1400
|
-
Adds the named objects to the beginning of the array. Defers notifying
|
1401
|
-
observers until all objects have been added.
|
1402
|
-
|
1403
|
-
```javascript
|
1404
|
-
let colors = ['red'];
|
1405
|
-
|
1406
|
-
colors.unshiftObjects(['black', 'white']); // ['black', 'white', 'red']
|
1407
|
-
colors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function
|
1408
|
-
```
|
1409
|
-
|
1410
|
-
@method unshiftObjects
|
1411
|
-
@param {Enumberable} objects the objects to add
|
1412
|
-
@return {EmberArray} receiver
|
1413
|
-
@public
|
1414
|
-
*/
|
1415
|
-
unshiftObjects(objects) {
|
1416
|
-
this.replace(0, 0, objects);
|
1417
|
-
return this;
|
1418
|
-
},
|
1419
|
-
|
1420
|
-
/**
|
1421
|
-
Reverse objects in the array. Works just like `reverse()` but it is
|
1422
|
-
KVO-compliant.
|
1423
|
-
|
1424
|
-
@method reverseObjects
|
1425
|
-
@return {EmberArray} receiver
|
1426
|
-
@public
|
1427
|
-
*/
|
1428
|
-
reverseObjects() {
|
1429
|
-
let len = this.length;
|
1430
|
-
if (len === 0) {
|
1431
|
-
return this;
|
1432
|
-
}
|
1433
|
-
|
1434
|
-
let objects = this.toArray().reverse();
|
1435
|
-
this.replace(0, len, objects);
|
1436
|
-
return this;
|
1437
|
-
},
|
1438
|
-
|
1439
|
-
/**
|
1440
|
-
Replace all the receiver's content with content of the argument.
|
1441
|
-
If argument is an empty array receiver will be cleared.
|
1442
|
-
|
1443
|
-
```javascript
|
1444
|
-
let colors = ['red', 'green', 'blue'];
|
1445
|
-
|
1446
|
-
colors.setObjects(['black', 'white']); // ['black', 'white']
|
1447
|
-
colors.setObjects([]); // []
|
1448
|
-
```
|
1449
|
-
|
1450
|
-
@method setObjects
|
1451
|
-
@param {EmberArray} objects array whose content will be used for replacing
|
1452
|
-
the content of the receiver
|
1453
|
-
@return {EmberArray} receiver with the new content
|
1454
|
-
@public
|
1455
|
-
*/
|
1456
|
-
setObjects(objects) {
|
1457
|
-
if (objects.length === 0) {
|
1458
|
-
return this.clear();
|
1459
|
-
}
|
1460
|
-
|
1461
|
-
let len = this.length;
|
1462
|
-
this.replace(0, len, objects);
|
1463
|
-
return this;
|
1464
|
-
},
|
1465
|
-
|
1466
|
-
/**
|
1467
|
-
Remove all occurrences of an object in the array.
|
1468
|
-
|
1469
|
-
```javascript
|
1470
|
-
let cities = ['Chicago', 'Berlin', 'Lima', 'Chicago'];
|
1471
|
-
|
1472
|
-
cities.removeObject('Chicago'); // ['Berlin', 'Lima']
|
1473
|
-
cities.removeObject('Lima'); // ['Berlin']
|
1474
|
-
cities.removeObject('Tokyo') // ['Berlin']
|
1475
|
-
```
|
1476
|
-
|
1477
|
-
@method removeObject
|
1478
|
-
@param {*} obj object to remove
|
1479
|
-
@return {EmberArray} receiver
|
1480
|
-
@public
|
1481
|
-
*/
|
1482
|
-
removeObject(obj) {
|
1483
|
-
let loc = this.length || 0;
|
1484
|
-
while (--loc >= 0) {
|
1485
|
-
let curObject = objectAt(this, loc);
|
1486
|
-
|
1487
|
-
if (curObject === obj) {
|
1488
|
-
this.removeAt(loc);
|
1489
|
-
}
|
1490
|
-
}
|
1491
|
-
return this;
|
1492
|
-
},
|
1493
|
-
|
1494
|
-
/**
|
1495
|
-
Removes each object in the passed array from the receiver.
|
1496
|
-
|
1497
|
-
@method removeObjects
|
1498
|
-
@param {EmberArray} objects the objects to remove
|
1499
|
-
@return {EmberArray} receiver
|
1500
|
-
@public
|
1501
|
-
*/
|
1502
|
-
removeObjects(objects) {
|
1503
|
-
beginPropertyChanges();
|
1504
|
-
for (let i = objects.length - 1; i >= 0; i--) {
|
1505
|
-
this.removeObject(objects[i]);
|
1506
|
-
}
|
1507
|
-
endPropertyChanges();
|
1508
|
-
return this;
|
1509
|
-
},
|
1510
|
-
|
1511
|
-
/**
|
1512
|
-
Push the object onto the end of the array if it is not already
|
1513
|
-
present in the array.
|
1514
|
-
|
1515
|
-
```javascript
|
1516
|
-
let cities = ['Chicago', 'Berlin'];
|
1517
|
-
|
1518
|
-
cities.addObject('Lima'); // ['Chicago', 'Berlin', 'Lima']
|
1519
|
-
cities.addObject('Berlin'); // ['Chicago', 'Berlin', 'Lima']
|
1520
|
-
```
|
1521
|
-
|
1522
|
-
@method addObject
|
1523
|
-
@param {*} obj object to add, if not already present
|
1524
|
-
@return {EmberArray} receiver
|
1525
|
-
@public
|
1526
|
-
*/
|
1527
|
-
addObject(obj) {
|
1528
|
-
let included = this.includes(obj);
|
1529
|
-
|
1530
|
-
if (!included) {
|
1531
|
-
this.pushObject(obj);
|
1532
|
-
}
|
1533
|
-
|
1534
|
-
return this;
|
1535
|
-
},
|
1536
|
-
|
1537
|
-
/**
|
1538
|
-
Adds each object in the passed array to the receiver.
|
1539
|
-
|
1540
|
-
@method addObjects
|
1541
|
-
@param {EmberArray} objects the objects to add.
|
1542
|
-
@return {EmberArray} receiver
|
1543
|
-
@public
|
1544
|
-
*/
|
1545
|
-
addObjects(objects) {
|
1546
|
-
beginPropertyChanges();
|
1547
|
-
objects.forEach(obj => this.addObject(obj));
|
1548
|
-
endPropertyChanges();
|
1549
|
-
return this;
|
1550
|
-
},
|
1551
|
-
});
|
1552
|
-
|
1553
|
-
/**
|
1554
|
-
Creates an `Ember.NativeArray` from an Array-like object.
|
1555
|
-
Does not modify the original object's contents. `A()` is not needed if
|
1556
|
-
`EmberENV.EXTEND_PROTOTYPES` is `true` (the default value). However,
|
1557
|
-
it is recommended that you use `A()` when creating addons for
|
1558
|
-
ember or when you can not guarantee that `EmberENV.EXTEND_PROTOTYPES`
|
1559
|
-
will be `true`.
|
1560
|
-
|
1561
|
-
Example
|
1562
|
-
|
1563
|
-
```app/components/my-component.js
|
1564
|
-
import Component from '@ember/component';
|
1565
|
-
import { A } from '@ember/array';
|
1566
|
-
|
1567
|
-
export default Component.extend({
|
1568
|
-
tagName: 'ul',
|
1569
|
-
classNames: ['pagination'],
|
1570
|
-
|
1571
|
-
init() {
|
1572
|
-
this._super(...arguments);
|
1573
|
-
|
1574
|
-
if (!this.get('content')) {
|
1575
|
-
this.set('content', A());
|
1576
|
-
this.set('otherContent', A([1,2,3]));
|
1577
|
-
}
|
1578
|
-
}
|
1579
|
-
});
|
1580
|
-
```
|
1581
|
-
|
1582
|
-
@method A
|
1583
|
-
@static
|
1584
|
-
@for @ember/array
|
1585
|
-
@return {Ember.NativeArray}
|
1586
|
-
@public
|
1587
|
-
*/
|
1588
|
-
|
1589
|
-
// Add Ember.Array to Array.prototype. Remove methods with native
|
1590
|
-
// implementations and supply some more optimized versions of generic methods
|
1591
|
-
// because they are so common.
|
1592
|
-
/**
|
1593
|
-
@module ember
|
1594
|
-
*/
|
1595
|
-
/**
|
1596
|
-
The NativeArray mixin contains the properties needed to make the native
|
1597
|
-
Array support MutableArray and all of its dependent APIs. Unless you
|
1598
|
-
have `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Array` set to
|
1599
|
-
false, this will be applied automatically. Otherwise you can apply the mixin
|
1600
|
-
at anytime by calling `Ember.NativeArray.apply(Array.prototype)`.
|
1601
|
-
|
1602
|
-
@class Ember.NativeArray
|
1603
|
-
@uses MutableArray
|
1604
|
-
@uses Observable
|
1605
|
-
@public
|
1606
|
-
*/
|
1607
|
-
let NativeArray = Mixin.create(MutableArray, Observable, {
|
1608
|
-
objectAt(idx) {
|
1609
|
-
return this[idx];
|
1610
|
-
},
|
1611
|
-
|
1612
|
-
// primitive for array support.
|
1613
|
-
replace(start, deleteCount, items = EMPTY_ARRAY) {
|
1614
|
-
assert('The third argument to replace needs to be an array.', Array.isArray(items));
|
1615
|
-
|
1616
|
-
replaceInNativeArray(this, start, deleteCount, items);
|
1617
|
-
|
1618
|
-
return this;
|
1619
|
-
},
|
1620
|
-
|
1621
|
-
copy(deep) {
|
1622
|
-
deprecate(`Using \`NativeArray#copy\` is deprecated`, false, {
|
1623
|
-
id: 'ember-runtime.using-array-copy',
|
1624
|
-
until: '3.5.0',
|
1625
|
-
});
|
1626
|
-
|
1627
|
-
if (deep) {
|
1628
|
-
return this.map(item => copy(item, true));
|
1629
|
-
}
|
1630
|
-
|
1631
|
-
return this.slice();
|
1632
|
-
},
|
1633
|
-
});
|
1634
|
-
|
1635
|
-
// Remove any methods implemented natively so we don't override them
|
1636
|
-
const ignore = ['length'];
|
1637
|
-
NativeArray.keys().forEach(methodName => {
|
1638
|
-
if (Array.prototype[methodName]) {
|
1639
|
-
ignore.push(methodName);
|
1640
|
-
}
|
1641
|
-
});
|
1642
|
-
|
1643
|
-
NativeArray = NativeArray.without(...ignore);
|
1644
|
-
|
1645
|
-
let A;
|
1646
|
-
|
1647
|
-
if (ENV.EXTEND_PROTOTYPES.Array) {
|
1648
|
-
NativeArray.apply(Array.prototype);
|
1649
|
-
A = arr => arr || [];
|
1650
|
-
} else {
|
1651
|
-
A = arr => {
|
1652
|
-
if (!arr) {
|
1653
|
-
arr = [];
|
1654
|
-
}
|
1655
|
-
return ArrayMixin.detect(arr) ? arr : NativeArray.apply(arr);
|
1656
|
-
};
|
1657
|
-
}
|
1658
|
-
|
1659
|
-
export { A, NativeArray, MutableArray };
|
1660
|
-
|
1661
|
-
export default ArrayMixin;
|