2.2.5 • Published 4 years ago

@brandandcelebrities/activities-themes v2.2.5

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

B&C Form Fields

npm i -S @brandandcelebrities/activities-themes

Components

Jump to Release Notes

Activities

import { Activities } from '@brandandcelebrities/activities-themes';
const activities = new Activities();

Methods & Usage

All methods can be chained to reduce the dictionary. Once the dictionary is reduced enough, you can use: .get() to get the keys and translations, .one(id) to get the translation, .keys() to get all keys only, .getAsSelectValues() to get an array of pair { value, label } to use in Select component

activities.locale('fr-FR'); 	// => Filter activities translations by locale

activities.gender('male');		// => Filter activities translations by gender (male or female, default is male)

activities.fullPath();	// => Filter activities translations by full-path mode

activities.exclude(['bmx', 'canoeying']);	// => Exclude the ids from the dictionary

activities.excludeChildren('other'); 	// => Exclude all children of "other"

activities.onlyInclude(['bmx', 'canoeying']);	// => Only include the provided ids in dictionary

activities.onlyFinals(); 	// => Include only activities which do not have sub-activities

activities.notFinals(); 	// => Include only activities with sub-activities

activities.excludeStage(0);	// => Exclude all activities from stage provided (0 to 2 currently)

activities.onlyStage(0);	// => Only include activities from the provided stage

activities.activitiesOf('sports')	// => Only include sub-categories of provided category

activities.sort();	// => Sort translations alphabetically


/* --- Examples --- */
// Get all activities in locale 'fr-FR' and gender 'female', sorted alphabetically
activities.locale('fr-FR').gender('female').sort().get();

// Get only finals activities in locale 'fr-FR' and gender 'female', sorted
activities.locale('fr-FR').onlyFinals().gender('female').sort().get();

// Get sub-activities of activity 'sports' in locale 'en-GB' and gender 'male'
activities.locale('en-GB').activitiesOf('sports').gender('male').get();

// Get all activities on stage 2, but without some ids in 'fr-FR' and full-path, sorted
activities.locale('fr-FR').onlyStage(2).exclude(['greco_roman_wrestling', 'free_wrestling']).fullPath().sort().get();

// Get the translation of activity 'cost_guard' in 'fr-FR' and 'female'
activities.locale('fr-FR').gender('female').one('cost_guard');

Themes

import { Themes } from '@brandandcelebrities/activities-themes';
const themes = new Themes();

Methods & Usage

All methods can be chained to reduce the dictionary. Once the dictionary is reduced enough, you can use: .get() to get the keys and translations, .one(id) to get the translation, .keys() to get all keys only, .getAsSelectValues() to get an array of pair { value, label } to use in Select component

themes.locale('fr-FR'); 	// => Filter themes translations by locale

themes.exclude(['animals', 'mode_accessories']);	// => Exclude the ids from the dictionary

themes.onlyInclude(['animals', 'mode_accessories']);	// => Only include the provided ids in dictionary

themes.sort();	// => Sort translations alphabetically


/* --- Examples --- */
// Get all themes in locale 'fr-FR' sorted alphabetically
themes.locale('fr-FR').sort().get();

// Get all themes, without some ids, in 'fr-FR', sorted
themes.locale('fr-FR').exclude(['animals', 'mode_accessories']).sort().get();

// Get the translation of theme 'food_drinks' in 'en-GB'
themes.locale('en-GB').one('food_drinks');

Release Notes

  • 2019-09-17 2.2.4 * Add transaltions for unicorn
  • 2019-06-17 2.2.3 * Move activity 'politics' into the new special activity unicorn
  • 2019-06-04 2.2.2 Adding new activities: event_or_wedding_planner reality_tv marketing_and_communication tech_and_ai management * Move politics to root category
  • 2018-04-03 2.1.6 Typo correction in EN activity (Football Player) new Method excludeChildren to exclude children of provided id, * Adding new root category other containing politics and licence
  • 2018-02-21 2.1.3 * New method keys()
  • 2018-02-09 2.0.0 * Activities and Themes in fr-FR & en-GB
2.2.5

4 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.6

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago