Skip to content

Commit

Permalink
chore: replace utility function values with Object.values (fix #3194
Browse files Browse the repository at this point in the history
)
  • Loading branch information
josdejong committed Apr 24, 2024
1 parent 5aa35ce commit 5c12c07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions 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'
Expand Down Expand Up @@ -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?
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/utils/object.js
Expand Up @@ -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
Expand Down

0 comments on commit 5c12c07

Please sign in to comment.