From 2275a28314d560c2ef6a459d7633fe9103a816df Mon Sep 17 00:00:00 2001 From: AlexKVal Date: Tue, 30 Jun 2015 21:56:36 +0300 Subject: [PATCH] Small regexp refactorings. --- docs/generate-metadata.js | 4 ++-- docs/src/PropTable.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generate-metadata.js b/docs/generate-metadata.js index b8b2318813..4cbef95619 100644 --- a/docs/generate-metadata.js +++ b/docs/generate-metadata.js @@ -16,9 +16,9 @@ let cleanDoclets = desc => { return (idx === -1 ? desc : desc.substr(0, idx )).trim(); }; -let cleanDocletValue = str => str.replace(/^\{/, '').replace(/\}$/, ''); +let cleanDocletValue = str => str.replace(/^\{|\}$/g, ''); -let isLiteral = str => str.trim()[0] === '"' || str.trim()[0] === "'"; +let isLiteral = str => (/^('|")/).test(str.trim()); /** * parse out description doclets to an object and remove the comment diff --git a/docs/src/PropTable.js b/docs/src/PropTable.js index 686afbf180..9d585145c0 100644 --- a/docs/src/PropTable.js +++ b/docs/src/PropTable.js @@ -5,7 +5,7 @@ import Label from '../../src/Label'; import Table from '../../src/Table'; -let cleanDocletValue = str => str.replace(/^\{/, '').replace(/\}$/, ''); +let cleanDocletValue = str => str.replace(/^\{|\}$/g, ''); const PropTable = React.createClass({