hadron-document
Advanced tools
Comparing version 0.25.1 to 0.26.0
@@ -51,2 +51,7 @@ 'use strict'; | ||
/** | ||
* Regex to match an array or object string. | ||
*/ | ||
const ARRAY_OR_OBJECT = /^(\[|\{)(.+)(\]|\})$/; | ||
/** | ||
* Represents an element in a document. | ||
@@ -57,2 +62,15 @@ */ | ||
/** | ||
* Bulk edit the element. Can accept JSON strings. | ||
* | ||
* @param {String} value - The JSON string value. | ||
*/ | ||
bulkEdit(value) { | ||
if (value.match(ARRAY_OR_OBJECT)) { | ||
this.edit(JSON.parse(value)); | ||
} else { | ||
this.edit(value); | ||
} | ||
} | ||
/** | ||
* Create the element. | ||
@@ -59,0 +77,0 @@ * |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/hadron-document", | ||
"version": "0.25.1", | ||
"version": "0.26.0", | ||
"repository": { | ||
@@ -10,0 +10,0 @@ "type": "git", |
32222
791