
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
callback-string
Advanced tools
callback-string
can be useful if you are using a command pattern approach or RPC or simply when you need to save a callback to call later (see Facebook Messenger postback).
callback-string
has only two method, parse and stringify, the first transforms a callback object to the respective string, the second viceversa.
Example:
const parse = require('callback-string/Parse')
const stringify = require('callback-string/Stringify')
const obj = {
callback: 'getData',
parameters: {
from: '10/02/2002',
to: '11/03/2008'
}
}
const str = stringify(obj).result
console.log(str) // getData#from=10/02/2002#to=11/03/2008
const objParsed = parse(obj)
console.log(objParsed)
As you can see it expects that the object to stringify is formatted in this way:
const obj = {
callback: 'actionName', // string
parameters: { // object
par1: 'par1', // any type
par2: 2 // any type
}
}
const str = 'actionName#par1=par1#par2=2'
npm install callback-string --save
callbackString
must be a string
escape
must be a string, default to '#'
Returns an object formatted as described above.
callbackObject
must be an object as described above
escape
must be a string, default to '#'
Returns a string formatted as described above.
If you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.
The code follows the Standard code style.
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Copyright © 2016 Tomas Della Vedova
FAQs
Strigify and parse an callback-string
We found that callback-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.