New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sbd

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sbd - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

lib/sanitize-html-browser.js

5

lib/tokenizer.js
/*jshint node:true, laxcomma:true */
"use strict";
var sugar = require('sugar');
var sanitizeHtml = require('sanitize-html');

@@ -32,7 +31,7 @@

// Split the text into words
var words = text.words();
var words = text.match(/\S+/g); // see http://blog.tompawlak.org/split-string-into-tokens-javascript
var sentences = [];
var current = [];
for (i in words) {
for (i=0; i<words.length; i++) {
// Add the word to current sentence

@@ -39,0 +38,0 @@ current.push(words[i]);

8

package.json
{
"name": "sbd",
"version": "0.0.4",
"version": "0.0.5",
"description": "Split text into sentences",

@@ -30,5 +30,7 @@ "main": "lib/tokenizer.js",

"dependencies": {
"sanitize-html": "^1.4.3",
"sugar": "~1.4.1"
"sanitize-html": "^1.4.3"
},
"browser": {
"sanitize-html": "./lib/sanitize-html-browser.js"
}
}

@@ -18,2 +18,12 @@ /*jshint node:true, laxcomma:true */

describe('Difficult single sentence', function () {
var entry = "On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S.";
var sentences = tokenizer.sentences(entry);
it('should get one sentence', function () {
console.log(sentences);
assert.equal(sentences.length, 1);
});
});
describe('Two sentences', function () {

@@ -28,2 +38,12 @@ var entry = "Hello this is my first sentence . There is also a second.";

describe('Difficult two sentences', function () {
var entry = "On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S. Millions attended the Inauguration.";
var sentences = tokenizer.sentences(entry);
it('should get one sentence', function () {
console.log(sentences);
assert.equal(sentences.length, 2);
});
});
describe('Dot in middle of word is skipped', function () {

@@ -160,3 +180,2 @@ var entry = "Hello.this is my first sentence.";

it("should get 2 sentences", function () {
console.log(sentences);
assert.equal(sentences.length, 2);

@@ -163,0 +182,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