JavaScript's function client-server synchronization helper library.

npm install funcsync
32 downloads in the last week
38 downloads in the last month


Funcsync is a dependency-free extremely small library helping to exchange/synchronize functions between server and client side.

Prepares an object - might containing business logic as function - for sending in a text format (JSON for example) and vice versa.



Command line:

npm install funcsync

In node.js code:

var f = require('funcsync');
var obj = {
        function test1(){ console.log("My "); },
        function test2(){ console.log("dear "); }
    "tab2":{ "test3": function(){ console.log("user:" +; } }
f.stringify( obj ) // prepare the given object for sending
var fs = f.functify( obj, {nane:'Bob'} ); // retrieve functions from the obj received

Bind context

The function functify has an optional second parameter: context. All function will access this context, through the variable name self while being executed.

This way you can bind a knockout.js viewmodel or anything you want and can access it via the name 'self'.


In head

<script src='funcsync.min.js'></script>

In any script tag

funcsync.stringify( obj );

For a more complex scenario please find a complex project boilerplate: Division.js, where one business model is defined and maintained allowing you to use the same objects - including model and validation and computed values and associated functions - on both client side, server side and DB interaction!

npm loves you