@webalternatif/js-core 1.0.0 → 1.1.1
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/package.json +14 -3
- package/.babelrc +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -12
- package/.idea/js-core.iml +0 -8
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -20
- package/.idea/vcs.xml +0 -6
- package/i18n/agenda/en.js +0 -73
- package/i18n/agenda/fr.js +0 -73
- package/i18n/agenda/index.js +0 -2
- package/i18n/ajaxform/en.js +0 -5
- package/i18n/ajaxform/fr.js +0 -5
- package/i18n/ajaxform/index.js +0 -2
- package/i18n/ajaxupload/en.js +0 -12
- package/i18n/ajaxupload/fr.js +0 -12
- package/i18n/ajaxupload/index.js +0 -2
- package/i18n/autocomplete/en.js +0 -3
- package/i18n/autocomplete/fr.js +0 -3
- package/i18n/autocomplete/index.js +0 -2
- package/i18n/confirm/en.js +0 -5
- package/i18n/confirm/fr.js +0 -5
- package/i18n/confirm/index.js +0 -2
- package/i18n/core/en.js +0 -4
- package/i18n/core/fr.js +0 -4
- package/i18n/core/index.js +0 -2
- package/i18n/datagrid/en.js +0 -8
- package/i18n/datagrid/fr.js +0 -8
- package/i18n/datagrid/index.js +0 -2
- package/i18n/date/en.js +0 -51
- package/i18n/date/fr.js +0 -51
- package/i18n/date/index.js +0 -2
- package/i18n/datetimepicker/en.js +0 -30
- package/i18n/datetimepicker/fr.js +0 -30
- package/i18n/datetimepicker/index.js +0 -2
- package/i18n/dialog/en.js +0 -3
- package/i18n/dialog/fr.js +0 -3
- package/i18n/dialog/index.js +0 -2
- package/i18n/fulldayeventagenda/en.js +0 -73
- package/i18n/fulldayeventagenda/fr.js +0 -73
- package/i18n/fulldayeventagenda/index.js +0 -2
- package/i18n/index.d.ts +0 -4
- package/i18n/index.js +0 -15
- package/i18n/richtexteditor/en.js +0 -58
- package/i18n/richtexteditor/fr.js +0 -58
- package/i18n/richtexteditor/index.js +0 -2
- package/i18n/select/en.js +0 -3
- package/i18n/select/fr.js +0 -3
- package/i18n/select/index.js +0 -2
- package/i18n/timepicker/en.js +0 -3
- package/i18n/timepicker/fr.js +0 -3
- package/i18n/timepicker/index.js +0 -2
- package/i18n/useragenda/en.js +0 -74
- package/i18n/useragenda/fr.js +0 -73
- package/i18n/useragenda/index.js +0 -2
- package/jest.config.js +0 -14
- package/src/array.js +0 -124
- package/src/dom.js +0 -569
- package/src/eventDispatcher.js +0 -118
- package/src/i18n.js +0 -55
- package/src/index.js +0 -33
- package/src/is.js +0 -89
- package/src/math.js +0 -109
- package/src/random.js +0 -40
- package/src/string.js +0 -576
- package/src/stringPrototype.js +0 -15
- package/src/traversal.js +0 -134
- package/src/utils.js +0 -130
- package/tests/array.test.js +0 -326
- package/tests/dom.test.js +0 -239
- package/tests/eventdispatcher.test.js +0 -177
- package/tests/i18n.test.js +0 -132
- package/tests/index.test.js +0 -29
- package/tests/is.test.js +0 -354
- package/tests/math.test.js +0 -221
- package/tests/random.test.js +0 -72
- package/tests/string.test.js +0 -1106
- package/tests/traversal.test.js +0 -517
- package/tests/utils.test.js +0 -371
- package/tsconfig.json +0 -16
- package/webpack.config.cjs +0 -31
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
'pick a date': 'Choisir une date',
|
|
3
|
-
|
|
4
|
-
monday: 'Lundi',
|
|
5
|
-
tuesday: 'Mardi',
|
|
6
|
-
wednesday: 'Mercredi',
|
|
7
|
-
thursday: 'Jeudi',
|
|
8
|
-
friday: 'Vendredi',
|
|
9
|
-
saturday: 'Samedi',
|
|
10
|
-
sunday: 'Dimanche',
|
|
11
|
-
|
|
12
|
-
mon: 'Lun',
|
|
13
|
-
tue: 'Mar',
|
|
14
|
-
wed: 'Mer',
|
|
15
|
-
thu: 'Jeu',
|
|
16
|
-
fri: 'Ven',
|
|
17
|
-
sat: 'Sam',
|
|
18
|
-
sun: 'Dim',
|
|
19
|
-
|
|
20
|
-
mo: 'Lu',
|
|
21
|
-
tu: 'Ma',
|
|
22
|
-
we: 'Me',
|
|
23
|
-
th: 'Je',
|
|
24
|
-
fr: 'Ve',
|
|
25
|
-
sa: 'Sa',
|
|
26
|
-
su: 'Di',
|
|
27
|
-
|
|
28
|
-
january: 'Janvier',
|
|
29
|
-
february: 'Février',
|
|
30
|
-
march: 'Mars',
|
|
31
|
-
april: 'Avril',
|
|
32
|
-
may: 'Mai',
|
|
33
|
-
june: 'Juin',
|
|
34
|
-
july: 'Juillet',
|
|
35
|
-
august: 'Août',
|
|
36
|
-
september: 'Septembre',
|
|
37
|
-
october: 'Octobre',
|
|
38
|
-
november: 'Novembre',
|
|
39
|
-
december: 'Décembre',
|
|
40
|
-
|
|
41
|
-
jan: 'Janv.',
|
|
42
|
-
feb: 'Fév.',
|
|
43
|
-
mar: 'Mars',
|
|
44
|
-
apr: 'Avr.',
|
|
45
|
-
'may.': 'Mai',
|
|
46
|
-
jun: 'Juin',
|
|
47
|
-
'jul.': 'Juil.',
|
|
48
|
-
aug: 'Août',
|
|
49
|
-
sept: 'Sept.',
|
|
50
|
-
oct: 'Oct.',
|
|
51
|
-
nov: 'Nov.',
|
|
52
|
-
dec: 'Déc.',
|
|
53
|
-
|
|
54
|
-
today: function() { return "Aujourd'hui"; },
|
|
55
|
-
prev_day: 'Jour précédent',
|
|
56
|
-
next_day: 'Jour suivant',
|
|
57
|
-
prev_week: 'Semaine précédente',
|
|
58
|
-
next_week: 'Semaine suivante',
|
|
59
|
-
prev_month: 'Mois précédent',
|
|
60
|
-
next_month: 'Mois suivant',
|
|
61
|
-
week: 'Semaine',
|
|
62
|
-
month: 'Mois',
|
|
63
|
-
day: 'Jour',
|
|
64
|
-
am: 'h',
|
|
65
|
-
pm: 'h',
|
|
66
|
-
|
|
67
|
-
new_event: 'Nouvel événement',
|
|
68
|
-
|
|
69
|
-
date_title_month: 'MMMM yyyy',
|
|
70
|
-
date_title_week: 'd MMMM yyyy',
|
|
71
|
-
date_title_day: 'EEEE d MMMM yyyy',
|
|
72
|
-
date_col_day: '[<div class="nameWeekDay">]E[</div>][<div class="numMonthDay">]d[</div>]'
|
|
73
|
-
}
|
package/i18n/index.d.ts
DELETED
package/i18n/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * as core from './core/index.js'
|
|
2
|
-
export * as agenda from './agenda/index.js'
|
|
3
|
-
export * as ajaxform from './ajaxform/index.js'
|
|
4
|
-
export * as ajaxupload from './ajaxupload/index.js'
|
|
5
|
-
export * as autocomplete from './autocomplete/index.js'
|
|
6
|
-
export * as confirm from './confirm/index.js'
|
|
7
|
-
export * as datagrid from './datagrid/index.js'
|
|
8
|
-
export * as date from './date/index.js'
|
|
9
|
-
export * as datetimepicker from './datetimepicker/index.js'
|
|
10
|
-
export * as dialog from './dialog/index.js'
|
|
11
|
-
export * as fulldayeventagenda from './fulldayeventagenda/index.js'
|
|
12
|
-
export * as richtexteditor from './richtexteditor/index.js'
|
|
13
|
-
export * as select from './select/index.js'
|
|
14
|
-
export * as timepicker from './timepicker/index.js'
|
|
15
|
-
export * as useragenda from './useragenda/index.js'
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
undo: 'Undo',
|
|
3
|
-
redo: 'Redo',
|
|
4
|
-
heading: 'Heading',
|
|
5
|
-
font: 'Font',
|
|
6
|
-
fontsize: 'Font size',
|
|
7
|
-
fontsizepx: 'Font size',
|
|
8
|
-
bold: 'Bold',
|
|
9
|
-
italic: 'Italic',
|
|
10
|
-
underline: 'Underline',
|
|
11
|
-
strikethrough: 'Strikethrough',
|
|
12
|
-
subscript: 'Subscript',
|
|
13
|
-
superscript: 'Superscript',
|
|
14
|
-
text_color: 'Text color',
|
|
15
|
-
backcolor: 'Background text color',
|
|
16
|
-
alignleft: 'Left align',
|
|
17
|
-
aligncenter: 'Centrer',
|
|
18
|
-
alignright: 'Right align',
|
|
19
|
-
alignjustify: 'Justify',
|
|
20
|
-
link: 'Add a link',
|
|
21
|
-
unlink: 'Remove a link',
|
|
22
|
-
insertimage: 'Insert a picture',
|
|
23
|
-
|
|
24
|
-
'add a link': 'Add a link',
|
|
25
|
-
'text of link': 'Text of the link',
|
|
26
|
-
anchor: 'Anchor',
|
|
27
|
-
invalid_url: 'Invalid URL',
|
|
28
|
-
url_link: 'URL of the link',
|
|
29
|
-
open_in_new_tab: 'Ouvrir dans un nouvel onglet',
|
|
30
|
-
|
|
31
|
-
'import': 'import',
|
|
32
|
-
'insert image': 'Insert a picture',
|
|
33
|
-
upload_image: 'Upload a picture',
|
|
34
|
-
from_url: 'import from a URL',
|
|
35
|
-
'drag here': 'Drag an image here.',
|
|
36
|
-
'you can also': 'You can also',
|
|
37
|
-
'select image to import': 'Sélectionner an image to import',
|
|
38
|
-
paste_url_image: 'Paste the URL of the image :',
|
|
39
|
-
overview_image_from_url: 'If the URL is correct, you will see an overview here',
|
|
40
|
-
'no image found': 'No image found at this URL',
|
|
41
|
-
loading: 'Loading...',
|
|
42
|
-
validate: 'Validate',
|
|
43
|
-
cancel: 'Cancel',
|
|
44
|
-
unordered_list: 'Unordered list',
|
|
45
|
-
ordered_list: 'Ordered list',
|
|
46
|
-
indent: 'Indent',
|
|
47
|
-
outdent: 'Outdent',
|
|
48
|
-
hr: 'Horizontal ruler',
|
|
49
|
-
table: 'Table',
|
|
50
|
-
tableProperties: 'Table properties',
|
|
51
|
-
columnSize: 'Column width',
|
|
52
|
-
rowSize: 'Row height',
|
|
53
|
-
verticalAlignment: 'Vertical alignment',
|
|
54
|
-
alignTop: 'Top',
|
|
55
|
-
alignMiddle: 'Middle',
|
|
56
|
-
alignBottom: 'Bottom',
|
|
57
|
-
alignUndefined: 'Undefined'
|
|
58
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
undo: 'Annuler',
|
|
3
|
-
redo: 'Rétablir',
|
|
4
|
-
heading: 'Titre',
|
|
5
|
-
font: 'Police de caractères',
|
|
6
|
-
fontsize: 'Taille',
|
|
7
|
-
fontsizepx: 'Taille',
|
|
8
|
-
bold: 'Gras',
|
|
9
|
-
italic: 'Italique',
|
|
10
|
-
underline: 'Souligné',
|
|
11
|
-
strikethrough: 'Barré',
|
|
12
|
-
subscript: 'Indice',
|
|
13
|
-
superscript: 'Exposant',
|
|
14
|
-
text_color: 'Couleur du texte',
|
|
15
|
-
backcolor: 'Couleur d\'arrière plan du texte',
|
|
16
|
-
alignleft: 'Aligner à gauche',
|
|
17
|
-
aligncenter: 'Centrer',
|
|
18
|
-
alignright: 'Aligner à droite',
|
|
19
|
-
alignjustify: 'Justifer',
|
|
20
|
-
link: 'Ajouter un lien',
|
|
21
|
-
unlink: 'Supprimer un lien',
|
|
22
|
-
insertimage: 'Insérer une image',
|
|
23
|
-
|
|
24
|
-
'add a link': 'Ajouter un lien',
|
|
25
|
-
'text of link': 'Texte du lien',
|
|
26
|
-
anchor: 'Ancre',
|
|
27
|
-
invalid_url: 'L\'URL est invalide',
|
|
28
|
-
url_link: 'URL du lien',
|
|
29
|
-
open_in_new_tab: 'Open in new tab',
|
|
30
|
-
|
|
31
|
-
'import': 'Importer',
|
|
32
|
-
'insert image' : 'Insérer une image',
|
|
33
|
-
upload_image: 'Uploader une image',
|
|
34
|
-
from_url: 'À partir d\'une URL',
|
|
35
|
-
'drag here': 'Faîtes glisser une image ici.',
|
|
36
|
-
'you can also': 'Vous pouvez aussi',
|
|
37
|
-
'select image to import': 'Sélectionner l\'image à importer',
|
|
38
|
-
paste_url_image: 'Coller l\'URL de l\'image ici :',
|
|
39
|
-
overview_image_from_url: 'Si l\'URL est correcte, vous en verrez un aperçu ici',
|
|
40
|
-
'no image found': 'Aucune image trouvée à cette adresse',
|
|
41
|
-
loading: 'Chargement en cours',
|
|
42
|
-
validate: 'Valider',
|
|
43
|
-
cancel: 'Annuler',
|
|
44
|
-
unordered_list: 'Liste non ordonnée',
|
|
45
|
-
ordered_list: 'Liste numérotée',
|
|
46
|
-
indent: 'Incrémenter',
|
|
47
|
-
outdent: 'Décrémenter',
|
|
48
|
-
hr: 'Ligne horizontale',
|
|
49
|
-
table: 'Tableau',
|
|
50
|
-
tableProperties: 'Propriétés du tableau',
|
|
51
|
-
columnSize: 'Largeur de la colonne',
|
|
52
|
-
rowSize: 'Hauteur de la ligne',
|
|
53
|
-
verticalAlignment: 'Alignement vertical',
|
|
54
|
-
alignTop: 'Haut',
|
|
55
|
-
alignMiddle: 'Centré',
|
|
56
|
-
alignBottom: 'Bas',
|
|
57
|
-
alignUndefined: 'Indéfini'
|
|
58
|
-
}
|
package/i18n/select/en.js
DELETED
package/i18n/select/fr.js
DELETED
package/i18n/select/index.js
DELETED
package/i18n/timepicker/en.js
DELETED
package/i18n/timepicker/fr.js
DELETED
package/i18n/timepicker/index.js
DELETED
package/i18n/useragenda/en.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
'pick a date': 'Pick a date',
|
|
3
|
-
|
|
4
|
-
monday: 'Monday',
|
|
5
|
-
tuesday: 'Tuesday',
|
|
6
|
-
wednesday: 'Wednesday',
|
|
7
|
-
thursday: 'Thursday',
|
|
8
|
-
friday: 'Friday',
|
|
9
|
-
saturday: 'Saturday',
|
|
10
|
-
sunday: 'Sunday',
|
|
11
|
-
|
|
12
|
-
mon: 'Mon',
|
|
13
|
-
tue: 'Tue',
|
|
14
|
-
wed: 'Wed',
|
|
15
|
-
thu: 'Thu',
|
|
16
|
-
fri: 'Fri',
|
|
17
|
-
sat: 'Sat',
|
|
18
|
-
sun: 'Sun',
|
|
19
|
-
|
|
20
|
-
mo: 'Mo',
|
|
21
|
-
tu: 'Tu',
|
|
22
|
-
we: 'We',
|
|
23
|
-
th: 'Th',
|
|
24
|
-
fr: 'Fr',
|
|
25
|
-
sa: 'Sa',
|
|
26
|
-
su: 'Su',
|
|
27
|
-
|
|
28
|
-
january: 'January',
|
|
29
|
-
february: 'February',
|
|
30
|
-
march: 'March',
|
|
31
|
-
april: 'April',
|
|
32
|
-
may: 'May',
|
|
33
|
-
june: 'June',
|
|
34
|
-
july: 'July',
|
|
35
|
-
august: 'August',
|
|
36
|
-
september: 'September',
|
|
37
|
-
october: 'October',
|
|
38
|
-
november: 'November',
|
|
39
|
-
december: 'December',
|
|
40
|
-
|
|
41
|
-
jan: 'Jan.',
|
|
42
|
-
feb: 'Feb.',
|
|
43
|
-
mar: 'Mar.',
|
|
44
|
-
apr: 'Apr.',
|
|
45
|
-
'may.': 'May',
|
|
46
|
-
jun: 'Jun.',
|
|
47
|
-
'jul.': 'Jul.',
|
|
48
|
-
aug: 'Aug.',
|
|
49
|
-
sept: 'Sept.',
|
|
50
|
-
oct: 'Oct.',
|
|
51
|
-
nov: 'Nov.',
|
|
52
|
-
dec: 'Dec.',
|
|
53
|
-
|
|
54
|
-
today: 'Today',
|
|
55
|
-
prev_day: 'Previous day',
|
|
56
|
-
next_day: 'Next day',
|
|
57
|
-
prev_week: 'Previous week',
|
|
58
|
-
next_week: 'Next week',
|
|
59
|
-
prev_month: 'Previous month',
|
|
60
|
-
next_month: 'Next month',
|
|
61
|
-
week: 'Week',
|
|
62
|
-
month: 'Month',
|
|
63
|
-
day: 'Day',
|
|
64
|
-
am: 'am',
|
|
65
|
-
pm: 'pm',
|
|
66
|
-
|
|
67
|
-
new_event: 'New event',
|
|
68
|
-
|
|
69
|
-
date_title_month: 'MMMM yyyy',
|
|
70
|
-
date_title_week: 'MMM d yyyy',
|
|
71
|
-
date_title_day: 'EEEE d, MMMM yyyy',
|
|
72
|
-
date_col_day: '[<div class="nameWeekDay">]E[</div>][<div class="numMonthDay">]d[</div>]'
|
|
73
|
-
}
|
|
74
|
-
|
package/i18n/useragenda/fr.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
'pick a date': 'Choisir une date',
|
|
3
|
-
|
|
4
|
-
monday: 'Lundi',
|
|
5
|
-
tuesday: 'Mardi',
|
|
6
|
-
wednesday: 'Mercredi',
|
|
7
|
-
thursday: 'Jeudi',
|
|
8
|
-
friday: 'Vendredi',
|
|
9
|
-
saturday: 'Samedi',
|
|
10
|
-
sunday: 'Dimanche',
|
|
11
|
-
|
|
12
|
-
mon: 'Lun',
|
|
13
|
-
tue: 'Mar',
|
|
14
|
-
wed: 'Mer',
|
|
15
|
-
thu: 'Jeu',
|
|
16
|
-
fri: 'Ven',
|
|
17
|
-
sat: 'Sam',
|
|
18
|
-
sun: 'Dim',
|
|
19
|
-
|
|
20
|
-
mo: 'Lu',
|
|
21
|
-
tu: 'Ma',
|
|
22
|
-
we: 'Me',
|
|
23
|
-
th: 'Je',
|
|
24
|
-
fr: 'Ve',
|
|
25
|
-
sa: 'Sa',
|
|
26
|
-
su: 'Di',
|
|
27
|
-
|
|
28
|
-
january: 'Janvier',
|
|
29
|
-
february: 'Février',
|
|
30
|
-
march: 'Mars',
|
|
31
|
-
april: 'Avril',
|
|
32
|
-
may: 'Mai',
|
|
33
|
-
june: 'Juin',
|
|
34
|
-
july: 'Juillet',
|
|
35
|
-
august: 'Août',
|
|
36
|
-
september: 'Septembre',
|
|
37
|
-
october: 'Octobre',
|
|
38
|
-
november: 'Novembre',
|
|
39
|
-
december: 'Décembre',
|
|
40
|
-
|
|
41
|
-
jan: 'Janv.',
|
|
42
|
-
feb: 'Fév.',
|
|
43
|
-
mar: 'Mars',
|
|
44
|
-
apr: 'Avr.',
|
|
45
|
-
'may.': 'Mai',
|
|
46
|
-
jun: 'Juin',
|
|
47
|
-
'jul.': 'Juil.',
|
|
48
|
-
aug: 'Août',
|
|
49
|
-
sept: 'Sept.',
|
|
50
|
-
oct: 'Oct.',
|
|
51
|
-
nov: 'Nov.',
|
|
52
|
-
dec: 'Déc.',
|
|
53
|
-
|
|
54
|
-
today: function() { return "Aujourd'hui"; },
|
|
55
|
-
prev_day: 'Jour précédent',
|
|
56
|
-
next_day: 'Jour suivant',
|
|
57
|
-
prev_week: 'Semaine précédente',
|
|
58
|
-
next_week: 'Semaine suivante',
|
|
59
|
-
prev_month: 'Mois précédent',
|
|
60
|
-
next_month: 'Mois suivant',
|
|
61
|
-
week: 'Semaine',
|
|
62
|
-
month: 'Mois',
|
|
63
|
-
day: 'Jour',
|
|
64
|
-
am: 'h',
|
|
65
|
-
pm: 'h',
|
|
66
|
-
|
|
67
|
-
new_event: 'Nouvel événement',
|
|
68
|
-
|
|
69
|
-
date_title_month: 'MMMM yyyy',
|
|
70
|
-
date_title_week: 'd MMMM yyyy',
|
|
71
|
-
date_title_day: 'EEEE d MMMM yyyy',
|
|
72
|
-
date_col_day: '[<div class="nameWeekDay">]E[</div>][<div class="numMonthDay">]d[</div>]'
|
|
73
|
-
}
|
package/i18n/useragenda/index.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
testEnvironment: 'jsdom',
|
|
3
|
-
verbose: true,
|
|
4
|
-
collectCoverage: true,
|
|
5
|
-
coverageDirectory: 'coverage',
|
|
6
|
-
moduleFileExtensions: ['js'],
|
|
7
|
-
coverageReporters: ['text-summary', 'html'],
|
|
8
|
-
roots: ['<rootDir>/tests'],
|
|
9
|
-
collectCoverageFrom: [
|
|
10
|
-
'src/**/*.{js,jsx}',
|
|
11
|
-
'!i18n/**',
|
|
12
|
-
'!tests/**/*.js'
|
|
13
|
-
]
|
|
14
|
-
};
|
package/src/array.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {each} from "./traversal.js";
|
|
2
|
-
import {isArray, isInteger, isObject, isString, isUndefined} from "./is.js";
|
|
3
|
-
import {round} from "./math.js";
|
|
4
|
-
import {equals} from "./utils.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Checks if a value exists in an array or an object
|
|
8
|
-
*
|
|
9
|
-
* @param {*} value the searched value
|
|
10
|
-
* @param {Object|Array} arr the array
|
|
11
|
-
* @param {number} [index=0] if provided, search from this index
|
|
12
|
-
* @param {boolean} [strict=false] if true, search is done with strict equality
|
|
13
|
-
* @returns {boolean}
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* inArray(2, [1, 2, 3])
|
|
17
|
-
* // → true
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* inArray({a: 1}, {a: 1, b: 2})
|
|
21
|
-
* // → true
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* inArray(5, [1, 2, 3])
|
|
25
|
-
* // → false
|
|
26
|
-
*/
|
|
27
|
-
export const inArray = function(value, arr, index = 0, strict = false) {
|
|
28
|
-
let ret = false;
|
|
29
|
-
|
|
30
|
-
each(arr, (i, val) => {
|
|
31
|
-
if (i >= index) {
|
|
32
|
-
if (strict) {
|
|
33
|
-
if (val === value) {
|
|
34
|
-
ret = true;
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
if (isObject(value) && isObject(val)) {
|
|
39
|
-
ret = equals(val, value);
|
|
40
|
-
return false;
|
|
41
|
-
} else if (isArray(value) && isObject(val)) {
|
|
42
|
-
ret = compareArray(val, value);
|
|
43
|
-
return false;
|
|
44
|
-
} else if (val == value) {
|
|
45
|
-
ret = true;
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return ret;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const indexOf = function(arr, elt, from = 0) {
|
|
56
|
-
from = from < 0 ? Math.ceil(from) + arr.length : Math.floor(from);
|
|
57
|
-
|
|
58
|
-
for (; from < arr.length; from++) {
|
|
59
|
-
if (from in arr && arr[from] === elt) {
|
|
60
|
-
return from;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return -1;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const compareArray = function(a1, a2) {
|
|
68
|
-
if (a1.length !== a2.length) {
|
|
69
|
-
return false;
|
|
70
|
-
} else {
|
|
71
|
-
for (let i = 0; i < a1.length; i++) {
|
|
72
|
-
if (isArray(a1[i])) {
|
|
73
|
-
if (!isArray(a2[i])) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return compareArray(a1[i], a2[i]);
|
|
78
|
-
} else if (a1[i] !== a2[i]) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const arrayUnique = function(arr) {
|
|
88
|
-
return arr.filter((el, index, arr) => index === indexOf(arr, el));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const array_unique = arrayUnique
|
|
92
|
-
|
|
93
|
-
export const arrayDiff = (array1, array2, strict = false) => {
|
|
94
|
-
return array1.filter(item => !inArray(item, array2, 0, strict))
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export const array_diff = arrayUnique
|
|
98
|
-
|
|
99
|
-
export const range = function(size, startAt = 0, step = 1) {
|
|
100
|
-
size = round(size);
|
|
101
|
-
step = round(step);
|
|
102
|
-
|
|
103
|
-
const rng = [];
|
|
104
|
-
|
|
105
|
-
if (isUndefined(startAt) || size < 1 || step === 0 || size < Math.abs(step)) {
|
|
106
|
-
return rng;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const end = size * step;
|
|
110
|
-
|
|
111
|
-
if (isString(startAt)) {
|
|
112
|
-
startAt = startAt.charCodeAt(0);
|
|
113
|
-
|
|
114
|
-
for (let i = 0; step > 0 ? i < end : i > end; i += step) {
|
|
115
|
-
rng.push(String.fromCharCode(startAt + i));
|
|
116
|
-
}
|
|
117
|
-
} else if (isInteger(startAt)) {
|
|
118
|
-
for (let i = 0; step > 0 ? i < end : i > end; i += step) {
|
|
119
|
-
rng.push(startAt + i);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return rng;
|
|
124
|
-
}
|