@autobusal/utilities 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/form.tsx CHANGED
@@ -10,7 +10,7 @@ interface ValidateType {
10
10
  min?: any
11
11
  }
12
12
 
13
- export const validate = (rules: string, t: TFunction<'common'>) => {
13
+ export const validate = (rules: string, t: TFunction<'common'>): ValidateType => {
14
14
  const analyze = rules.split('|');
15
15
 
16
16
  let validation: ValidateType = {};
package/index.ts CHANGED
@@ -2,6 +2,7 @@ import { createDate, prepareDate, getFormattedShort, differenceYears, futureDate
2
2
  import { validate, display } from './form';
3
3
  import getPosition from './map';
4
4
  import { error, notify, success } from './notify';
5
+ import { getSex, getOptionsSex } from './passengers';
5
6
 
6
7
  export {
7
8
  validate,
@@ -14,5 +15,7 @@ export {
14
15
  prepareDate,
15
16
  getFormattedShort,
16
17
  differenceYears,
17
- futureDate
18
+ futureDate,
19
+ getSex,
20
+ getOptionsSex
18
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/utilities",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }
package/passengers.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { TFunction } from 'i18next';
2
+
3
+ export const getSex = (value: number): string => (
4
+ value === 1 ? 'female' : 'male'
5
+ );
6
+
7
+ export const getOptionsSex = (t: TFunction<'common'>) => ([
8
+ {
9
+ id: 0,
10
+ name: t('data.gender.male', { ns: 'common' })
11
+ }, {
12
+ id: 1,
13
+ name: t('data.gender.female', { ns: 'common' })
14
+ }
15
+ ]);