@ibiliaze/stringman 3.5.1 → 3.6.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.
package/dist/index.d.ts CHANGED
@@ -78,7 +78,7 @@ export declare const getCloudinaryPublicId: (url: string) => string;
78
78
  * query({ limit: 10, skip: 20, sortBy: 'createdAt:desc', empty: '' });
79
79
  * // → "?limit=10&skip=20&sortBy=createdAt%3Adesc"
80
80
  */
81
- export declare const query: (q: Record<string, any>) => string;
81
+ export declare const query: (q: Record<string, any>, filter?: (string | null | undefined)[]) => string;
82
82
  /**
83
83
  * Build a comma-separated string from a list of object keys.
84
84
  *
package/dist/index.js CHANGED
@@ -97,10 +97,8 @@ exports.getCloudinaryPublicId = getCloudinaryPublicId;
97
97
  * query({ limit: 10, skip: 20, sortBy: 'createdAt:desc', empty: '' });
98
98
  * // → "?limit=10&skip=20&sortBy=createdAt%3Adesc"
99
99
  */
100
- const query = (q) => {
100
+ const query = (q, filter = ['', null, undefined, 'null', 'undefined']) => {
101
101
  try {
102
- // Values considered "invalid" and should be filtered out
103
- const filter = ['', null, undefined, 'null', 'undefined'];
104
102
  // Convert object to entries, filter out invalid keys/values
105
103
  const filtered = Object.entries(q).filter(([key, value]) => !filter.includes(key) && !filter.includes(value));
106
104
  // Build query string using URLSearchParams
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ibiliaze/stringman",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
9
  "pub": "npm publish --access public",
10
- "git": "git add .; git commit -m 'changes'; git tag -a v3.5.1 -m 'v3.5.1'; git push origin v3.5.1; git push",
10
+ "git": "git add .; git commit -m 'changes'; git tag -a v3.6.0 -m 'v3.6.0'; git push origin v3.6.0; git push",
11
11
  "push": "npm run build; npm run git; npm run pub"
12
12
  },
13
13
  "author": "Ibi Hasanli",
package/src/index.ts CHANGED
@@ -95,11 +95,8 @@ export const getCloudinaryPublicId = (url: string): string => {
95
95
  * query({ limit: 10, skip: 20, sortBy: 'createdAt:desc', empty: '' });
96
96
  * // → "?limit=10&skip=20&sortBy=createdAt%3Adesc"
97
97
  */
98
- export const query = (q: Record<string, any>): string => {
98
+ export const query = (q: Record<string, any>, filter = ['', null, undefined, 'null', 'undefined']): string => {
99
99
  try {
100
- // Values considered "invalid" and should be filtered out
101
- const filter = ['', null, undefined, 'null', 'undefined'];
102
-
103
100
  // Convert object to entries, filter out invalid keys/values
104
101
  const filtered = Object.entries(q).filter(([key, value]) => !filter.includes(key) && !filter.includes(value));
105
102