Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.observable.of.js 764B

123456789101112131415161718192021222324
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var getBuiltIn = require('../internals/get-built-in');
  4. var isConstructor = require('../internals/is-constructor');
  5. var Array = getBuiltIn('Array');
  6. // `Observable.of` method
  7. // https://github.com/tc39/proposal-observable
  8. $({ target: 'Observable', stat: true, forced: true }, {
  9. of: function of() {
  10. var C = isConstructor(this) ? this : getBuiltIn('Observable');
  11. var length = arguments.length;
  12. var items = Array(length);
  13. var index = 0;
  14. while (index < length) items[index] = arguments[index++];
  15. return new C(function (observer) {
  16. for (var i = 0; i < length; i++) {
  17. observer.next(items[i]);
  18. if (observer.closed) return;
  19. } observer.complete();
  20. });
  21. }
  22. });