@riotjs/util
Advanced tools
Comparing version 2.2.4 to 2.3.0
@@ -0,1 +1,3 @@ | ||
import { isObject } from './checks.js' | ||
/** | ||
@@ -58,3 +60,17 @@ * Helper function to set an immutable property | ||
export function cloneDeep(source) { | ||
return JSON.parse(JSON.stringify(source)) | ||
return structuredClone(source) | ||
} | ||
/** | ||
* Like Array.prototype.filter but for objects | ||
* @param {Object} source - target object | ||
* @param {Funciton} filter - filter function | ||
* @return {Object} filtered source or the original source received | ||
*/ | ||
export function filter(source, filter) { | ||
return isObject(source) | ||
? Object.fromEntries( | ||
Object.entries(source).filter(([key, value]) => filter(key, value)), | ||
) | ||
: source | ||
} |
{ | ||
"name": "@riotjs/util", | ||
"version": "2.2.4", | ||
"version": "2.3.0", | ||
"description": "Riot.js util functions", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31743
842