@lowdefy/helpers
Lowdefy helper functions
Usage
applyArrayIndices
(arrayIndices: number[], name: string): string
Apply arrayIndices to a object id. Substitutes all instances of $
character in name
with a index from arrayIndices
, until there are no more indices or $
's.
applyArrayIndices([1, 2], 'array.$.subArr.$');
get
(
target: any,
path: string | number,
options?: {
default?: any,
}
): any
Get a value from a target object, using path with dot-notation. Returns undefined
or the optional default value if the value is not found.
get({ a: [{ b: 1 }] }, 'a.0.b');
get({ a: [{ b: 1 }] }, 'a.7.b', { default: 4 });
mergeObjects
(objects: objects[]): object
Merges an array of objects using lodash.merge
mergeObjects([
{ a: 1, c: 4 },
{ a: 2, b: 3 },
]);
omit
(object: object, list: string[]): object
Remove an array of keys from a object. Uses unset
from this package.
omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']);
serializer
serializer.copy
serializer.deserialize
serializer.deserializeFromString
serializer.serialize
serializer.serializeToString
set
(
target: any,
path: string,
value: any
): void
Sets a value in a object at a key given by path.
const obj = { a: 1 };
set(obj, 'b.c', 2);
stableStringify
(
object: any
options?: {
cmp?: function,
cycles?: boolean,
space?: string | number,
replacer?: function
}
)
Derived from https://github.com/substack/json-stable-stringify
Returns a deterministic JSON stringified object.
swap
(
arr: any[],
from: number,
to: number
)
Swaps the object at the from index with the object at the to index.
swap([0, 1, 2, 3, 4], 2, 3);
type
unset
(object: object, property: 'string')
Unset a property on a object. Supports dot-notation.
const obj = { a: { b: [] } };
unset(obj, 'a.b');
urlQuery
urlQuery.parse
(string: string): object
Parse a urlQuery serialized by urlQuery.stringify.
urlQuery.parse('a=%7B%22b%22%3A%221%22%7D');
urlQuery.stringify
(object: object): string
Serialize a urlQuery object to use as URL query parameters. Nested objects are serialized using serializer.serializeToString
.
urlQuery.stringify({ a: { b: '1' } });
More Lowdefy resources
Licence
Apache-2.0
4.0.0 (2024-01-16)
We're excited to announce Lowdefy V4, a full-stack web framework that simplifies building web applications, internal tools, admin panels, BI dashboards, and CRUD apps using YAML or JSON configuration files.
In this update, Lowdefy developers now enjoy faster app performance and improved functionality with custom code plugins.
New Features in Lowdefy V4
- Next.js build: Lowdefy apps have been converted to run on top of the Next.js framework.
- All of Auth.js: App authentication are now implemented by configuring any Auth.js supported providers, adapters and callbacks and events, all of which can be customized.
- Plugin extensibility: Apps can now be extended with any npm or pnpm workspace plugins.
- Flexible Styling: Change any of Ant Design's more than 900 style variables.
- Better, Faster Rendering: Reduced page loading times, better loading state management including easy configuration of loading skeletons where needed.
See our blog post for more details.
See our migration guide to guidance on converting V3 apps to V4.
Pricing and Licensing Changes
Starting with Lowdefy V4, we are introducing a capped usage based pricing to Lowdefy apps that include authentication.
Given the new pricing model we have changed how we license Lowdefy, for more information see the licenses page in the Lowdefy docs.