Skip to content

Commit 5c12c07

Browse files
committed
chore: replace utility function values with Object.values (fix #3194)
1 parent 5aa35ce commit 5c12c07

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/core/create.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import typedFunction from 'typed-function'
2-
import { deepFlatten, isLegacyFactory, values } from '../utils/object.js'
2+
import { deepFlatten, isLegacyFactory } from '../utils/object.js'
33
import * as emitter from './../utils/emitter.js'
44
import { importFactory } from './function/import.js'
55
import { configFactory } from './function/config.js'
@@ -216,7 +216,7 @@ export function create (factories, config) {
216216
// listen for changes in config, import all functions again when changed
217217
// TODO: move this listener into the import function?
218218
math.on('config', () => {
219-
values(importedFactories).forEach(factory => {
219+
Object.values(importedFactories).forEach(factory => {
220220
if (factory && factory.meta && factory.meta.recreateOnConfigChange) {
221221
// FIXME: only re-create when the current instance is the same as was initially created
222222
// FIXME: delete the functions/constants before importing them again?
@@ -234,7 +234,7 @@ export function create (factories, config) {
234234

235235
// import the factory functions like createAdd as an array instead of object,
236236
// else they will get a different naming (`createAdd` instead of `add`).
237-
math.import(values(deepFlatten(factories)))
237+
math.import(Object.values(deepFlatten(factories)))
238238

239239
math.ArgumentsError = ArgumentsError
240240
math.DimensionError = DimensionError

src/utils/object.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ export function pickShallow (object, properties) {
390390
return copy
391391
}
392392

393-
export function values (object) {
394-
return Object.keys(object).map(key => object[key])
395-
}
396-
397393
// helper function to test whether a string contains a path like 'user.name'
398394
function isPath (str) {
399395
return str.indexOf('.') !== -1

0 commit comments

Comments
 (0)