Skip to content

nolim1t/assign-obj-params

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

assign-obj-params

npm version

About

This is a function I've been using for a while in other bits of code (my library code, as well as some other code I've been doing for clients).

I did it to make things a bit more efficient.

Installing

npm i assign-obj-params

or in a npm package

npm i assign-obj-params --save

Where its used (Open Source)

Examples

Case - Designing an API interface to an API

I know all the API interface parameters, however I'd like to hide it away a bit more neatly in the library itself

var requestinfo = {}; // This comes from the function or method

const assignFormParamsIfExist = require('assign-obj-params');
var formParams = {
    apikey: "apikey"
};

assignFormParamsIfExist(formParams, requestinfo, 'order_id');
assignFormParamsIfExist(formParams, requestinfo, 'pairing');

// After this formParams is built which can be used in the request.js library to send as an API request

About

Copy the information from one user defined object to another

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published