Skip to content

Commit eb78488

Browse files
committed
Use objectpath more genericallyto fix requirejs issues
1 parent a313ef6 commit eb78488

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"angular": ">= 1.2",
3333
"tv4": "~1.0.15",
3434
"angular-sanitize": ">= 1.2",
35-
"objectpath": "~1.0.4"
35+
"objectpath": "~1.1.0"
3636
},
3737
"devDependencies": {
3838
"angular-ui-ace": "bower",

src/module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Deps is sort of a problem for us, maybe in the future we will ask the user to depend
22
// on modules for add-ons
33

4-
var deps = ['ObjectPath'];
4+
var deps = [];
55
try {
66
//This throws an expection if module does not exist.
77
angular.module('ngSanitize');

src/sfPath.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
angular.module('schemaForm').provider('sfPath',
2-
['ObjectPathProvider', function(ObjectPathProvider) {
3-
var ObjectPath = {parse: ObjectPathProvider.parse};
2+
[function() {
3+
var sfPath = {parse: ObjectPath.parse};
44

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

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

20-
this.parse = ObjectPath.parse;
21-
this.stringify = ObjectPath.stringify;
22-
this.normalize = ObjectPath.normalize;
20+
// expose the methods in sfPathProvider
21+
this.parse = sfPath.parse;
22+
this.stringify = sfPath.stringify;
23+
this.normalize = sfPath.normalize;
24+
2325
this.$get = function() {
24-
return ObjectPath;
26+
return sfPath;
2527
};
2628
}]);

0 commit comments

Comments
 (0)