Comparing version 0.2.2 to 0.2.3
@@ -124,3 +124,12 @@ 'use strict'; | ||
if (data[i].ttl) ret += data[i].ttl + '\t'; | ||
ret += 'IN\tTXT\t"' + data[i].txt + '"\n'; | ||
ret += 'IN\tTXT\t'; | ||
var txtData = data[i].txt; | ||
if (txtData instanceof String || typeof txtData === 'string') { | ||
ret += '"' + txtData + '"'; | ||
} else if (txtData instanceof Array) { | ||
ret += txtData.map(function (datum) { | ||
return '"' + datum + '"'; | ||
}).join(' '); | ||
} | ||
ret += '\n'; | ||
} | ||
@@ -127,0 +136,0 @@ return template.replace('{txt}', ret); |
@@ -177,9 +177,21 @@ 'use strict'; | ||
var l = rrTokens.length; | ||
var tokenTxt = rrTokens[l - 1]; | ||
if (tokenTxt.indexOf('\"') > -1) { | ||
tokenTxt = tokenTxt.split('\"')[1]; | ||
var indexTXT = rrTokens.indexOf('TXT'); | ||
var stripText = function stripText(txt) { | ||
if (txt.indexOf('\"') > -1) { | ||
txt = txt.split('\"')[1]; | ||
} | ||
if (txt.indexOf('"') > -1) { | ||
txt = txt.split('"')[1]; | ||
} | ||
return txt; | ||
}; | ||
var tokenTxt = void 0; | ||
if (l - indexTXT - 1 > 1) { | ||
tokenTxt = rrTokens.slice(indexTXT + 1).map(stripText); | ||
} else { | ||
tokenTxt = stripText(rrTokens[l - 1]); | ||
} | ||
if (tokenTxt.indexOf('"') > -1) { | ||
tokenTxt = tokenTxt.split('"')[1]; | ||
} | ||
var result = { | ||
@@ -186,0 +198,0 @@ name: rrTokens[0], |
@@ -30,2 +30,22 @@ 'use strict'; | ||
records: ['uri'] | ||
}, { | ||
name: 'Multitext', | ||
json: require('../../testData/zonefile_forward_4.json'), | ||
text: _fs2.default.readFileSync('./testData/zonefile_reverse_multitxt.txt', 'utf8'), | ||
records: ['uri', 'txt'] | ||
}, { | ||
name: 'blockstack-client CLI constructed zonefile', | ||
json: require('../../testData/blockstack-cli-zonefile.json'), | ||
text: _fs2.default.readFileSync('./testData/blockstack-cli-zonefile.txt', 'utf8'), | ||
records: ['uri', 'txt'] | ||
}, { | ||
name: 'onename transfer constructed zonefile', | ||
json: require('../../testData/onename-transfer-zonefile.json'), | ||
text: _fs2.default.readFileSync('./testData/onename-transfer-zonefile.txt', 'utf8'), | ||
records: ['uri'] | ||
}, { | ||
name: 'browser generated zonefile', | ||
json: require('../../testData/browser-generated-zonefile.json'), | ||
text: _fs2.default.readFileSync('./testData/browser-generated-zonefile.txt', 'utf8'), | ||
records: ['uri'] | ||
}]; | ||
@@ -61,3 +81,3 @@ | ||
if (zoneFileReference.records.indexOf('txt') > -1) { | ||
t.equal(zoneFileJson['txt'][0]['txt'], zoneFileReference.json['txt'][0]['txt']); | ||
t.deepEqual(zoneFileJson['txt'][0]['txt'], zoneFileReference.json['txt'][0]['txt']); | ||
} | ||
@@ -64,0 +84,0 @@ if (zoneFileReference.records.indexOf('uri') > -1) { |
{ | ||
"name": "zone-file", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A DNS zone file parser and generator", | ||
"main": "lib/index", | ||
"scripts": { | ||
"compile": "rm -rf lib; babel --presets es2015 src -d lib", | ||
"compile": "rm -rf lib; babel --presets env src -d lib", | ||
"prepublish": "npm run compile", | ||
@@ -33,2 +33,5 @@ "test": "npm run compile; node lib/testing/unitTests.js" | ||
{ | ||
"name": "Aaron Blankstein" | ||
}, | ||
{ | ||
"name": "Elgs Chen" | ||
@@ -67,5 +70,5 @@ }, | ||
"babel-cli": "^6.7.5", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-env": "^1.6.1", | ||
"tape": "^4.5.1" | ||
} | ||
} |
# Zone File JS | ||
[![CircleCI](https://img.shields.io/circleci/project/blockstack/zone-file-js/master.svg)](https://circleci.com/gh/blockstack/zone-file-js/tree/master) | ||
[![npm](https://img.shields.io/npm/l/zone-file-js.svg)](https://www.npmjs.com/package/zone-file) | ||
[![npm](https://img.shields.io/npm/v/zone-file-js.svg)](https://www.npmjs.com/package/zone-file) | ||
[![npm](https://img.shields.io/npm/dm/zone-file-js.svg)](https://www.npmjs.com/package/zone-file) | ||
[![npm](https://img.shields.io/npm/l/zone-file.svg)](https://www.npmjs.com/package/zone-file) | ||
[![npm](https://img.shields.io/npm/v/zone-file.svg)](https://www.npmjs.com/package/zone-file) | ||
[![npm](https://img.shields.io/npm/dm/zone-file.svg)](https://www.npmjs.com/package/zone-file) | ||
[![Slack](http://chat.blockstack.org/badge.svg)](http://chat.blockstack.org/) | ||
@@ -8,0 +8,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41263
28
860