npm-pkg-hook 1.6.3 → 1.6.5
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
CHANGED
|
@@ -19,6 +19,14 @@ export const useCreateDeliveryTime = ({
|
|
|
19
19
|
|
|
20
20
|
const createDeliveryTime = async (minutes) => {
|
|
21
21
|
try {
|
|
22
|
+
if (!minutes) {
|
|
23
|
+
sendNotification({
|
|
24
|
+
backgroundColor: 'error',
|
|
25
|
+
title: 'Error',
|
|
26
|
+
description: 'The delivery time is required.'
|
|
27
|
+
})
|
|
28
|
+
return
|
|
29
|
+
}
|
|
22
30
|
const { data } = await createDeliveryTimeMutation({
|
|
23
31
|
variables: { minutes: parseInt(minutes) }
|
|
24
32
|
})
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Busca un objeto dentro de un conjunto de columnas por su código de referencia.
|
|
3
|
+
* @param {Object} data - El objeto que contiene las columnas.
|
|
4
|
+
* @param {string} pCodeRef - El código de referencia a buscar.
|
|
5
|
+
* @returns {Object|null} - El objeto encontrado o null si no se encuentra.
|
|
6
|
+
*/
|
|
7
|
+
export function findOrderByCodeRef (data, pCodeRef) {
|
|
8
|
+
if (!data || typeof data !== 'object') {
|
|
9
|
+
throw new Error('El parámetro "data" debe ser un objeto no nulo.')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (typeof pCodeRef !== 'string') {
|
|
13
|
+
throw new Error('El parámetro "pCodeRef" debe ser una cadena de texto.')
|
|
14
|
+
}
|
|
15
|
+
|
|
2
16
|
// Iterar sobre cada columna en el objeto data
|
|
3
|
-
for (const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
for (const columnKey in data) {
|
|
18
|
+
if (Object.hasOwnProperty.call(data, columnKey)) {
|
|
19
|
+
const column = data[columnKey]
|
|
20
|
+
// Verificar si la columna es un array
|
|
21
|
+
if (Array.isArray(column)) {
|
|
22
|
+
// Buscar el objeto por pCodeRef dentro de la columna actual
|
|
23
|
+
const foundOrder = column.find(
|
|
24
|
+
(order) => order && order.pCodeRef === pCodeRef
|
|
25
|
+
)
|
|
26
|
+
// Si se encuentra el objeto, devolverlo
|
|
27
|
+
if (foundOrder) {
|
|
28
|
+
return foundOrder
|
|
29
|
+
}
|
|
30
|
+
}
|
|
9
31
|
}
|
|
10
32
|
}
|
|
11
33
|
// Si no se encuentra el objeto en ninguna columna, devolver null
|