Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nolim1t/assign-obj-params
Copy the information from one user defined object to another
https://github.com/nolim1t/assign-obj-params
library utils variables
Last synced: 2 days ago
JSON representation
Copy the information from one user defined object to another
- Host: GitHub
- URL: https://github.com/nolim1t/assign-obj-params
- Owner: nolim1t
- Created: 2017-05-16T03:15:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-16T09:20:04.000Z (over 7 years ago)
- Last Synced: 2024-04-13T22:04:51.943Z (7 months ago)
- Topics: library, utils, variables
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# assign-obj-params
[![npm version](https://badge.fury.io/js/assign-obj-params.svg)](https://badge.fury.io/js/assign-obj-params)
## 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
```bash
npm i assign-obj-params
```or in a npm package
```bash
npm i assign-obj-params --save
```## Where its used (Open Source)
* [nl-bxth](https://github.com/nolim1t/nl-bxth)
* [nl-bitmex](https://github.com/nolim1t/nl-bitmex)## 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
```javascript
var requestinfo = {}; // This comes from the function or methodconst 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
```