@mapomodule/utils 1.0.0-alpha.15 → 1.0.0-alpha.22

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.22](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-05-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * big code refactor and improovements to fields management ([a818d8b](https://github.com/lotrekagency/mapo/commit/a818d8b891dbb4892f50267d6355c41297e2c6c6))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
7
18
 
8
19
 
@@ -20,8 +20,33 @@ function humanFileSize(bytes, si = false, dp = 1) {
20
20
  );
21
21
 
22
22
  return bytes.toFixed(dp) + " " + units[u];
23
- }
23
+ };
24
+
25
+ function slugify(str) {
26
+ str = str || "";
27
+ str = str.replace(/^\s+|\s+$/g, ''); // trim
28
+ str = str.toLowerCase();
29
+
30
+ // remove accents, swap ñ for n, etc
31
+ var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
32
+ var to = "aaaaeeeeiiiioooouuuunc------";
33
+ for (var i = 0, l = from.length; i < l; i++) {
34
+ str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
35
+ }
36
+
37
+ str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
38
+ .replace(/\s+/g, '-') // collapse whitespace and replace by -
39
+ .replace(/-+/g, '-'); // collapse dashes
40
+
41
+ return str;
42
+ };
43
+
44
+ function titleCase(string) {
45
+ return (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) || "";
46
+ };
24
47
 
25
48
  module.exports = {
26
- humanFileSize
49
+ humanFileSize,
50
+ slugify,
51
+ titleCase,
27
52
  }
@@ -0,0 +1,9 @@
1
+ function nameSpacedSlots(slots, scope) {
2
+ return Object.keys(slots)
3
+ .filter((name) => name.startsWith(scope))
4
+ .map((name) => name.replace(scope, ""));
5
+ }
6
+
7
+ module.exports = {
8
+ nameSpacedSlots
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/utils",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.22",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -12,5 +12,5 @@
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
- "gitHead": "cd42b3dd094ef3bf743c67819e6059bf9ccac491"
15
+ "gitHead": "49f5a6c1ed148cfdaf80a6b610ffc4233aa177cb"
16
16
  }