Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rjutils-collection

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjutils-collection - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

8

lib/cjs/index.d.ts
/// <reference types="node" />
/// <reference types="node" />
import { Hash } from "crypto";

@@ -8,2 +9,5 @@ import randomStrOptions from "./types/randomStrOptions";

export declare const Version: string;
export type DeepRequired<Type> = Type extends {} ? Type extends Map<any, any> ? Required<Type> : Type extends Set<any> ? Required<Type> : Type extends Buffer ? Required<Type> : Type extends Function ? Required<Type> : Type extends Array<any> ? Required<Type> : Type extends {} ? {
[Key in keyof Type]-?: DeepRequired<Type[Key]>;
} : Required<Type> : Required<Type>;
export { randomStrOptions, encryptStrOptions, decryptStrOptions, hashStrOptions };

@@ -58,1 +62,5 @@ /**

*/ export declare function hashStr<T extends hashStrOptions>(options?: hashStrOptions): T['output'] extends 'bytes' ? Hash : string;
/**
* Deep Parse Options
* @since 1.2.2
*/ export declare function deepParseOptions<Options extends Record<any, any>>(object: DeepRequired<Options>, provided: Partial<Options>): DeepRequired<Options>;

@@ -35,2 +35,3 @@ "use strict";

decryptStrOptions: () => import_decryptStrOptions.default,
deepParseOptions: () => deepParseOptions,
encryptStr: () => encryptStr,

@@ -179,2 +180,19 @@ encryptStrOptions: () => import_encryptStrOptions.default,

}
function deepParseOptions(object, provided) {
const handleObject = (object2, merge) => {
let output = {};
Object.keys(object2).forEach((key) => {
if (typeof object2[key] === "object" && key in merge)
output[key] = handleObject(object2[key], merge[key]);
else if (typeof object2[key] === "object")
output[key] = object2[key];
else if (key in merge)
output[key] = merge[key];
else
output[key] = object2[key];
});
return output;
};
return handleObject(object, provided);
}
// Annotate the CommonJS export names for ESM import in node:

@@ -186,2 +204,3 @@ 0 && (module.exports = {

decryptStrOptions,
deepParseOptions,
encryptStr,

@@ -188,0 +207,0 @@ encryptStrOptions,

2

lib/cjs/pckg.json
{
"name": "rjutils-collection",
"version": "1.2.1",
"version": "1.3.0",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -8,3 +8,3 @@ /// <reference types="node" />

* @default "sha256"
*/ algorithm?: 'sha256' | 'sha512' | string;
*/ algorithm?: string;
/**

@@ -11,0 +11,0 @@ * The Text Output

/// <reference types="node" />
/// <reference types="node" />
import { Hash } from "crypto";

@@ -8,2 +9,5 @@ import randomStrOptions from "./types/randomStrOptions";

export declare const Version: string;
export type DeepRequired<Type> = Type extends {} ? Type extends Map<any, any> ? Required<Type> : Type extends Set<any> ? Required<Type> : Type extends Buffer ? Required<Type> : Type extends Function ? Required<Type> : Type extends Array<any> ? Required<Type> : Type extends {} ? {
[Key in keyof Type]-?: DeepRequired<Type[Key]>;
} : Required<Type> : Required<Type>;
export { randomStrOptions, encryptStrOptions, decryptStrOptions, hashStrOptions };

@@ -58,1 +62,5 @@ /**

*/ export declare function hashStr<T extends hashStrOptions>(options?: hashStrOptions): T['output'] extends 'bytes' ? Hash : string;
/**
* Deep Parse Options
* @since 1.2.2
*/ export declare function deepParseOptions<Options extends Record<any, any>>(object: DeepRequired<Options>, provided: Partial<Options>): DeepRequired<Options>;

@@ -133,2 +133,19 @@ import * as path from "path";

}
function deepParseOptions(object, provided) {
const handleObject = (object2, merge) => {
let output = {};
Object.keys(object2).forEach((key) => {
if (typeof object2[key] === "object" && key in merge)
output[key] = handleObject(object2[key], merge[key]);
else if (typeof object2[key] === "object")
output[key] = object2[key];
else if (key in merge)
output[key] = merge[key];
else
output[key] = object2[key];
});
return output;
};
return handleObject(object, provided);
}
export {

@@ -139,2 +156,3 @@ Spinner,

decryptStrOptions,
deepParseOptions,
encryptStr,

@@ -141,0 +159,0 @@ encryptStrOptions,

{
"name": "rjutils-collection",
"version": "1.2.1",
"version": "1.3.0",
"description": "Easy and Lightweight Utilities",

@@ -5,0 +5,0 @@ "module": "lib/esm/index.js",

@@ -8,3 +8,3 @@ /// <reference types="node" />

* @default "sha256"
*/ algorithm?: 'sha256' | 'sha512' | string;
*/ algorithm?: string;
/**

@@ -11,0 +11,0 @@ * The Text Output

{
"name": "rjutils-collection",
"version": "1.2.1",
"version": "1.3.0",
"description": "Easy and Lightweight Utilities",

@@ -10,6 +10,8 @@ "module": "lib/esm/index.js",

"test": "yarn build && node test"
}, "repository": {
},
"repository": {
"type": "git",
"url": "git+https://github.com/rotvproHD/NPM_UTILS.git"
}, "keywords": [
},
"keywords": [
"easy",

@@ -25,7 +27,9 @@ "utilities",

"binary"
], "author": "0x4096 (Robert Jansen)",
],
"author": "0x4096 (Robert Jansen)",
"license": "MIT",
"bugs": {
"url": "https://github.com/rotvproHD/NPM_UTILS/issues"
}, "homepage": "https://github.com/rotvproHD/NPM_UTILS#readme",
},
"homepage": "https://github.com/rotvproHD/NPM_UTILS#readme",
"devDependencies": {

@@ -35,4 +39,4 @@ "@types/node": "^18.11.18",

"rjutils-collection": "link:.",
"typescript": "^4.9.4"
"typescript": "^5.0.0"
}
}
}

@@ -105,2 +105,43 @@ <h1 align="center">Welcome to rjutils-collection 👋</h1>

Parsing Options
```js
const utils = require('rjutils-collection')
const original = {
ssl: true,
maxRequests: 10000,
other: {
clock: true,
date: {
enabled: true,
timezone: 'UTC'
}
}
}
const userProvided = {
ssl: false,
other: {
date: {
timezone: 'CET'
}
}
}
const result = utils.deepParseOptions(original, userProvided)
/**
* {
* ssl: false,
* maxRequests: 10000,
* other: {
* clock: true,
* date: {
* enabled: true,
* timezone: 'CET'
* }
* }
* }
*/
```
## Author

@@ -107,0 +148,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc