UNPKG

@danielkalen/simplybind

Version:

Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.

14 lines (8 loc) 651 B
SimplyBind = (subject, options, saveOptions, publisher, isSibling)-> if (!subject and subject isnt 0) or (!checkIf.isString(subject) and !checkIf.isNumber(subject) and !checkIf.isFunction(subject) and subject not instanceof Array) throwError('invalidParamName') unless checkIf.isBindingInterface(subject) if checkIf.isObject(subject) and subject not instanceof Array # Indicates it's a Binding instance object due to the above check return if publisher then subject.addToPublisher(publisher) return subject.selfClone(1) else return new BindingInterface null, 0, subject, options, publisher, isSibling, saveOptions import methods.coffee