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

utilium

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utilium - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

4

dist/objects.d.ts
/// <reference types="node" resolution-mode="require"/>
import type * as FS from 'fs';
export declare function filterObject<T extends object, K extends keyof T>(object: T, ...keys: K[]): Pick<T, K>;
export declare function filterObject<O extends object, R extends object>(object: O, predicate: (key: keyof O, value: O[keyof O]) => boolean): R;
export declare function pick<T extends object, K extends keyof T>(object: T, ...keys: K[] | K[][]): Pick<T, K>;
export declare function omit<T extends object, K extends keyof T>(object: T, ...keys: K[] | K[][]): Omit<T, K>;
export declare function isJSON(str: string): boolean;

@@ -5,0 +7,0 @@ export declare abstract class FileMap<V> implements Map<string, V> {

@@ -1,5 +0,11 @@

export function filterObject(object, ...keys) {
export function filterObject(object, predicate) {
const entries = Object.entries(object);
return Object.fromEntries(entries.filter(([key]) => keys.includes(key)));
return Object.fromEntries(entries.filter(([key, value]) => predicate(key, value)));
}
export function pick(object, ...keys) {
return filterObject(object, (key) => keys.flat().includes(key));
}
export function omit(object, ...keys) {
return filterObject(object, (key) => !keys.flat().includes(key));
}
export function isJSON(str) {

@@ -6,0 +12,0 @@ try {

{
"name": "utilium",
"version": "0.1.3",
"version": "0.1.4",
"description": "Typescript utilies",

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

import type * as FS from 'fs';
export function filterObject<T extends object, K extends keyof T>(object: T, ...keys: K[]): Pick<T, K> {
const entries = <[K, T[K]][]>Object.entries(object);
return <Pick<T, K>>Object.fromEntries(entries.filter(([key]) => keys.includes(key)));
export function filterObject<O extends object, R extends object>(object: O, predicate: (key: keyof O, value: O[keyof O]) => boolean): R {
const entries = <[keyof O, O[keyof O]][]>Object.entries(object);
return <R>Object.fromEntries(entries.filter(([key, value]) => predicate(key, value)));
}
export function pick<T extends object, K extends keyof T>(object: T, ...keys: K[] | K[][]): Pick<T, K> {
return filterObject<T, Pick<T, K>>(object, (key: K) => keys.flat().includes(key));
}
export function omit<T extends object, K extends keyof T>(object: T, ...keys: K[] | K[][]): Omit<T, K> {
return filterObject<T, Omit<T, K>>(object, (key: K) => !keys.flat().includes(key));
}
export function isJSON(str: string) {

@@ -9,0 +17,0 @@ try {

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