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

@glideapps/ts-necessities

Package Overview
Dependencies
Maintainers
29
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glideapps/ts-necessities - npm Package Compare versions

Comparing version 2.2.4 to 2.3.0

1

dist/default-map.js

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

class DefaultMap extends Map {
_defaultFunc;
/**

@@ -23,0 +24,0 @@ *

5

dist/index.d.ts

@@ -56,5 +56,2 @@ /**

};
export type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
};
/**

@@ -100,2 +97,4 @@ * If `x` is undefined, return `undefined`. Otherwise, return `f(x)`.

export declare function filterUndefined<T>(arr: Iterable<T | undefined>): T[];
export declare function mapRecord<T, U>(r: Record<string, T>, f: (v: T, n: string) => U): Record<string, U>;
export declare function mapRecordFilterUndefined<T, U>(r: Record<string, T>, f: (v: T, n: string) => U | undefined): Record<string, U>;
/**

@@ -102,0 +101,0 @@ * Returns a string representation of `e`, which is supposed to be an

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeBrandString = exports.brandString = exports.DefaultMap = exports.exceptionToError = exports.exceptionToString = exports.filterUndefined = exports.mapFilterUndefined = exports.hasOwnProperty = exports.isArray = exports.isEnumValue = exports.definedMap = exports.reduceTwo = exports.sleep = exports.dontAwait = exports.defined = exports.assertNever = exports.assert = exports.panic = exports.proveNever = exports.proveType = void 0;
exports.makeBrandString = exports.brandString = exports.DefaultMap = exports.exceptionToError = exports.exceptionToString = exports.mapRecordFilterUndefined = exports.mapRecord = exports.filterUndefined = exports.mapFilterUndefined = exports.hasOwnProperty = exports.isArray = exports.isEnumValue = exports.definedMap = exports.reduceTwo = exports.sleep = exports.dontAwait = exports.defined = exports.assertNever = exports.assert = exports.panic = exports.proveNever = exports.proveType = void 0;
/**

@@ -155,2 +155,21 @@ * Do nothing, but only compile if `_val` is of type `T`.

exports.filterUndefined = filterUndefined;
function mapRecord(r, f) {
const result = {};
for (const [name, value] of Object.entries(r)) {
result[name] = f(value, name);
}
return result;
}
exports.mapRecord = mapRecord;
function mapRecordFilterUndefined(r, f) {
const result = {};
for (const [name, value] of Object.entries(r)) {
const o = f(value, name);
if (o === undefined)
continue;
result[name] = o;
}
return result;
}
exports.mapRecordFilterUndefined = mapRecordFilterUndefined;
/**

@@ -170,3 +189,3 @@ * Returns a string representation of `e`, which is supposed to be an

}
catch (_a) {
catch {
return "Exception can't be stringified";

@@ -173,0 +192,0 @@ }

{
"name": "@glideapps/ts-necessities",
"version": "2.2.4",
"version": "2.3.0",
"description": "Small utilities to make life with TypeScript easier",

@@ -27,4 +27,4 @@ "main": "dist/index.js",

"typedoc": "^0.25.13",
"typescript": "^5.4.4"
"typescript": "^5.4.5"
}
}

@@ -171,2 +171,23 @@ /**

export function mapRecord<T, U>(r: Record<string, T>, f: (v: T, n: string) => U): Record<string, U> {
const result: Record<string, U> = {};
for (const [name, value] of Object.entries(r)) {
result[name] = f(value, name);
}
return result;
}
export function mapRecordFilterUndefined<T, U>(
r: Record<string, T>,
f: (v: T, n: string) => U | undefined
): Record<string, U> {
const result: Record<string, U> = {};
for (const [name, value] of Object.entries(r)) {
const o = f(value, name);
if (o === undefined) continue;
result[name] = o;
}
return result;
}
/**

@@ -173,0 +194,0 @@ * Returns a string representation of `e`, which is supposed to be an

@@ -15,5 +15,5 @@ {

"noImplicitReturns": true,
"target": "es6",
"target": "esnext",
"outDir": "dist",
"lib": ["es6", "dom"],
"lib": ["es2017", "dom"],
"baseUrl": "./src",

@@ -20,0 +20,0 @@ "typeRoots": ["./node_modules/@types"]

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