New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moderndash

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moderndash - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

104

dist/index.d.ts

@@ -24,3 +24,3 @@ /**

type GenericFunction<TFunc extends (...args: any) => any> = (...args: Parameters<TFunc>) => ReturnType<TFunc>;
type GenericObject = Record<RecordKey, unknown>;
type PlainObject$1 = Record<RecordKey, unknown>;

@@ -324,6 +324,5 @@ /**

/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, all arguments
* provided to the memoized function are used as the map cache key.
* Creates a function that memoizes the result of `func`.
* If `resolver` is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function.
* By default, all arguments provided to the memoized function are used as the map cache key.
*

@@ -337,3 +336,3 @@ * The cache is exposed as the `cache` property on the memoized

* @example
* const object = \{ 'a': 1, 'b': 2 \}
* const object = { 'a': 1, 'b': 2 }
*

@@ -409,2 +408,25 @@ * const values = memoize(values)

/**
* Deep merge two or more objects.
*
* @example
* // ---- Nested objects are merged ----
* merge({ a: 1 }, { b: 2 }, { c: 3 }))
* // => { a: 1, b: 2, c: 3 }
*
* merge({ a: { b: 1 } }, { a: { c: 2 } })
* // => { a: { b: 1, c: 2 } }
*
* // ---- Other types are overwritten ----
* merge({ a: [1, 2] }, { a: [3, 4] })
* // => { a: [3, 4] }
*
* merge({ a: 1 }, { a: "Yes" })
* // => { a: "Yes" }
* @param target - The target object
* @param sources - The source objects
* @returns The merged object
*/
declare function merge(target: PlainObject$1, ...sources: PlainObject$1[]): PlainObject$1;
/**
* Omit specified keys from an object

@@ -422,3 +444,3 @@ *

*/
declare function omit<TObj extends object, Key extends keyof TObj>(object: TObj, keysToOmit: Key[]): Omit<TObj, Key>;
declare function omit<TObj extends PlainObject$1, Key extends keyof TObj>(object: TObj, keysToOmit: Key[]): Omit<TObj, Key>;

@@ -438,5 +460,23 @@ /**

*/
declare function pick<TInput, Key extends keyof TInput>(object: TInput, keysToPick: Key[]): Pick<TInput, Key>;
declare function pick<TInput extends PlainObject$1, Key extends keyof TInput>(object: TInput, keysToPick: Key[]): Pick<TInput, Key>;
/**
* Sets the value at path of object. If a portion of path doesn’t exist, it’s created.
*
* TODO: Add support for array paths.
*
* @alpha
* @example
* const obj = { a: { b: 2 } };
* set(obj, 'a.c', 1);
* // => { a: { b: 2, c: 1 } }
*
* @param obj - The object to modify.
* @param path - The path of the property to set.
* @param value - The value to set.
* @returns The modified object.
*/
declare function set(obj: PlainObject$1, path: string, value: unknown): PlainObject$1;
/**
* A class for managing a queue of async functions that runs a set number concurrently.

@@ -498,7 +538,7 @@ * If for example you have 10 async functions and you want to run 3 at a time, you can use this class.

clear(): void;
/** Pauses the execution of the functions in the queue */
/** Pauses the execution of the queue */
pause(): void;
/** Resumes the execution of the tasks in the queue */
resume(): void;
/** Returns the queue */
/** Return the tasks added to the queue */
getQueue(): (() => Promise<any>)[];

@@ -619,18 +659,2 @@ /** Returns whether the queue is paused */

/**
* Converts a string to dash-case.
*
* @example
* dashCase('Foo Bar')
* // => 'foo-bar'
* dashCase('fooBar')
* // => 'foo-bar'
* dashCase('__FOO_BAR__')
* // => 'foo-bar'
* @category String
* @param str - The string to convert.
* @returns Returns the dash cased string.
*/
declare function dashCase(str: string): string;
/**
* Deburrs a string by converting

@@ -686,2 +710,5 @@ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)

* // => 'foo-bar'
* kebabCase('Héllo World')
* // => 'hello-world'
*
* @category String

@@ -703,2 +730,5 @@ * @param str - The string to convert.

* // => 'FooBar'
* pascalCase('Héllo World')
* // => 'HelloWorld'
*
* @category String

@@ -722,2 +752,4 @@ * @param str - The string to convert.

* // => 'foo_2_bar'
* snakeCase('Héllo World')
* // => 'hello_world'
* @category String

@@ -739,2 +771,4 @@ * @param str - The string to convert.

* // => 'Foo Bar'
* startCase('HélloWorld')
* // => 'Hello World'
* @category String

@@ -772,2 +806,16 @@ * @param str - The string to convert.

/**
* The type of a plain object.
*
* This is a more strict type than the `object` type which also includes functions and arrays.
*
* You can validate if a value is a plain object with {@link isPlainObject}.
* @example
* let obj: PlainObject = { a: 1, b: 2 };
*
* obj = [1, 2, 3];
* // => Type 'number[]' is not assignable to type 'PlainObject'.
*/
type PlainObject = Record<RecordKey, unknown>;
/**
* Checks if `value` is an empty object, collection, map, or set.

@@ -845,3 +893,3 @@ *

*/
declare function isPlainObject(value: unknown): value is GenericObject;
declare function isPlainObject(value: unknown): value is PlainObject$1;

@@ -861,2 +909,2 @@ /**

export { Queue, after, before, camelCase, capitalize, chunk, count, dashCase, debounce, deburr, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, group, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, memoize, omit, once, pascalCase, pick, races, retry, sample, shuffle, sleep, snakeCase, sort, startCase, stripSpecial, takeRightWhile, takeWhile, throttle, timeout, times, unescapeHtml, unique };
export { PlainObject, Queue, after, before, camelCase, capitalize, chunk, count, debounce, deburr, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, group, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, memoize, merge, omit, once, pascalCase, pick, races, retry, sample, set, shuffle, sleep, snakeCase, sort, startCase, stripSpecial, takeRightWhile, takeWhile, throttle, timeout, times, unescapeHtml, unique };

@@ -365,2 +365,12 @@ // src/array/chunk.ts

// src/object/merge.ts
function merge(target, ...sources) {
for (const source of sources) {
for (const [key, value] of Object.entries(source)) {
target[key] = isPlainObject(value) && isPlainObject(target[key]) ? merge(target[key], value) : value;
}
}
return target;
}
// src/object/pick.ts

@@ -382,2 +392,17 @@ function pick(object, keysToPick) {

// src/object/set.ts
function set(obj, path, value) {
const pathParts = path.split(".");
const lastPathPart = pathParts.pop();
let currentObj = obj;
for (const pathPart of pathParts) {
if (!isPlainObject(currentObj[pathPart])) {
currentObj[pathPart] = {};
}
currentObj = currentObj[pathPart];
}
currentObj[lastPathPart] = value;
return obj;
}
// src/promise/queue.ts

@@ -542,12 +567,2 @@ var Queue = class {

// src/string/dashCase.ts
function dashCase(str) {
const words = splitWords(str);
let dashCase2 = "";
for (const word of words) {
dashCase2 += word.toLowerCase() + "-";
}
return dashCase2.slice(0, -1);
}
// src/string/escapeHtml.ts

@@ -665,3 +680,2 @@ function escapeHtml(str) {

count,
dashCase,
debounce,

@@ -682,2 +696,3 @@ deburr,

memoize,
merge,
omit,

@@ -690,2 +705,3 @@ once,

sample,
set,
shuffle,

@@ -692,0 +708,0 @@ sleep,

@@ -45,9 +45,9 @@ {

"devDependencies": {
"@vitest/coverage-c8": "0.28.1",
"@vitest/ui": "0.28.1",
"vitest": "0.28.1",
"@vitest/coverage-c8": "0.28.3",
"@vitest/ui": "0.28.3",
"vitest": "0.28.3",
"tsup": "6.5.0",
"ctix": "1.8.1"
"ctix": "1.8.2"
},
"version": "0.7.0"
"version": "0.7.1"
}

@@ -11,6 +11,7 @@ ![ModernDash Logo](/website/src/assets/moderndashLogo.svg)

✅ Tree-shakable
✅ Typescript Strict Mode (no any)
✅ Typescript Strict Mode (no any)<br>
✅ Zero dependencies
✅ Hoverable Docs
✅ TS Decorators
✅ ESNext
</div>

@@ -27,6 +28,15 @@

> **Warning**
> This library is still in development and is not ready for production use.
> This library is still in beta.
## Installation
## 🔖 Introduction
I developed ModernDash as an modern lightweight alternative to Lodash and other utility libraries.
ModernDash provides powerful functions while encouraging you to use native JS where its appropriate.
Why would i need:
- `ModernDash.isArray()` when there is `Array.isArray()`
- `Lodash.compact(array)` when i could write `array.filter(Boolean)`
It ignores trivial functions and focuses of the functions you actually need.
## 💾 Installation
```bash

@@ -37,3 +47,3 @@ npm install moderndash

## Why is X lodash function not included?
Please check [You-Dont-Need-Lodash](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) for native replacements.
If you still think a function is missing please open an issue.
Please check [You-Dont-Need-Lodash](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) for native replacements.
If you still think a function is missing open an issue.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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