@luminix/support 0.0.1-beta.0 → 0.0.1-beta.1

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/src/Obj.ts DELETED
@@ -1,70 +0,0 @@
1
-
2
- import { toFormData as toPlatformData } from 'axios';
3
- import * as _ from 'lodash-es';
4
-
5
- export type JsonProperty = null | boolean | number | string;
6
-
7
-
8
- export function fromQuery(searchParams: URLSearchParams): Record<string, any> {
9
- const object: Record<string, string> = {};
10
-
11
- for (const [key, value] of searchParams.entries()) {
12
- set(object, key, value);
13
- }
14
-
15
- return object;
16
- }
17
-
18
- export function fromFormData(formData: FormData): Record<string, any> {
19
- return fromQuery(formData as unknown as URLSearchParams);
20
- }
21
-
22
- export function get(object: any, path: string, defaultValue?: any): any {
23
- return _.get(object, path, defaultValue);
24
- }
25
-
26
- export function has(object: any, path: string): boolean {
27
- return _.has(object, path);
28
- }
29
-
30
- export function isEmpty(object: any): boolean {
31
- return _.isEmpty(object);
32
- }
33
-
34
- export function isEqual(object: any, other: any): boolean {
35
- return _.isEqual(object, other);
36
- }
37
-
38
- export function merge(object: any, ...sources: any[]): any {
39
- return _.merge(object, ...sources);
40
- }
41
-
42
- export function omit(object: any, ...paths: string[]): any {
43
- return _.omit(object, ...paths);
44
- }
45
-
46
- export function pick(object: any, ...paths: string[]): any {
47
- return _.pick(object, ...paths);
48
- }
49
-
50
- export function set(object: any, path: string, value: any): void {
51
-
52
-
53
- _.set(object, path, value);
54
- }
55
-
56
- export function toQuery(object: any): URLSearchParams {
57
- return toPlatformData(object, new URLSearchParams()) as URLSearchParams;
58
- }
59
-
60
- export function toFormData(object: any): FormData {
61
- return toPlatformData(object, new FormData()) as FormData;
62
- }
63
-
64
- export function unset(object: any, path: string): void {
65
- _.unset(object, path);
66
- }
67
-
68
-
69
-
70
-
package/src/Query.ts DELETED
@@ -1,29 +0,0 @@
1
- import * as Obj from "./Obj";
2
- import * as Str from "./Str";
3
-
4
- export type Operator = '=' | '!=' | '>' | '>=' | '<' | '<=';
5
-
6
- export function fromObject(object: object): URLSearchParams {
7
- return Obj.toQuery(object);
8
- }
9
-
10
- export function toObject(searchParams: URLSearchParams): object {
11
- return Obj.fromQuery(searchParams);
12
- }
13
-
14
- export function merge(...parts: (string | URLSearchParams)[]): URLSearchParams {
15
-
16
- const searchParams = new URLSearchParams();
17
- parts.forEach((part) => {
18
-
19
- const params = typeof part === 'string'
20
- ? new URLSearchParams(Str.after(part, '?'))
21
- : part;
22
-
23
- params.forEach((value, key) => {
24
- searchParams.set(key, value);
25
- });
26
- });
27
-
28
- return searchParams;
29
- }
package/src/Str.ts DELETED
@@ -1,53 +0,0 @@
1
- import * as _ from "lodash-es";
2
-
3
- export function after(string: string, search: string): string {
4
- if (!string.includes(search)) {
5
- return '';
6
- }
7
- return string.split(search).slice(1).join('');
8
- }
9
-
10
- export function afterLast(string: string, search: string): string {
11
- if (!string.includes(search)) {
12
- return '';
13
- }
14
- return string.split(search).slice(-1).join('');
15
- }
16
-
17
- export function before(string: string, search: string): string {
18
- if (!string.includes(search)) {
19
- return '';
20
- }
21
- return string.split(search).slice(0, 1).join('');
22
- }
23
-
24
- export function beforeLast(string: string, search: string): string {
25
- if (!string.includes(search)) {
26
- return '';
27
- }
28
- return string.split(search).slice(0, -1).join('');
29
- }
30
-
31
- export function camel(string: string): string {
32
- return _.camelCase(string);
33
- }
34
-
35
- export function kebab(string: string): string {
36
- return _.kebabCase(string);
37
- }
38
-
39
- export function studly(string: string): string {
40
- return _.upperFirst(camel(string));
41
- }
42
-
43
- export function snake(string: string): string {
44
- return _.snakeCase(string);
45
- }
46
-
47
- export function trim(string: string, chars?: string): string {
48
- return _.trim(string, chars);
49
- }
50
-
51
- export function upperFirst(string: string): string {
52
- return _.upperFirst(string);
53
- }
package/src/index.ts DELETED
@@ -1,26 +0,0 @@
1
- import * as Arr from './Arr';
2
- import Collection from './Collection';
3
- import EventSource from './Contracts/EventSource';
4
- import Http from './Http';
5
- import Reducible from './Mixins/Reducible';
6
- import Macroable from './Mixins/Macroable';
7
- import * as Obj from './Obj';
8
- import * as Query from './Query';
9
- import * as Str from './Str';
10
-
11
-
12
- export {
13
- Arr,
14
- Collection,
15
- EventSource,
16
- Http,
17
- Reducible,
18
- Macroable,
19
- Obj,
20
- Query,
21
- Str,
22
-
23
-
24
- };
25
-
26
-