Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zone-file

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zone-file - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

testData/blockstack-cli-zonefile.json

11

lib/makeZoneFile.js

@@ -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);

24

lib/parseZoneFile.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc