How to use the lodash-es.filter function in lodash-es

To help you get started, we’ve selected a few lodash-es examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yoast / YoastSEO.js / src / researches / findKeywordInPageTitle.js View on Github external
const stripFunctionWordsFromStart = function( functionWords, str ) {
	str = str.toLocaleLowerCase();
	let titleWords = getWords( str.toLocaleLowerCase() );

	// Strip all function words from the start of the string.
	titleWords = filter( titleWords, function( word ) {
		return ( ! includes( functionWords, word.trim().toLocaleLowerCase() ) );
	} );

	return isEmpty( titleWords );
};
github Yoast / YoastSEO.js / src / researches / functionWordsInKeyphrase.js View on Github external
export default function( paper ) {
	const keyphrase = paper.getKeyword();

	// Return false if there are double quotes around the keyphrase.
	const doubleQuotes = [ "“", "”", "〝", "〞", "〟", "‟", "„", "\"" ];
	if ( includes( doubleQuotes, keyphrase[ 0 ] ) && includes( doubleQuotes, keyphrase[ keyphrase.length - 1 ] ) ) {
		return false;
	}

	let keyphraseWords = getWords( keyphrase );
	const functionWords = get( getFunctionWords, [ getLanguage( paper.getLocale() ) ], [] );

	keyphraseWords = filter( keyphraseWords, function( word ) {
		return ( ! includes( functionWords.all, word.trim().toLocaleLowerCase() ) );
	} );

	return isEmpty( keyphraseWords );
}
github archivist / archivist / packages / publisher / PublisherSession.js View on Github external
_updateCollaborators(collaborators) {
    let collaboratorsChanged = false
    let allCollaboratorsIds = Object.keys(this.collaborators)
    let activeCollaborators = filter(collaborators, c => { return c !== null })
    let activeCollaboratorsIds = map(activeCollaborators, c => { return c.userId })
    let nonActiveCollabortorIds = difference(allCollaboratorsIds, activeCollaboratorsIds)

    activeCollaboratorsIds.forEach(collaboratorId => {
      let collaboratorData = this.collaborators[collaboratorId]
      if(!collaboratorData) {
        this.emit('collaborator:add', collaboratorId)
        collaboratorsChanged = true
      } else {
        if(!collaboratorData.active) {
          this.collaborators[collaboratorId].active = true
          collaboratorsChanged = true
        }
      }
    })
github CityOfZion / neon-wallet / app / components / Dashboard / TokenBalancesPanel / index.js View on Github external
const filterZeroBalanceTokens = balances =>
  filter(balances, token => toBigNumber(token.balance).gt(0))
github openshift / console / frontend / public / components / catalog / catalog-page.tsx View on Github external
normalizeImageStreams(imageStreams) {
    const builderimageStreams = _.filter(imageStreams, isBuilder);
    return _.map(builderimageStreams, (imageStream) => {
      const { namespace: currentNamespace = '' } = this.props;
      const { name, namespace } = imageStream.metadata;
      const tag = getMostRecentBuilderTag(imageStream);
      const tileName =
        _.get(imageStream, ['metadata', 'annotations', ANNOTATIONS.displayName]) || name;
      const iconClass = getImageStreamIcon(tag);
      const tileImgUrl = getImageForIconClass(iconClass);
      const tileIconClass = tileImgUrl ? null : iconClass;
      const tileDescription = _.get(tag, 'annotations.description');
      const tags = getAnnotationTags(tag);
      const createLabel = 'Create Application';
      const tileProvider = _.get(tag, ['annotations', ANNOTATIONS.providerDisplayName]);
      const href = `/catalog/source-to-image?imagestream=${name}&imagestream-ns=${namespace}&preselected-ns=${currentNamespace}`;
      const builderImageTag = _.head(_.get(imageStream, 'spec.tags'));
      const sampleRepo = _.get(builderImageTag, 'annotations.sampleRepo');
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / plugins / profile / components / profile-page / profile-page.component.ts View on Github external
this.coursesService.enrolledCourseData$.pipe(first()).subscribe(data => {
      this.attendedTraining = _.filter(data.enrolledCourses, { status: 2 }) || [];
    });
  }
github virtool / virtool / client / src / js / subtraction / components / Create.js View on Github external
render() {
        const files = filter(this.props.files, { type: "subtraction" });

        let fileComponents;

        if (files.length) {
            fileComponents = map(files, file => (
                
            ));
        } else {
            fileComponents = (
                
                     No files found. Upload some.
github Yoast / YoastSEO.js / src / assessmentHelpers / checkForTooLongSentences.js View on Github external
module.exports = function( sentences, recommendedValue ) {
	var tooLongSentences = filter( sentences, function( sentence ) {
		return isSentenceTooLong( recommendedValue, sentence.sentenceLength );
	} );

	return tooLongSentences;
};
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / core / components / prominent-filter / prominent-filter.component.ts View on Github external
return this.getOrgSearch().pipe(map((channelData: any) => {
            const data = _.filter(channelData, 'hashTagId');
            return { formData: formData, channelData: data };
          }));
        } else {