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

@nothing-but/utils

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nothing-but/utils - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

./dist/index.js

6

dist/array.d.ts

@@ -7,2 +7,8 @@ /**

/**
* Map an array, but only keep non-nullish values.
*
* Useful for combining `map` and `filter` into one operation.
*/
export declare function map_non_nullable<T, U>(array: readonly T[], fn: (item: T) => U): NonNullable<U>[];
/**
* Checks if both arrays contain the same values.

@@ -9,0 +15,0 @@ * Order doesn't matter.

@@ -12,2 +12,20 @@ import { Num } from './index.js';

/**
* Map an array, but only keep non-nullish values.
*
* Useful for combining `map` and `filter` into one operation.
*/
export function map_non_nullable(array, fn) {
const result = Array(array.length);
let i = 0;
for (const item of array) {
const mapped = fn(item);
if (mapped != null) {
result[i] = mapped;
i += 1;
}
}
result.length = i;
return result;
}
/**
* Checks if both arrays contain the same values.

@@ -45,2 +63,3 @@ * Order doesn't matter.

array.length = 0;
// eslint-disable-next-line @nothing-but/no-ignored-return
array.push.apply(array, temp);

@@ -47,0 +66,0 @@ }

4

dist/misc.d.ts

@@ -19,2 +19,6 @@ import { AnyClass, Noop } from './types.js';

/**
* Converts any value to an Error.
*/
export declare const toError: (e: unknown) => Error;
/**
* Check if a value is a PlainObject. A PlainObject is an object with no prototype.

@@ -21,0 +25,0 @@ */

@@ -18,2 +18,6 @@ /** no operation */

/**
* Converts any value to an Error.
*/
export const toError = (e) => (e instanceof Error ? e : new Error(String(e)));
/**
* Check if a value is a PlainObject. A PlainObject is an object with no prototype.

@@ -20,0 +24,0 @@ */

5

package.json
{
"name": "@nothing-but/utils",
"version": "0.8.0",
"version": "0.9.0",
"license": "MIT",

@@ -20,2 +20,5 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>",

},
"files": [
"dist"
],
"type": "module",

@@ -22,0 +25,0 @@ "main": "./dist/index.js",

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