express-sweet 3.0.2 → 5.0.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +224 -418
  2. package/LICENSE +1 -1
  3. package/README.md +211 -1026
  4. package/dist/build.cjs +37 -72
  5. package/dist/build.mjs +37 -72
  6. package/package.json +50 -64
  7. package/screenshots/avatar.png +0 -0
  8. package/screenshots/edit-profile.png +0 -0
  9. package/screenshots/hero-banner.png +0 -0
  10. package/screenshots/home.png +0 -0
  11. package/screenshots/mount-flow.mmd +11 -0
  12. package/screenshots/mount-flow.png +0 -0
  13. package/screenshots/new-person.png +0 -0
  14. package/screenshots/people.png +0 -0
  15. package/screenshots/sign-in.png +0 -0
  16. package/types/database/DatabaseManager.d.ts +15 -10
  17. package/types/database/Model.d.ts +29 -43
  18. package/types/database/index.d.ts +0 -1
  19. package/types/database/loadModels.d.ts +7 -13
  20. package/types/helpers/array.d.ts +21 -0
  21. package/types/helpers/comparison.d.ts +217 -0
  22. package/types/helpers/date.d.ts +20 -0
  23. package/types/helpers/html.d.ts +35 -0
  24. package/types/{handlebars_helpers → helpers}/index.d.ts +0 -2
  25. package/types/helpers/layouts.d.ts +29 -0
  26. package/types/helpers/math.d.ts +85 -0
  27. package/types/helpers/number.d.ts +19 -0
  28. package/types/helpers/object.d.ts +28 -0
  29. package/types/helpers/string.d.ts +45 -0
  30. package/types/index.d.ts +7 -52
  31. package/types/middleware/auth.d.ts +186 -0
  32. package/types/middleware/cors.d.ts +19 -0
  33. package/types/middleware/env.d.ts +24 -0
  34. package/types/middleware/error.d.ts +26 -0
  35. package/types/middleware/globals.d.ts +13 -0
  36. package/types/{middlewares → middleware}/index.d.ts +19 -12
  37. package/types/middleware/locals.d.ts +33 -0
  38. package/types/middleware/parser.d.ts +30 -0
  39. package/types/middleware/router.d.ts +31 -0
  40. package/types/middleware/views.d.ts +37 -0
  41. package/types/mount.d.ts +34 -3
  42. package/types/{interfaces/BasicConfig.d.ts → types/AppConfig.d.ts} +18 -25
  43. package/types/{interfaces → types}/AuthenticationConfig.d.ts +10 -11
  44. package/types/{interfaces → types}/DatabaseConfig.d.ts +1 -1
  45. package/types/{interfaces → types}/LoggingConfig.d.ts +0 -1
  46. package/types/types/UploadConfig.d.ts +72 -0
  47. package/types/{interfaces → types}/ViewConfig.d.ts +1 -2
  48. package/types/{interfaces → types}/index.d.ts +7 -4
  49. package/types/utils/index.d.ts +7 -4
  50. package/types/utils/loadAppConfig.d.ts +17 -0
  51. package/types/utils/loadAuthenticationConfig.d.ts +1 -1
  52. package/types/utils/loadLoggingConfig.d.ts +1 -1
  53. package/types/utils/loadUploadConfig.d.ts +20 -0
  54. package/types/utils/loadViewConfig.d.ts +1 -1
  55. package/configuration_sample/cjs/authentication.js +0 -138
  56. package/configuration_sample/cjs/config.js +0 -91
  57. package/configuration_sample/cjs/database.js +0 -121
  58. package/configuration_sample/cjs/logging.js +0 -41
  59. package/configuration_sample/cjs/view.js +0 -54
  60. package/configuration_sample/esm/authentication.js +0 -136
  61. package/configuration_sample/esm/config.js +0 -91
  62. package/configuration_sample/esm/database.js +0 -121
  63. package/configuration_sample/esm/logging.js +0 -41
  64. package/configuration_sample/esm/view.js +0 -54
  65. package/screencaps/belongs-to-many.png +0 -0
  66. package/screencaps/belongs-to.png +0 -0
  67. package/screencaps/demonstration.webp +0 -0
  68. package/screencaps/has-many.png +0 -0
  69. package/screencaps/has-one.png +0 -0
  70. package/types/handlebars_helpers/array.d.ts +0 -22
  71. package/types/handlebars_helpers/comparison.d.ts +0 -222
  72. package/types/handlebars_helpers/date.d.ts +0 -19
  73. package/types/handlebars_helpers/html.d.ts +0 -31
  74. package/types/handlebars_helpers/layouts.d.ts +0 -25
  75. package/types/handlebars_helpers/math.d.ts +0 -74
  76. package/types/handlebars_helpers/number.d.ts +0 -18
  77. package/types/handlebars_helpers/object.d.ts +0 -21
  78. package/types/handlebars_helpers/string.d.ts +0 -45
  79. package/types/middlewares/Authentication.d.ts +0 -52
  80. package/types/middlewares/CORS.d.ts +0 -30
  81. package/types/middlewares/Environment.d.ts +0 -36
  82. package/types/middlewares/ErrorHandler.d.ts +0 -34
  83. package/types/middlewares/Global.d.ts +0 -27
  84. package/types/middlewares/Http.d.ts +0 -29
  85. package/types/middlewares/Local.d.ts +0 -42
  86. package/types/middlewares/View.d.ts +0 -49
  87. package/types/routing/Router.d.ts +0 -56
  88. package/types/routing/index.d.ts +0 -37
  89. package/types/services/Authentication.d.ts +0 -95
  90. package/types/services/index.d.ts +0 -33
  91. package/types/types/global.d.ts +0 -38
  92. package/types/utils/Types.d.ts +0 -23
  93. package/types/utils/loadBasicConfig.d.ts +0 -17
@@ -1,41 +0,0 @@
1
- /**
2
- * Logging configuration interface.
3
- */
4
- module.exports = {
5
- /**
6
- * Morgan logging format. Common formats: 'combined', 'common', 'dev', 'short', 'tiny'
7
- * You can also define custom format string, defaults to 'combined'.
8
- * @type {string}
9
- * @example
10
- * ```js
11
- * // Use predefined format
12
- * format: 'combined',
13
- *
14
- * // Use custom format
15
- * format: ':method :url :status :res[content-length] - :response-time ms',
16
- * ```
17
- */
18
- format: 'combined',
19
-
20
- /**
21
- * Function to determine if logging should be skipped for a request.
22
- * Return true to skip logging, false to log the request, defaults to none (undefined).
23
- * @type {(req: express.Request, res: express.Response) => boolean}
24
- * @example
25
- * ```js
26
- * // Skip logging for successful requests
27
- * skip: (req, res) => res.statusCode < 400,
28
- *
29
- * // Skip logging for specific routes
30
- * skip: (req, res) => req.path === '/health',
31
- *
32
- * // Skip logging in test environment
33
- * skip: (req, res) => process.env.NODE_ENV === 'test',
34
- * ```
35
- */
36
- skip: (req, res) => {
37
- // Example: Skip logging for health check endpoints
38
- // In actual implementation, customize based on your requirements
39
- return req.path === '/health';
40
- }
41
- }
@@ -1,54 +0,0 @@
1
- const path = require('path');
2
-
3
- /**
4
- * View's configuration interface.
5
- */
6
- module.exports = {
7
- /**
8
- * Absolute path to the directory where the view files are located, defaults to `<application root directory>/views`.
9
- * @type {string}
10
- */
11
- views_dir: path.join(process.cwd(), 'views'),
12
-
13
- /**
14
- * Path to partials templates, one or several directories, defaults to `<application root directory>/views/partials`.
15
- * @type {string|string[]}
16
- */
17
- partials_dir: path.join(process.cwd(), 'views/partials'),
18
-
19
- /**
20
- * Path to layout templates, defaults to `<application root directory>/views/layout`.
21
- * @type {string}
22
- */
23
- layouts_dir: path.join(process.cwd(), 'views/layout'),
24
-
25
- /**
26
- * Absolute path to default layout template. defaults to `<application root directory>/views/layout/default.hbs`.
27
- * @type {string}
28
- */
29
- default_layout: path.join(process.cwd(), 'views/layout/default.hbs'),
30
-
31
- /**
32
- * Extension for templates & partials, defaults to `.hbs`,
33
- * @type {string}
34
- */
35
- extension: '.hbs',
36
-
37
- /**
38
- * Hook function just before the view is rendered.
39
- * For example, you can set your own local variables that can be used within the view.
40
- * @type {(res: express.Response) => Promise<void>|void}
41
- * @example
42
- * ```js
43
- * // The message set here can be referenced in the view as {{message}}.
44
- * beforeRender: (req, res) => {
45
- * res.locals.extra = 'Extra';
46
- * }
47
- * ```
48
- */
49
- beforeRender: (req, res) => {
50
- // Example: Set local variables that can be used in templates
51
- // In actual implementation, set the variables you need in your views
52
- res.locals.message = 'Hello World';
53
- }
54
- }
@@ -1,136 +0,0 @@
1
- // import UserModel from '../models/UserModel.js';
2
-
3
- /**
4
- * User authentication configuration interface.
5
- */
6
- export default {
7
- /**
8
- * Enable user authentication, defaults to disabled (false).
9
- * @type {boolean}
10
- */
11
- enabled: true,
12
-
13
- /**
14
- * The session store instance, defaults to a new MemoryStore(memory) instance.
15
- * @type {'memory|redis'}
16
- */
17
- session_store: 'memory',
18
-
19
- /**
20
- * The name of the session ID cookie to set in the response (and read from in the request).
21
- * The default value is 'connect.sid'.
22
- * @type {string|undefined}
23
- */
24
- cookie_name: 'connect.sid',
25
-
26
- /**
27
- * Specifies the boolean value for the Secure Set-Cookie attribute.
28
- * The default is true, which sets the Secure attribute on the cookie.
29
- * @type {boolean|undefined}
30
- */
31
- cookie_secure: false,
32
-
33
- /**
34
- * Specifies the boolean value for the HttpOnly Set-Cookie attribute.
35
- * Defaults to true, which sets the HttpOnly attribute on the cookie.
36
- * @type {boolean|undefined}
37
- */
38
- cookie_httpOnly: true,
39
-
40
- /**
41
- * If the session is stored in "redis", this field is required and should be set to the hostname of the Redis server.
42
- * For example, to connect to redis on localhost on port 6379, set "redis://localhost:6379".
43
- * To connect to a different host or port, use a connection string in the format "redis[s]://[[username][:password]@][host][:port][/db-number]".
44
- * For example, "redis://alice:foobared@awesome.redis.server:6380".
45
- * @type {string|undefined}
46
- */
47
- redis_host: undefined,
48
-
49
- /**
50
- * Authentication user ID field name, defaults to `username`.
51
- * @type {string}
52
- */
53
- username: 'email',
54
-
55
- /**
56
- * Authentication password field name, defaults to `password`.
57
- * @type {string}
58
- */
59
- password: 'password',
60
-
61
- /**
62
- * URL to redirect after successful authentication, defaults to `/`.
63
- * @type {string}
64
- */
65
- success_redirect: '/',
66
-
67
- /**
68
- * URL to redirect after log off, defaults to `/login`.
69
- * @type {string|((req: express.Request, res: express.Response) => string)}
70
- * @example
71
- * // Set the URL to redirect to in case of login failure as a string.
72
- * failure_redirect: '/login',
73
- *
74
- * // Dynamically set the url to redirect to on login failure.
75
- * failure_redirect: (req, res) => {
76
- * // If the role stored in the cookie is admin, redirect to the admin login screen.
77
- * return req.cookies.role === 'admin' ? '/adminlogin' : 'login';
78
- * },
79
- */
80
- failure_redirect: '/login',
81
-
82
- /**
83
- * This hook is called when authenticating a user.
84
- * Please find the user information that owns the credentials based on the user name and password you received and return it.
85
- * If the user who owns the credentials cannot be found, return null.
86
- *
87
- * Note that the user information must include an ID value that can identify the user.
88
- *
89
- * @type {(username: string, password: string, req: express.Request) => Promise<{[key: string]: any}|null>}
90
- */
91
- authenticate_user: async (username, password, req) => {
92
- // Sample hardcoded return for demonstration purposes.
93
- // In actual implementation, retrieve user information from database.
94
- // For example, using UserModel: UserModel.findOne({ where: { email: username, password }, raw: true });
95
- return {
96
- id: 1,
97
- email: 'user@example.com',
98
- name: 'Sample User'
99
- };
100
- },
101
-
102
- /**
103
- * This hook is called when user authentication is successful.
104
- * Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.
105
- * The returned data will be set in the req.user property and the view's session variable.
106
- *
107
- * @type {(id: number|string) => Promise<{[key: string]: any}>}
108
- */
109
- subscribe_user: async (id) => {
110
- // Sample hardcoded return for demonstration purposes.
111
- // In actual implementation, retrieve user information from database.
112
- // For example, using UserModel: UserModel.findOne({ where: { id }, raw: true });
113
- return {
114
- id: 1,
115
- email: 'user@example.com',
116
- name: 'Sample User',
117
- role: 'user'
118
- };
119
- },
120
-
121
- /**
122
- * URL without authentication. If the URL described in the access URL partially matches, authentication will not be performed, defaults to none.
123
- * @type {(string|RegExp)[]}
124
- */
125
- allow_unauthenticated: [
126
- // Example: Allow login endpoint to bypass authentication
127
- // In actual implementation, specify the endpoints you want to exclude from authentication
128
- '/api/login'
129
- ],
130
-
131
- /**
132
- * Authenticated user session expiration, defaults to 24 hours (24 * 3600000).
133
- * @type {number}
134
- */
135
- expiration: 24 * 3600000,
136
- }
@@ -1,91 +0,0 @@
1
- import path from 'node:path';
2
-
3
- /**
4
- * EXPRESS SWEET basic configuration interface.
5
- */
6
- export default {
7
- /**
8
- * Environment variable file (.env) path, defaults to none (undefined).
9
- * @type {string}
10
- */
11
- env_path: '.env',
12
-
13
- /**
14
- * CORS permission, defaults to invalid (false).
15
- * @type {{enabled: boolean}}
16
- */
17
- cors_enabled: true,
18
-
19
- /**
20
- * Maximum body size you can request, defaults to `100kb`.
21
- * @type {string|number}
22
- */
23
- max_body_size: '100mb',
24
-
25
- /**
26
- * Absolute path to the router directory, defaults to `<application root directory>/routes`.
27
- * @type {string}
28
- */
29
- router_dir: path.join(process.cwd(), 'routes'),
30
-
31
- /**
32
- * The endpoint to run when the root URL is requested, defaults to none (undefined).
33
- * @type {string}
34
- */
35
- default_router: '/home',
36
-
37
- /**
38
- * This is a hook that rewrites the base URL.
39
- * If you want to rewrite the app.locals.baseUrl property and the view's baseUrl variable, use this hook to return a new base URL.
40
- * The default value is the referrer's origin (eg https://example.com).
41
- * @type {(baseUrl: string): string}
42
- * @example
43
- * ```js
44
- * rewrite_base_url: baseUrl => {
45
- * return `${baseUrl}/admin`;
46
- * }
47
- * ```
48
- */
49
- rewrite_base_url: baseUrl => {
50
- return baseUrl;
51
- },
52
-
53
- /**
54
- * How to determine if it is an ajax request.
55
- * The default is that if there is an XMLHttpRequest in the request header (req.xhr) returns true.
56
- * For example, if there is no XMLHttpRequest in req(express.Request) and the Ajax endpoint starts with /api, a custom Ajax decision can be made like "return /^\/api\//.test(req.path)".
57
- * @type {(req: express.Request) => boolean}
58
- * @example
59
- * ```js
60
- * is_ajax: req => {
61
- * // If the request URL begins with /api, it is assumed to be Ajax.
62
- * return /^\/api/.test(req.path);
63
- * // return !!req.xhr;
64
- * }
65
- * ```
66
- */
67
- is_ajax: req => !!req.xhr,
68
-
69
- /**
70
- * Hooks the default behavior on request errors.
71
- * If unset, simply returns an error HTTP status. (<code>res.status(error.status||500).end();</code>)
72
- * @type {(error: any, req: express.Request, res: express.Response, next: express.NextFunction) => void}
73
- * @example
74
- * ```js
75
- * hook_handle_error: (error, req, res, next) => {
76
- * if (error.status === 404)
77
- * // If the URL cannot be found, a 404 error screen (views/errors/404.hbs) is displayed.
78
- * res.render('errors/404');
79
- * else
80
- * // For other errors, unknown error screen (views/error/500.hbs) is displayed.
81
- * res.render('error/500');
82
- * },
83
- * ```
84
- */
85
- hook_handle_error: (error, req, res, next) => {
86
- if (error.status === 404)
87
- res.status(404).render('errors/404', {isErrorPage: true});
88
- else
89
- res.status(500).render('errors/500', {isErrorPage: true});
90
- },
91
- }
@@ -1,121 +0,0 @@
1
- /**
2
- * Sequelize Database Configuration
3
- *
4
- * @description Database connection settings for different environments
5
- * Includes connection pool configuration for each environment
6
- *
7
- * @example
8
- * // Connection pool configuration examples
9
- * // The max value must be set appropriately according to the DB's max_connections
10
- *
11
- * // How to check max_connections in MariaDB:
12
- * // SHOW VARIABLES LIKE 'max_connections';
13
- * // +-----------------+-------+
14
- * // | Variable_name | Value |
15
- * // +-----------------+-------+
16
- * // | max_connections | 151 |
17
- * // +-----------------+-------+
18
- *
19
- * // Configuration example when max_connections=151:
20
- * pool: {
21
- * // Maximum 100 connections (66.2% usage of max_connections=151)
22
- * // Keep total connections from all instances within 70-80% of max_connections
23
- * max: 100,
24
- * // Maintain 10 connections constantly (ensures stability during load increases)
25
- * min: 10,
26
- * // 10 second timeout for connection acquisition
27
- * acquire: 10000,
28
- * // Mark for deletion after 3 seconds of inactivity
29
- * idle: 3000,
30
- * // Check for idle connections every 10 seconds
31
- * evict: 10000
32
- * }
33
- *
34
- * // Configuration example when max_connections=5297:
35
- * pool: {
36
- * // Maximum 300 connections per instance (6 instances peak = 1800 connections = 34.0% usage)
37
- * // Distribute connections across multiple instances while staying within safe limits
38
- * max: 300,
39
- * // Maintain 30 connections constantly (ensures stability during high load)
40
- * min: 30,
41
- * // 30 second timeout for connection acquisition
42
- * acquire: 30000,
43
- * // Mark for deletion after 10 seconds of inactivity
44
- * idle: 10000,
45
- * // Check for idle connections every 30 seconds
46
- * evict: 30000
47
- * }
48
- */
49
- export default {
50
- // Development environment configuration
51
- development: {
52
- username: 'root',
53
- password: 'password',
54
- database: 'sample_db',
55
- host: 'localhost',
56
- port: undefined,
57
- dialect: 'mariadb',
58
- timezone: '+09:00',
59
- logging: false,
60
- // pool: {
61
- // // Maximum connections (adjust based on your DB's max_connections)
62
- // max: 100,
63
- // // Maintain minimum connections constantly
64
- // min: 10,
65
- // // Connection acquisition timeout
66
- // acquire: 10000,
67
- // // Mark for deletion after inactivity
68
- // idle: 2000,
69
- // // Check for idle connections interval
70
- // evict: 10000
71
- // }
72
- },
73
-
74
- // Test environment configuration
75
- test: {
76
- username: 'root',
77
- password: 'password',
78
- database: 'sample_db',
79
- host: 'localhost',
80
- port: undefined,
81
- dialect: 'mariadb',
82
- timezone: '+09:00',
83
- logging: false,
84
- // pool: {
85
- // // Maximum connections (adjust based on your DB's max_connections)
86
- // max: 100,
87
- // // Maintain minimum connections constantly
88
- // min: 10,
89
- // // Connection acquisition timeout
90
- // acquire: 10000,
91
- // // Mark for deletion after inactivity
92
- // idle: 3000,
93
- // // Check for idle connections interval
94
- // evict: 10000
95
- // }
96
- },
97
-
98
- // Production environment configuration
99
- production: {
100
- username: 'root',
101
- password: 'password',
102
- database: 'sample_db',
103
- host: 'localhost',
104
- port: undefined,
105
- dialect: 'mariadb',
106
- timezone: '+09:00',
107
- logging: false,
108
- // pool: {
109
- // // Maximum connections (adjust based on your DB's max_connections and instance count)
110
- // max: 300,
111
- // // Maintain minimum connections constantly
112
- // min: 30,
113
- // // Connection acquisition timeout
114
- // acquire: 30000,
115
- // // Mark for deletion after inactivity
116
- // idle: 10000,
117
- // // Check for idle connections interval
118
- // evict: 30000
119
- // }
120
- }
121
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Logging configuration interface.
3
- */
4
- export default {
5
- /**
6
- * Morgan logging format. Common formats: 'combined', 'common', 'dev', 'short', 'tiny'
7
- * You can also define custom format string, defaults to 'combined'.
8
- * @type {string}
9
- * @example
10
- * ```js
11
- * // Use predefined format
12
- * format: 'combined',
13
- *
14
- * // Use custom format
15
- * format: ':method :url :status :res[content-length] - :response-time ms',
16
- * ```
17
- */
18
- format: 'combined',
19
-
20
- /**
21
- * Function to determine if logging should be skipped for a request.
22
- * Return true to skip logging, false to log the request, defaults to none (undefined).
23
- * @type {(req: express.Request, res: express.Response) => boolean}
24
- * @example
25
- * ```js
26
- * // Skip logging for successful requests
27
- * skip: (req, res) => res.statusCode < 400,
28
- *
29
- * // Skip logging for specific routes
30
- * skip: (req, res) => req.path === '/health',
31
- *
32
- * // Skip logging in test environment
33
- * skip: (req, res) => process.env.NODE_ENV === 'test',
34
- * ```
35
- */
36
- skip: (req, res) => {
37
- // Example: Skip logging for health check endpoints
38
- // In actual implementation, customize based on your requirements
39
- return req.path === '/health';
40
- }
41
- }
@@ -1,54 +0,0 @@
1
- import path from 'node:path';
2
-
3
- /**
4
- * View's configuration interface.
5
- */
6
- export default {
7
- /**
8
- * Absolute path to the directory where the view files are located, defaults to `<application root directory>/views`.
9
- * @type {string}
10
- */
11
- views_dir: path.join(process.cwd(), 'views'),
12
-
13
- /**
14
- * Path to partials templates, one or several directories, defaults to `<application root directory>/views/partials`.
15
- * @type {string|string[]}
16
- */
17
- partials_dir: path.join(process.cwd(), 'views/partials'),
18
-
19
- /**
20
- * Path to layout templates, defaults to `<application root directory>/views/layout`.
21
- * @type {string}
22
- */
23
- layouts_dir: path.join(process.cwd(), 'views/layout'),
24
-
25
- /**
26
- * Absolute path to default layout template. defaults to `<application root directory>/views/layout/default.hbs`.
27
- * @type {string}
28
- */
29
- default_layout: path.join(process.cwd(), 'views/layout/default.hbs'),
30
-
31
- /**
32
- * Extension for templates & partials, defaults to `.hbs`,
33
- * @type {string}
34
- */
35
- extension: '.hbs',
36
-
37
- /**
38
- * Hook function just before the view is rendered.
39
- * For example, you can set your own local variables that can be used within the view.
40
- * @type {(res: express.Response) => Promise<void>|void}
41
- * @example
42
- * ```js
43
- * // The message set here can be referenced in the view as {{message}}.
44
- * beforeRender: (req, res) => {
45
- * res.locals.extra = 'Extra';
46
- * }
47
- * ```
48
- */
49
- beforeRender: (req, res) => {
50
- // Example: Set local variables that can be used in templates
51
- // In actual implementation, set the variables you need in your views
52
- res.locals.message = 'Hello World';
53
- }
54
- }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,22 +0,0 @@
1
- /**
2
- * Finds an object in an array based on the specified field name and value.
3
- * @param {Array<{[key: string]: any}>} array The array of objects to search.
4
- * @param {string} fieldName The name of the field to search.
5
- * @param {*} fieldValue The value to search for.
6
- * @returns {object|null} The first object in the array that matches the criteria, or null if no match is found.
7
- * @example
8
- * ```handlebars
9
- * {{!--
10
- * items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
11
- * This code will output: "Item A"
12
- * --}}
13
- * {{#each items}}
14
- * {{#if (eq id 123)}}
15
- * {{lookup (findObjectInArray ../items 'id' id) 'name'}}
16
- * {{/if}}
17
- * {{/each}}
18
- * ```
19
- */
20
- export declare const findObjectInArray: (array: Array<{
21
- [key: string]: any;
22
- }>, fieldName: string, fieldValue: any) => object | null;