Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"angular": ">= 1.2",
"tv4": "~1.0.15",
"angular-sanitize": ">= 1.2",
"objectpath": "~1.0.4"
"objectpath": "~1.1.0"
},
"devDependencies": {
"angular-ui-ace": "bower",
Expand Down
2 changes: 1 addition & 1 deletion src/module.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Deps is sort of a problem for us, maybe in the future we will ask the user to depend
// on modules for add-ons

var deps = ['ObjectPath'];
var deps = [];
try {
//This throws an expection if module does not exist.
angular.module('ngSanitize');
Expand Down
22 changes: 12 additions & 10 deletions src/sfPath.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
angular.module('schemaForm').provider('sfPath',
['ObjectPathProvider', function(ObjectPathProvider) {
var ObjectPath = {parse: ObjectPathProvider.parse};
[function() {
var sfPath = {parse: ObjectPath.parse};

// if we're on Angular 1.2.x, we need to continue using dot notation
if (angular.version.major === 1 && angular.version.minor < 3) {
ObjectPath.stringify = function(arr) {
sfPath.stringify = function(arr) {
return Array.isArray(arr) ? arr.join('.') : arr.toString();
};
} else {
ObjectPath.stringify = ObjectPathProvider.stringify;
sfPath.stringify = ObjectPath.stringify;
}

// We want this to use whichever stringify method is defined above,
// so we have to copy the code here.
ObjectPath.normalize = function(data, quote) {
return ObjectPath.stringify(Array.isArray(data) ? data : ObjectPath.parse(data), quote);
sfPath.normalize = function(data, quote) {
return sfPath.stringify(Array.isArray(data) ? data : sfPath.parse(data), quote);
};

this.parse = ObjectPath.parse;
this.stringify = ObjectPath.stringify;
this.normalize = ObjectPath.normalize;
// expose the methods in sfPathProvider
this.parse = sfPath.parse;
this.stringify = sfPath.stringify;
this.normalize = sfPath.normalize;

this.$get = function() {
return ObjectPath;
return sfPath;
};
}]);