Coder Social home page Coder Social logo

node-netconf's People

Contributors

darylturner avatar jdlester8 avatar jean1880 avatar shayneeking avatar vkutkunje avatar

Stargazers

 avatar

Watchers

 avatar

node-netconf's Issues

node-netconf changes hyphens to underscores which is unnecessary

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

The issue: the package changes hyphens to underscores in netconf reply, which is not really neccessary.

Here is the diff that solved my problem:

diff --git a/node_modules/node-netconf/lib/netconf.js b/node_modules/node-netconf/lib/netconf.js
index e5a015c..9a2fb84 100644
--- a/node_modules/node-netconf/lib/netconf.js
+++ b/node_modules/node-netconf/lib/netconf.js
@@ -25,7 +25,6 @@ class Client extends EventEmitter {
         this._parse = this._parse.bind(this);
         this._sendHello = this._sendHello.bind(this);
         this._createError = this._createError.bind(this);
-        this._objectHelper = this._objectHelper.bind(this);
         this.open = this.open.bind(this);
         this.close = this.close.bind(this);
 
@@ -49,10 +48,7 @@ class Client extends EventEmitter {
         this.parseOpts = {
             trim: true,
             explicitArray: false,
             emptyTag: true,
             ignoreAttrs: false,
-            tagNameProcessors: [this._objectHelper],
-            attrNameProcessors: [this._objectHelper],
             valueProcessors: [xml2js.processors.parseNumbers],
             attrValueProcessors: [xml2js.processors.parseNumbers]
         };
@@ -151,9 +147,9 @@ class Client extends EventEmitter {
                             if (err) {
                                 return next(err);
                             }
-                            if (message.hello.session_id > 0) {
+                            if (message.hello["session-id"] > 0) {
                                 self.remoteCapabilities = message.hello.capabilities.capability;
-                                self.sessionID = message.hello.session_id;
+                                self.sessionID = message.hello["session-id"];
                                 self.connected = true;
                                 next(null);
                             } else {
@@ -254,7 +250,7 @@ class Client extends EventEmitter {
             if (self.raw) {
                 message.raw = xml;
             }
-            if (message.rpc_reply.hasOwnProperty('rpc_error')) {
+            if (message["rpc-reply"].hasOwnProperty('rpc-error')) {
                 return callback(self._createError(JSON.stringify(message), 'rpcError'), null);
             }
             return callback(null, message);
@@ -300,19 +296,6 @@ class Client extends EventEmitter {
         Error.captureStackTrace(err, self._createError);
         return err;
     }
-
-    /**
-     * Replaces characters that prevent dot-style object navigation
-     * @function _objectHelper
-     * @private
-     * @param  {string} name String to transform
-     * @return {string}      Transformed string
-     */
-    _objectHelper(name) {
-        // Replaces characters that prevent dot-style object navigation.
-        return name.replace(/-|:/g, '_');
-    }
-
 }
 
 module.exports.Client = Client;

This issue body was partially generated by patch-package.

Publish 1.1.2?

Hi,
I notice there's only v1.1 in 'tag', could help publish v1.1.2, so that users can download the .zip or .tar.gz file and use it officially?

BR/Lei

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.