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

orgast-util-to-string

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orgast-util-to-string - npm Package Compare versions

Comparing version 0.4.5 to 0.5.0

23

lib/index.js

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toString = void 0;
/**

@@ -9,18 +6,18 @@ * Get the text content of a node.

*/
function toString(node, _options = {}) {
export function toString(node, _options = {}) {
return one(node);
}
exports.toString = toString;
function one(node) {
if (!node) {
const n = node;
if (!n) {
return '';
}
if (Array.isArray(node)) {
return all(node);
if (Array.isArray(n)) {
return all(n);
}
if (typeof node.value === 'string') {
return node.value;
if (typeof n.value === 'string') {
return n.value;
}
if ('children' in node) {
return all(node.children);
if ('children' in n) {
return all(n.children);
}

@@ -32,3 +29,3 @@ return '';

}
exports.default = toString;
export default toString;
//# sourceMappingURL=index.js.map
{
"name": "orgast-util-to-string",
"version": "0.4.5",
"version": "0.5.0",
"type": "module",
"description": "uniorg (orgast) utility to get the plain text content of a node",

@@ -40,10 +41,10 @@ "keywords": [

"devDependencies": {
"@types/jest": "^26.0.23",
"@types/unist": "^2.0.3",
"jest": "^26.6.3",
"typescript": "^4.3.2",
"uniorg": "^0.4.0",
"uniorg-parse": "^0.4.5"
"@types/jest": "27.4.1",
"@types/unist": "2.0.6",
"jest": "27.5.1",
"typescript": "4.6.3",
"uniorg": "^0.5.0",
"uniorg-parse": "^0.5.0"
},
"gitHead": "3d6bc077f2ee16eebf35d57e6b93d98022e0b65d"
"gitHead": "e77afd8255895985eaa8b0cf15de8edab81a89b6"
}

@@ -11,7 +11,6 @@ # `orgast-util-to-string`

## Use
```js
import unified from 'unified';
import { unified } from 'unified';
import uniorgParse from 'uniorg-parse';

@@ -21,4 +20,4 @@ import { toString } from 'orgast-util-to-string';

const tree = unified()
.use(uniorgParse)
.parse('Some /emphasis/, *importance*, and ~code~.');
.use(uniorgParse)
.parse('Some /emphasis/, *importance*, and ~code~.');

@@ -28,6 +27,4 @@ console.log(toString(tree)); //=> 'Some emphasis, importance, and code.'

## API
### `toString(node[, options])`

@@ -41,5 +38,4 @@

## License
[GNU General Public License v3.0 or later](./LICENSE)

Sorry, the diff of this file is not supported yet

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