.then((responses) => {
   responses.source.deletedContentTypes = filter(responses.destination.contentTypes, (contentType) => {
     return !find(responses.source.contentTypes, {original: {sys: {id: contentType.sys.id}}})
   })
   responses.source.deletedLocales = filter(responses.destination.locales, (locale) => {
     return !find(responses.source.locales, {original: {code: locale.code}})
   })
   return responses
 })
Example #2
0
 getUser : function (email) {
   let users = this.get("users");
   let user = _collection.filter(users, {
     email : email
   })[0];
   return user;
 },
Example #3
0
function excludeCountries(selectedCountries, excludedCountries) {
  if(excludedCountries.length === 0) {
    return selectedCountries;
  } else {
    return filter(selectedCountries, function(selCountry) {
      return !includes(excludedCountries, selCountry.iso2);
    });
  }
}
Example #4
0
ScrollTabs.prototype.getVisibleTabs = function() {
  var allTabs = this.getAllTabNodes();

  var ignore = this.options.selectors.ignore;

  return filter(allTabs, function(tabNode) {
    return !domMatches(tabNode, ignore);
  });
};
Example #5
0
ReactPhoneInput.prototype._searchCountry = memoize(function(queryString){
  if(!queryString || queryString.length === 0) {
    return null;
  }
  // don't include the preferred countries in search
  let probableCountries = filter(this.state.onlyCountries, function(country) {
    return startsWith(country.name.toLowerCase(), queryString.toLowerCase());
  }, this);
  return probableCountries[0];
});
Example #6
0
  constructor(props) {
    super(props);
    let inputNumber = this.props.value || '';
    let onlyCountries = excludeCountries(getOnlyCountries(props.onlyCountries), props.excludeCountries);
    let selectedCountryGuess = this.guessSelectedCountry(inputNumber.replace(/\D/g, ''), onlyCountries);
    let selectedCountryGuessIndex = findIndex(allCountries, selectedCountryGuess);
    let dialCode = selectedCountryGuess && !startsWith(inputNumber, selectedCountryGuess.dialCode) ?
			selectedCountryGuess.dialCode : '';
    let formattedNumber = this.formatNumber(dialCode + inputNumber.replace(/\D/g, ''), selectedCountryGuess ?
			selectedCountryGuess.format : null);
		let preferredCountries = filter(allCountries, (country) => {
			return some(this.props.preferredCountries, (preferredCountry) => {
				return preferredCountry === country.iso2;
			});
		});
    this.getNumber = this.getNumber.bind(this);
    this.getValue = this.getValue.bind(this);
    this.scrollTo = this.scrollTo.bind(this);
    this.formatNumber = this.formatNumber.bind(this);
    this._cursorToEnd = this._cursorToEnd.bind(this);
    this.guessSelectedCountry = this.guessSelectedCountry.bind(this);
    this.getElement = this.getElement.bind(this);
    this.handleFlagDropdownClick = this.handleFlagDropdownClick.bind(this);
    this.handleInput = this.handleInput.bind(this);
    this.handleInputClick = this.handleInputClick.bind(this);
    this.handleFlagItemClick = this.handleFlagItemClick.bind(this);
    this.handleInputFocus = this.handleInputFocus.bind(this);
    this._getHighlightCountryIndex = this._getHighlightCountryIndex.bind(this);
    this._searchCountry = this._searchCountry.bind(this);
    this.searchCountry = this.searchCountry.bind(this);
    this.handleKeydown = this.handleKeydown.bind(this);
    this.handleInputKeyDown = this.handleInputKeyDown.bind(this);
    this.getCountryDropDownList = this.getCountryDropDownList.bind(this);

    this.state = {
      preferredCountries: preferredCountries,
      selectedCountry: selectedCountryGuess,
      highlightCountryIndex: selectedCountryGuessIndex,
      formattedNumber: formattedNumber,
      showDropDown: false,
      queryString: '',
      freezeSelection: false,
      debouncedQueryStingSearcher: debounce(this.searchCountry, 100),
      onlyCountries: onlyCountries
    };
  }
Example #7
0
 .then(response => {
   t.ok(response.total > 0)
   t.equal(filter(response.items[0].fields.likes, i => i === 'lasagna').length, 0)
   t.equal(filter(response.items[0].fields.likes, i => i === 'rainbows').length, 0)
 })
Example #8
0
 .then(response => {
   t.equal(response.total, 2)
   t.equal(filter(response.items, ['sys.id', 'finn']).length, 1)
   t.equal(filter(response.items, ['sys.id', 'jake']).length, 1)
 })
Example #9
0
 .then(response => {
   t.equal(response.total, 1)
   t.equal(filter(response.items[0].fields.likes, i => i === 'lasagna').length, 1)
 })
Example #10
0
 .then(response => {
   t.ok(response.total > 0)
   t.equal(filter(response.items, ['sys.id', 'nyancat']).length, 0)
 })
Example #11
0
             memo.push(val);
           }
         }, []);
         self.get("users").setUsers(users);
         self.set("filteredUsers", _array.take(users, 10));
     });
   });
 }.on("init"),
 //Search Query
 searchQuery(chars) {
   let users = this.get("users").getUsers();
   let filtered = _collection.filter(users, function (user) {
     let name = user.name.toLowerCase();
     if (name.search(chars) >= 0) {
       user.index = user.name.search(chars);
       return true;
     } else {
       return false;
     }
   });
   let ordered = _collection.sortBy(filtered, ['index']);
   return ordered;
 },
 postKey: function(){
   let users = this.searchQuery(this.get('name'));
   this.set("filteredUsers", users);
 }.observes('name'),
 actions: {
   goToDetail(user) {
     this.transitionToRoute("people.detail", { queryParams: { email: user.email }});
   }