From 5c12c07e2c5a97a234a51a9f6e4b0dbc11afe9c4 Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 24 Apr 2024 08:14:48 +0200 Subject: [PATCH] chore: replace utility function `values` with `Object.values` (fix #3194) --- src/core/create.js | 6 +++--- src/utils/object.js | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/create.js b/src/core/create.js index 2999898d36..f9e7ed572f 100644 --- a/src/core/create.js +++ b/src/core/create.js @@ -1,5 +1,5 @@ import typedFunction from 'typed-function' -import { deepFlatten, isLegacyFactory, values } from '../utils/object.js' +import { deepFlatten, isLegacyFactory } from '../utils/object.js' import * as emitter from './../utils/emitter.js' import { importFactory } from './function/import.js' import { configFactory } from './function/config.js' @@ -216,7 +216,7 @@ export function create (factories, config) { // listen for changes in config, import all functions again when changed // TODO: move this listener into the import function? math.on('config', () => { - values(importedFactories).forEach(factory => { + Object.values(importedFactories).forEach(factory => { if (factory && factory.meta && factory.meta.recreateOnConfigChange) { // FIXME: only re-create when the current instance is the same as was initially created // FIXME: delete the functions/constants before importing them again? @@ -234,7 +234,7 @@ export function create (factories, config) { // import the factory functions like createAdd as an array instead of object, // else they will get a different naming (`createAdd` instead of `add`). - math.import(values(deepFlatten(factories))) + math.import(Object.values(deepFlatten(factories))) math.ArgumentsError = ArgumentsError math.DimensionError = DimensionError diff --git a/src/utils/object.js b/src/utils/object.js index c5dbc692e2..7fbbdbc4a5 100644 --- a/src/utils/object.js +++ b/src/utils/object.js @@ -390,10 +390,6 @@ export function pickShallow (object, properties) { return copy } -export function values (object) { - return Object.keys(object).map(key => object[key]) -} - // helper function to test whether a string contains a path like 'user.name' function isPath (str) { return str.indexOf('.') !== -1