Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: lib/src/prism/tests/helper/token-stream-transformer.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 "use strict";
2
3
4 module.exports = {
5 /**
6 * Simplifies the token stream to ease the matching with the expected to ken stream.
7 *
8 * * Strings are kept as-is
9 * * In arrays each value is transformed individually
10 * * Values that are empty (empty arrays or strings only containing whit espace)
11 *
12 *
13 * @param {Array} tokenStream
14 * @returns {Array.<string[]|Array>}
15 */
16 simplify: function (tokenStream) {
17 if (Array.isArray(tokenStream)) {
18 return tokenStream
19 .map(this.simplify.bind(this))
20 .filter(function (value) {
21 return !(Array.isArray(value) && !value. length) && !(typeof value === "string" && !value.trim().length);
22 }
23 );
24 }
25 else if (typeof tokenStream === "object") {
26 return [tokenStream.type, this.simplify(tokenStream.cont ent)];
27 }
28 else {
29 return tokenStream;
30 }
31 }
32 };
OLDNEW
« no previous file with comments | « lib/src/prism/tests/helper/test-discovery.js ('k') | lib/src/prism/tests/languages/abap/comment_feature.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698