@tewtawanc/loops-utils 1.0.2 → 1.0.3

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/dist/index.d.mts CHANGED
@@ -33,7 +33,7 @@ interface StockSkuParams extends InventorySkuParams {
33
33
  * Normalize SKU component to ensure valid SKU string:
34
34
  * - Trims whitespace from both ends
35
35
  * - Converts to uppercase for consistency
36
- * - Replaces spaces with underscores
36
+ * - Replaces spaces and hyphens with underscores (for consistent word separation)
37
37
  * - Removes special characters except / (for codes like C/P) and _ (word separator)
38
38
  * - Removes consecutive underscores
39
39
  * - Removes leading/trailing underscores
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ interface StockSkuParams extends InventorySkuParams {
33
33
  * Normalize SKU component to ensure valid SKU string:
34
34
  * - Trims whitespace from both ends
35
35
  * - Converts to uppercase for consistency
36
- * - Replaces spaces with underscores
36
+ * - Replaces spaces and hyphens with underscores (for consistent word separation)
37
37
  * - Removes special characters except / (for codes like C/P) and _ (word separator)
38
38
  * - Removes consecutive underscores
39
39
  * - Removes leading/trailing underscores
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ __export(index_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
36
  function normalizeSkuComponent(component) {
37
- return component.trim().toUpperCase().replace(/\s+/g, "_").replace(/[^A-Z0-9/_]/g, "").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
37
+ return component.trim().toUpperCase().replace(/[\s-]+/g, "_").replace(/[^A-Z0-9/_]/g, "").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
38
38
  }
39
39
  function formatWeight(weight) {
40
40
  if (Number.isInteger(weight)) {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
2
  function normalizeSkuComponent(component) {
3
- return component.trim().toUpperCase().replace(/\s+/g, "_").replace(/[^A-Z0-9/_]/g, "").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
3
+ return component.trim().toUpperCase().replace(/[\s-]+/g, "_").replace(/[^A-Z0-9/_]/g, "").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
4
4
  }
5
5
  function formatWeight(weight) {
6
6
  if (Number.isInteger(weight)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tewtawanc/loops-utils",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Shared utilities for Loops warehouse management system",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",