Comparing version 0.1.2 to 0.1.3
@@ -82,2 +82,10 @@ 'use strict'; | ||
}, | ||
hasKey: (place) => { | ||
const parts = search(place); | ||
if (parts[1].length == 0) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
}, | ||
insertChild: (place, doc) => { | ||
@@ -84,0 +92,0 @@ let parts = search(place); |
{ | ||
"name": "yaml-edit", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Library for editing yaml files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,2 +39,6 @@ # yaml-edit | ||
### Checking whether a key already exists | ||
Existance of a key can be checked with the `hasKey(string target)` method. Returns true if the key is found, false otherwise. | ||
### Getting the resulting YAML string | ||
@@ -41,0 +45,0 @@ |
@@ -83,2 +83,14 @@ 'use strict'; | ||
it('hasKey() returns true for existing key', (done) => { | ||
yamlEdit.init(sampleYaml); | ||
expect(yamlEdit.hasKey('functions.hello')).to.be.equal(true); | ||
done(); | ||
}); | ||
it('hasKey() returns false for non-existing key', (done) => { | ||
yamlEdit.init(sampleYaml); | ||
expect(yamlEdit.hasKey('functions.non-existing')).to.be.equal(false); | ||
done(); | ||
}); | ||
it('insertChild (deeper level)', (done) => { | ||
@@ -85,0 +97,0 @@ yamlEdit.init(sampleYaml); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9071
204
68