Code coverage report for src/sfPath.js

Statements: 78.57% (11 / 14)      Branches: 40% (4 / 10)      Functions: 50% (2 / 4)      Lines: 78.57% (11 / 14)      Ignored: none     

All files » src/ » sfPath.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 341         1   1     1         1         1         1 1 1   1 1      
angular.module('schemaForm').provider('sfPath',
[function() {
 
  // When building with browserify ObjectPath is available as `objectpath` but othwerwise
  // it's called `ObjectPath`.
  var ObjectPath = window.ObjectPath || objectpath;
 
  var sfPath = {parse: ObjectPath.parse};
 
  // if we're on Angular 1.2.x, we need to continue using dot notation
  Iif (angular.version.major === 1 && angular.version.minor < 3) {
    sfPath.stringify = function(arr) {
      return Array.isArray(arr) ? arr.join('.') : arr.toString();
    };
  } else {
    sfPath.stringify = ObjectPath.stringify;
  }
 
  // We want this to use whichever stringify method is defined above,
  // so we have to copy the code here.
  sfPath.normalize = function(data, quote) {
    return sfPath.stringify(Array.isArray(data) ? data : sfPath.parse(data), quote);
  };
 
  // expose the methods in sfPathProvider
  this.parse = sfPath.parse;
  this.stringify = sfPath.stringify;
  this.normalize = sfPath.normalize;
 
  this.$get = function() {
    return sfPath;
  };
}]);