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

@travetto/base

Package Overview
Dependencies
Maintainers
1
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/base - npm Package Compare versions

Comparing version 3.0.0-rc.19 to 3.0.0-rc.20

2

package.json
{
"name": "@travetto/base",
"version": "3.0.0-rc.19",
"version": "3.0.0-rc.20",
"description": "Environment config and common utilities for travetto applications.",

@@ -5,0 +5,0 @@ "keywords": [

import { ObjectUtil } from './object';
import { Class, ClassInstance } from './types';
import { Class, ClassInstance, TypedObject } from './types';

@@ -186,2 +186,29 @@ const REGEX_PAT = /[\/](.*)[\/](i|g|m|s)?/;

}
/**
* Filter object by excluding specific keys
* @param obj A value to filter, primitives will be untouched
* @param exclude Strings or patterns to exclude against
* @returns
*/
static filterByKeys<T>(obj: T, exclude: (string | RegExp)[]): T {
if (obj !== null && obj !== undefined && typeof obj === 'object') {
const out: Partial<T> = {};
for (const key of TypedObject.keys(obj)) {
if (!exclude.some(r => typeof key === 'string' && (typeof r === 'string' ? r === key : r.test(key)))) {
const val = obj[key];
if (typeof val === 'object') {
out[key] = this.filterByKeys(val, exclude);
} else {
out[key] = val;
}
}
}
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
return out as T;
} else {
return obj;
}
}
}
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