Registry / devops / object-to-arguments

object-to-arguments

JSON →
library0.1.0jsnpmunverified

Transforms object properties into an array of arguments ordered for a specific function. v0.1.0 from 2017. Handles destructuring, rest parameters, default values, and extra arguments. Different from simple mapping by using function introspection to respect parameter order. May have limited updates.

npm install object-to-arguments
INSTALL
IMPORT
SIG · OBJECT-TO-ARGUMENT
O
object-to-arguments
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import objectToArguments from 'object-to-arguments'
const objectToArguments = require('object-to-arguments')
Package provides default CommonJS export. Works with both CJS require and ESM default import.
objectToArguments
const objectToArguments = require('object-to-arguments')
const { objectToArguments } = require('object-to-arguments')
Only default export, no named export. Destructuring will yield undefined.
default
import objToArgs from 'object-to-arguments'
import * as objToArgs from 'object-to-arguments'
Namespace import returns an object with default property. Use default import directly.

Shows basic usage: convert object to argument array respecting parameter order, default values, and rest parameters.

import objectToArguments from 'object-to-arguments'; const fn = (a = 'defaultA', b, ...args) => ({ a, b, args }); const objectArgs = { extra1: 'EXTRA1', b: 'argB', extra2: 'EXTRA2' }; const fnArguments = objectToArguments(fn, objectArgs); // [ undefined, 'argB', 'EXTRA1', 'EXTRA2' ] const result = fn(...fnArguments); console.log(result); // { a: 'defaultA', b: 'argB', args: ['EXTRA1', 'EXTRA2'] }
Debug
Known issues
gotchaPass function reference or function string; passing arrow function may fail if it doesn't have a proper toString().
fix
Use regular function declaration or ensure function.toString() returns valid signature.
affects: >=0.0.0
gotchaObject must be flat; it does not automatically flatten nested objects. Destructuring is handled internally but input must be flat.
fix
Pass flat object with keys matching parameter names; for nested params, value will be taken as-is and function destructuring will handle it.
affects: >=0.0.0
gotchaExtra properties are appended at end of argument array, not merged into rest parameters automatically.
fix
Extra values are added after all named and destructured parameters; they become part of the function's arguments object or rest parameter.
affects: >=0.0.0
deprecatedPackage has not been updated since v0.1.0 (2017). Use at your own risk for modern Node or browser environments.
fix
Consider alternatives like manual argument mapping or Proxy-based solutions for maintenance.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'match' of undefined
Passing a non-function value as first argument. The package tries to match parameter pattern from function string.
fix
Ensure first argument is a function: objectToArguments(myFunc, obj).
TypeError: object is not iterable
Object values contain arrays or objects that are not valid for structure building in complex destructuring.
fix
Ensure all values are primitives or simple objects as needed by the function signature.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
object-to-arguments — npm install object-to-arguments · libregistry