|
1 | 1 | angular.module('schemaForm').provider('sfPath', |
2 | | -['ObjectPathProvider', function(ObjectPathProvider) { |
3 | | - var ObjectPath = {parse: ObjectPathProvider.parse}; |
| 2 | +[function() { |
| 3 | + var sfPath = {parse: ObjectPath.parse}; |
4 | 4 |
|
5 | 5 | // if we're on Angular 1.2.x, we need to continue using dot notation |
6 | 6 | if (angular.version.major === 1 && angular.version.minor < 3) { |
7 | | - ObjectPath.stringify = function(arr) { |
| 7 | + sfPath.stringify = function(arr) { |
8 | 8 | return Array.isArray(arr) ? arr.join('.') : arr.toString(); |
9 | 9 | }; |
10 | 10 | } else { |
11 | | - ObjectPath.stringify = ObjectPathProvider.stringify; |
| 11 | + sfPath.stringify = ObjectPath.stringify; |
12 | 12 | } |
13 | 13 |
|
14 | 14 | // We want this to use whichever stringify method is defined above, |
15 | 15 | // 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); |
18 | 18 | }; |
19 | 19 |
|
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 | + |
23 | 25 | this.$get = function() { |
24 | | - return ObjectPath; |
| 26 | + return sfPath; |
25 | 27 | }; |
26 | 28 | }]); |
0 commit comments