Skip to content

Commit

Permalink
Create once and auth header utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zarathustra323 committed Oct 12, 2018
1 parent d7a125f commit 325f292
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/apply-auth-header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const once = require('./once');

module.exports = once((client, value) => {
client.addSoapHeader(value);
});
11 changes: 11 additions & 0 deletions src/utils/once.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = (fn) => {
let called = false;
let result;
return (...args) => {
if (!called) {
called = true;
result = fn(...args);
}
return result;
};
};

0 comments on commit 325f292

Please sign in to comment.