@samitouri / QOS-React-2 / commits / a4f8ad1bb0

Switch utility function calls -> namespaced calls

JeffMo committed Oct 31, 2013 at 13:45 UTC a4f8ad1bb0ef6bd7dff3483471fbfb9815538a5d
1 file changed +18 -20
vendor/fbtransform/transforms/xjs.js
+18 -20
@@ -15,10 +15,8 @@
15 */
16 /*global exports:true*/
17 "use strict";
18 -var append = require('jstransform/src/utils').append;
19 -var catchup = require('jstransform/src/utils').catchup;
20 -var move = require('jstransform/src/utils').move;
18 var Syntax = require('esprima-fb').Syntax;
19 +var utils = require('jstransform/src/utils');
20
21 var knownTags = {
22 a: true,
@@ -176,9 +174,9 @@ function renderXJSLiteral(object, isLast, state, start, end) {
174
175 if (trimmedChildValue) {
176 // head whitespace
179 - append(object.value.match(/^[\t ]*/)[0], state);
177 + utils.append(object.value.match(/^[\t ]*/)[0], state);
178 if (start) {
181 - append(start, state);
179 + utils.append(start, state);
180 }
181
182 var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
@@ -200,7 +198,7 @@ function renderXJSLiteral(object, isLast, state, start, end) {
198 var lastLine = ii === numLines - 1;
199 var trimmedLine = safeTrim(line);
200 if (trimmedLine === '' && !lastLine) {
203 - append(line, state);
201 + utils.append(line, state);
202 } else {
203 var preString = '';
204 var postString = '';
@@ -226,7 +224,7 @@ function renderXJSLiteral(object, isLast, state, start, end) {
224 postString = ' ';
225 }
226
229 - append(
227 + utils.append(
228 leading +
229 JSON.stringify(
230 preString + trimmedLine + postString
@@ -236,45 +234,45 @@ function renderXJSLiteral(object, isLast, state, start, end) {
234 state);
235 }
236 if (!lastLine) {
239 - append('\n', state);
237 + utils.append('\n', state);
238 }
239 });
240 } else {
241 if (start) {
244 - append(start, state);
242 + utils.append(start, state);
243 }
246 - append('""', state);
244 + utils.append('""', state);
245 }
246 if (end) {
249 - append(end, state);
247 + utils.append(end, state);
248 }
249
250 // add comma before trailing whitespace
251 if (!isLast) {
254 - append(',', state);
252 + utils.append(',', state);
253 }
254
255 // tail whitespace
256 if (hasFinalNewLine) {
259 - append('\n', state);
257 + utils.append('\n', state);
258 }
261 - append(object.value.match(/[ \t]*$/)[0], state);
262 - move(object.range[1], state);
259 + utils.append(object.value.match(/[ \t]*$/)[0], state);
260 + utils.move(object.range[1], state);
261 }
262
263 function renderXJSExpressionContainer(traverse, object, isLast, path, state) {
264 // Plus 1 to skip `{`.
267 - move(object.range[0] + 1, state);
265 + utils.move(object.range[0] + 1, state);
266 traverse(object.expression, path, state);
267 if (!isLast && object.expression.type !== Syntax.XJSEmptyExpression) {
268 // If we need to append a comma, make sure to do so after the expression.
271 - catchup(object.expression.range[1], state);
272 - append(',', state);
269 + utils.catchup(object.expression.range[1], state);
270 + utils.append(',', state);
271 }
272
273 // Minus 1 to skip `}`.
276 - catchup(object.range[1] - 1, state);
277 - move(object.range[1], state);
274 + utils.catchup(object.range[1] - 1, state);
275 + utils.move(object.range[1], state);
276 return false;
277 }
278