juniper.js

About this file

This file contains a function that allows for addition of parsley validation to x-editable form documents, written by Ben Tempchin.

Code Check Report




    5:1   error    Unnecessary semicolon                                                                                       no-extra-semi
    5:34  error    Shadowing of global property 'undefined'                                                                    no-shadow-restricted-names
   25:40  warning  Function has a complexity of 8                                                                              complexity
   50:31  warning  Function has a complexity of 7                                                                              complexity
   59:21  error    The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype  guard-for-in
   80:13  error    Expected an assignment or function call and instead saw an expression                                       no-unused-expressions
  106:23  error    Value of 'e' may be overwritten in IE 8 and earlier                                                         no-catch-shadow

✖ 7 problems (5 errors, 2 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
                        

Documentation drawn from source code

/*
* Juniper.js allows you to add Parsley.js validation to X-editable form elements
* Author: Ben Tempchin
*/
;(function ($, window, document, undefined) {
  function Juniper (element, options) {
   _createDomApi: function () {
     var deserializeValue = function(value) {
     var camelize = function (str) {
      return str.replace(/-+(.)?/g, function (match, chr) {
     /* PARSLEY DOM API
     * =================================================== */
     $.fn.domApi = function (namespace) {
   _decamelize: function (str) {
    return str.replace(/(\w)([A-Z])/g, function (match, chr0, chr1) {
   _getElementData: function () {
   _getElements: function (editable) {
   _onElementShown: function (e, editable) {
    $.each(this.validationData, function (key, value) {
      classHandler: function () {
      container: function () {
   _validateElement: function () {
  Juniper.prototype.init = function () {
   $.each(this.validationData, function () { count += 1; });
  $.fn[pluginName] = function (options) {
   return this.each(function () {

Source code