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

retext

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

76

index.js
'use strict';
var TextOMConstructor,
var nlcstToTextOM,
TextOMConstructor,
ParseLatin,
Ware,
has;
Ware;

@@ -12,2 +12,3 @@ /**

nlcstToTextOM = require('nlcst-to-textom');
TextOMConstructor = require('textom');

@@ -18,65 +19,2 @@ ParseLatin = require('parse-latin');

/**
* Cached, fast, secure existence test.
*/
has = Object.prototype.hasOwnProperty;
/**
* Transform a concrete syntax tree into a tree constructed
* from a given object model.
*
* @param {Object} TextOM - the object model.
* @param {Object} cst - the concrete syntax tree to
* transform.
* @return {Node} the node constructed from the
* CST and the object model.
*/
function fromCST(TextOM, cst) {
var index,
node,
children,
data,
attribute;
node = new TextOM[cst.type]();
if ('children' in cst) {
index = -1;
children = cst.children;
while (children[++index]) {
node.append(fromCST(TextOM, children[index]));
}
} else {
node.fromString(cst.value);
}
/**
* Currently, `data` properties are not really
* specified or documented. Therefore, the following
* branch is ignored by Istanbul.
*
* The idea is that plugins and parsers can each
* attach data to nodes, in a similar fashion to the
* DOMs dataset, which can be stringified and parsed
* back and forth between the concrete syntax tree
* and the node.
*/
/* istanbul ignore if: TODO, Untestable, will change soon. */
if ('data' in cst) {
data = cst.data;
for (attribute in data) {
if (has.call(data, attribute)) {
node.data[attribute] = data[attribute];
}
}
}
return node;
}
/**
* Construct an instance of `Retext`.

@@ -176,3 +114,3 @@ *

var self,
cst;
nlcst;

@@ -190,5 +128,5 @@ if (typeof done !== 'function') {

cst = self.parser.parse(value);
nlcst = self.parser.parse(value);
self.run(fromCST(self.TextOM, cst), done);
self.run(nlcstToTextOM(self.TextOM, nlcst), done);

@@ -195,0 +133,0 @@ return self;

7

package.json
{
"name": "retext",
"version": "0.2.0",
"version": "0.2.1",
"description": "Extensible system for analysing and manipulating natural language",

@@ -16,3 +16,4 @@ "license": "MIT",

"dependencies": {
"parse-latin": "^0.2.0-rc.3",
"nlcst-to-textom": "^0.0.1",
"parse-latin": "^0.2.0",
"textom": "^0.2.1",

@@ -29,3 +30,3 @@ "ware": "^1.2.0"

"istanbul": "^0.3.0",
"jscs": "^1.6.0",
"jscs": "^1.7.0",
"matcha": "^0.5.0",

@@ -32,0 +33,0 @@ "mocha": "^1.21.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