Skip to content

Commit d6dcadc

Browse files
committed
fix issue #10 + refactoring
1 parent 4e20160 commit d6dcadc

11 files changed

+4196
-293
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ jspm_packages
3737
.node_repl_history
3838

3939
.idea
40+
dist

README.md

+42-42
Original file line numberDiff line numberDiff line change
@@ -84,123 +84,123 @@ Adding date directive to graphql query for formatting the result using [Moment](
8484

8585
- Using default date format:
8686
```javascript
87-
query {
88-
input(value: "2016-01-01T00:00:00") @date
89-
}
87+
query {
88+
input(value: "2016-01-01T00:00:00") @date
89+
}
9090
// => { input: "01 Jan 2016 00:00" }
9191
```
9292
- Using specific moment format:
9393
```javascript
94-
query {
95-
input(value: "2016-01-01T00:00:00") @date(as:"YYYY")
94+
query {
95+
input(value: "2016-01-01T00:00:00") @date(as:"YYYY")
9696
}
9797
// => { input: "2016" }
9898
```
9999
- Using days ago format
100100
```javascript
101-
query {
102-
input(value: "${(new Date).toISOString()}") @date(as:"days ago")
101+
query {
102+
input(value: "${(new Date).toISOString()}") @date(as:"days ago")
103103
}
104-
// => { input: "0 days ago" }
104+
// => { input: "0 days ago" }
105105
```
106106

107107
### Number formatting directives
108108

109-
Adding number directive to graphql query for formatting the result using [Numeral-js](https://github.com/adamwdraper/Numeral-js).
109+
Adding number directive to graphql query for formatting the result using [Numeral-js](https://github.com/adamwdraper/Numeral-js).
110110

111111
- Using default format:
112112
```javascript
113-
query {
114-
input(value: "1500.404") @number
113+
query {
114+
input(value: "1500.404") @number
115115
}
116116
// => { input: "1,500" }
117-
```
117+
```
118118
- Using specific numeral format:
119119
```javascript
120-
query {
121-
input(value: "-1500.404") @number(as:"(0,0.00)")
120+
query {
121+
input(value: "-1500.404") @number(as:"(0,0.00)")
122122
}
123123
// => { input: "(1,500.40)" }
124124
```
125125
- Using default currency format:
126126
```javascript
127-
query {
128-
input(value: "1500") @currency
127+
query {
128+
input(value: "1500") @currency
129129
}
130-
// => { input: "$1,500)" }
130+
// => { input: "$1,500)" }
131131
```
132132

133133
### String formatting directives
134134

135-
Adding string directive to graphql query for formatting the result using [Lodash](https://github.com/lodash/lodash).
135+
Adding string directive to graphql query for formatting the result using [Lodash](https://github.com/lodash/lodash).
136136

137-
- Using lowerCase directive:
137+
- Using lowerCase directive:
138138

139139
```javascript
140-
query {
141-
input(value: "FOO BAR") @lowerCase
140+
query {
141+
input(value: "FOO BAR") @lowerCase
142142
}
143143
// => { input: "foo bar" }
144144
```
145145

146146
- Using upperCase directive:
147147

148148
```javascript
149-
query {
150-
input(value: "foo bar") @upperCase
149+
query {
150+
input(value: "foo bar") @upperCase
151151
}
152152
// => { input: "FOO BAR" }
153153
```
154154

155155
- Using camelCase directive:
156156

157157
```javascript
158-
query {
159-
input(value: "foo bar") @camelCase
158+
query {
159+
input(value: "foo bar") @camelCase
160160
}
161161
// => { input: "fooBar" }
162162
```
163163

164-
- Using startCase directive:
164+
- Using startCase directive:
165165

166166
```javascript
167-
query {
168-
input(value: "foo bar") @startCase
167+
query {
168+
input(value: "foo bar") @startCase
169169
}
170170
// => { input: "Foo Bar" }
171171
```
172172

173173
- Using capitalize directive:
174174

175175
```javascript
176-
query {
177-
input(value: "foo bar") @capitalize
176+
query {
177+
input(value: "foo bar") @capitalize
178178
}
179179
// => { input: "Foo var" }
180180
```
181181

182-
- Using kebabCase directive:
182+
- Using kebabCase directive:
183183

184184
```javascript
185-
query {
186-
input(value: "foo bar") @kebabCase
185+
query {
186+
input(value: "foo bar") @kebabCase
187187
}
188188
// => { input: "foo-bar" }
189189
```
190190

191191
- Using trim directive:
192192

193193
```javascript
194-
query {
195-
input(value: " foo bar ") @trim
194+
query {
195+
input(value: " foo bar ") @trim
196196
}
197197
// => { input: "foo bar" }
198198
```
199199

200200
- Using default directive:
201201

202202
```javascript
203-
query {
203+
query {
204204
input @default(to:"N/A")
205205
}
206206
// => { input: "N/A" }
@@ -209,25 +209,25 @@ Adding string directive to graphql query for formatting the result using [Lodash
209209
- Using toLower directive:
210210

211211
```javascript
212-
query {
213-
input(value: "FOO BAR") @toLower
212+
query {
213+
input(value: "FOO BAR") @toLower
214214
}
215215
// => { input: "foo bar" }
216216
```
217217

218218
- Using toUpper directive:
219219

220220
```javascript
221-
query {
222-
input(value: "foo bar") @toUpper
221+
query {
222+
input(value: "foo bar") @toUpper
223223
}
224224
// => { input: "FOO BAR" }
225225
```
226226

227227
- Using template directive:
228228

229229
```javascript
230-
query {
230+
query {
231231
input(value: "foo bar") @template(as:"${input} ${toUpper(input)}")
232232
}
233233
// => { input: "foo bar FOO BAR" }
@@ -236,7 +236,7 @@ Adding string directive to graphql query for formatting the result using [Lodash
236236
- Using template together with trim and toUpper directives:
237237

238238
```javascript
239-
query {
239+
query {
240240
input(value: " foo bar ") @trim @template(as:"${input} ${input}") @toUpper
241241
}
242242
// => { input: "FOO BAR FOO BAR" }

0 commit comments

Comments
 (0)