Skip to content

Commit

Permalink
Merge bc842d4 into cc0753a
Browse files Browse the repository at this point in the history
  • Loading branch information
syarul committed Nov 25, 2023
2 parents cc0753a + bc842d4 commit 18a2205
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: requrse
name: requrse-main

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: requrse
name: requrse-pull

on:
pull_request:
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,22 @@ function getInventory ({ id }) {

Extends the requrse methods/config
```js
const extConfig = {
methods: {
...methods,
item: 'getItem',
inventory: 'getInventory'
},
config: (param) => ({
...confParams,
getItem,
getInventory
})[param]
}
```

Now see how it perform!
```js
await rq({
PlayerClass: {
player: {
Expand All @@ -250,18 +266,7 @@ await rq({
}
}
}
}, {
methods: {
...methods,
item: 'getItem',
inventory: 'getInventory',
},
config: (param) => ({
...confParams,
getItem,
getInventory
})[param]
}).then(console.log)
}, extConfig).then(console.log)
// {
// PlayerClass: {
// player: {
Expand Down
22 changes: 12 additions & 10 deletions test/dems.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,7 @@ function getInventory ({ id }) {
return inventoryData[id].map(getItem)
}

await rq({
PlayerClass: {
player: {
$params: { gameId: 0 },
name: 1,
inventory: '*'
}
}
}, {
const extConfig = {
methods: {
...methods,
item: 'getItem',
Expand All @@ -193,7 +185,17 @@ await rq({
getItem,
getInventory
})[param]
}).then(console.log)
}

await rq({
PlayerClass: {
player: {
$params: { gameId: 0 },
name: 1,
inventory: '*'
}
}
}, extConfig).then(console.log)
// {
// PlayerClass: {
// player: {
Expand Down

0 comments on commit 18a2205

Please sign in to comment.