You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2018/04/05 21:21:19 UTC
[couchdb-documentation] 01/01: Start JS development tips doc
This is an automated email from the ASF dual-hosted git repository.
wohali pushed a commit to branch migrate-working-with-forms
in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git
commit 560fe00e4479d4d7ca9543f825e76b3e21139663
Author: Joan Touzet <jo...@atypical.net>
AuthorDate: Thu Apr 5 16:50:32 2018 -0400
Start JS development tips doc
---
.travis.yml | 2 +-
src/best-practices/index.rst | 1 +
src/best-practices/jsdevel.rst | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index ff8d8b0..4eba051 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: python
python:
- 2.7
- - 3.4
+ - 3.6
install:
- pip install sphinx sphinx_rtd_theme
diff --git a/src/best-practices/index.rst b/src/best-practices/index.rst
index 40d1e4d..0ea8c7a 100644
--- a/src/best-practices/index.rst
+++ b/src/best-practices/index.rst
@@ -25,3 +25,4 @@ system.
:maxdepth: 2
forms
+ jsdevel
diff --git a/src/best-practices/jsdevel.rst b/src/best-practices/jsdevel.rst
new file mode 100644
index 0000000..f10c618
--- /dev/null
+++ b/src/best-practices/jsdevel.rst
@@ -0,0 +1,35 @@
+.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
+.. use this file except in compliance with the License. You may obtain a copy of
+.. the License at
+..
+.. http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing, software
+.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+.. License for the specific language governing permissions and limitations under
+.. the License.
+
+.. _best-practices/jsdevel:
+
+===========================
+JavaScript development tips
+===========================
+
+Working with Apache CouchDB's JavaScript environment is a lot different than
+working with traditional JavaScript development environments. Here are some
+tips and tricks that will ease the difficulty.
+
+.. rst-class:: open
+
+- Remember that CouchDB's JavaScript engine is old, only supporting the
+ ECMA-262 5th edition ("ES5") of the language. ES6/2015 and newer constructs
+ cannot be used.
+
+- The ``log()`` function will log output to the CouchDB log file or stream.
+ You can log strings, objects, and arrays directly, without first converting
+ to JSON. Use this in conjunction with a local CouchDB instance for best
+ results.
+
+- Be sure to guard all document accesses to avoid exceptions when fields
+ or subfields are missing: ``if (doc && doc.myarray && doc.myarray.length)...``
--
To stop receiving notification emails like this one, please contact
wohali@apache.org.