Socket
Socket
Sign inDemoInstall

cnd

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnd - npm Package Compare versions

Comparing version 3.2.0 to 4.0.5

65

lib/BITSNPIECES.js
// Generated by CoffeeScript 1.10.0
(function() {
var CND, LODASH, njs_fs, njs_path, njs_util, permute, rpr, validate_isa_number,
slice = [].slice,
var CND, njs_fs, njs_path, njs_util, rpr, validate_isa_number,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -11,6 +10,2 @@

LODASH = require('lodash');
permute = require('permute');
njs_util = require('util');

@@ -22,13 +17,2 @@

this.equals = function() {
var P, arity;
P = 1 <= arguments.length ? slice.call(arguments, 0) : [];
/* `assert.deepEqual` is broken as of https://github.com/joyent/node/issues/7161 */
if (!((arity = P.length) > 1)) {
throw new Error("expected at least 2 arguments, got " + arity);
}
return (require('equals')).apply(null, P);
};
this.format_number = function(n, grouper) {

@@ -77,3 +61,3 @@ var f, h;

/* `BAP.find_all` expects a `text` and a `matcher` (which must be a RegExp object); it returns a
/* `CND.find_all` expects a `text` and a `matcher` (which must be a RegExp object); it returns a
(possibly empty) list of all matching parts in the text. If `matcher` does not have the `g` (global) flag

@@ -171,42 +155,3 @@ set, a new RegExp object will be cloned behind the scenes, so passsing in a regular expression with `g`

this.ez_permute = function(list) {
/* A wrapper of [Ben Noordhuis's `permute`](https://github.com/bnoordhuis/node-permute), this method
provides permutations of value in a list. It has been given the `ez` prefix to indicate that while
it is straightforward to use, it's range of applicability is also somewhat limited.
Basic usage looks like this:
```coffee
demo_permute = ->
d = [ 'A', 'B', 'C', ]
nr = 0
loop
nr += +1
help nr, d
break unless BNP.ez_permute d
```
You will see 6 permutations, which is great:
```
1 [ 'A', 'B', 'C' ]
2 [ 'A', 'C', 'B' ]
3 [ 'B', 'A', 'C' ]
4 [ 'B', 'C', 'A' ]
5 [ 'C', 'A', 'B' ]
6 [ 'C', 'B', 'A' ]
```
So that's really E-Z. But, one may ask: how does `ez_permute` know when it's done all permuations? That's
where the limitations come in. What `ez_permute` really does is it nudges whatever sequence you throw at
it one step closer to being sorted in a descending order; accordingly, when you give it a sequence that
is shuffled, then you will get an indeterminate number of permutations; when you pass in a sequence sorted
in the reverse, you will get *no* additional permuation at all, because that's the final state of the
algorithm.
*/
return permute(list);
};
/* see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number */

@@ -300,4 +245,4 @@

BAP = require 'coffeenode-bitsnpieces'
rnd = BAP.get_rnd() # or, say, `rnd = BAP.get_rnd 123, 0.5`
CND = require 'cnd'
rnd = CND.get_rnd() # or, say, `rnd = CND.get_rnd 123, 0.5`
log rnd() for idx in [ 0 .. 5 ]

@@ -563,3 +508,3 @@ log()

create_rnd_id = BAP.get_create_rnd_id 1234, 87.23
create_rnd_id = CND.get_create_rnd_id 1234, 87.23

@@ -566,0 +511,0 @@ * three different user IDs:

@@ -9,14 +9,2 @@ // Generated by CoffeeScript 1.10.0

this.LODASH = require('lodash');
this.TSORT = require('./TSORT');
this.BLOOM = require('./BLOOM');
this.XJSON = require('./XJSON');
this.columnify = require('columnify');
this.INTERSKIPLIST = require('./INTERSKIPLIST');
method_count = 0;

@@ -23,0 +11,0 @@

// Generated by CoffeeScript 1.10.0
(function() {
var CND, SL, TRM, alert, badge, debug, echo, help, include, info, log, njs_path, praise, rpr, test, urge, warn, whisper,
var CND, TRM, alert, badge, debug, echo, help, include, info, log, njs_path, praise, rpr, test, urge, warn, whisper,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -36,63 +36,4 @@

SL = CND.INTERSKIPLIST;
test = require('guy-test');
this['test interval tree 1'] = function(T) {
var find, hi, i, id, intervals, len, lo, ref, skiplist, value;
find = function(skiplist, probe) {
var R;
R = SL.find_any_ids(skiplist, probe);
R.sort();
return R.join(',');
};
skiplist = SL["new"]();
intervals = [[1, 3, 'A'], [2, 14, 'B'], [3, 7, 'C'], [4, 4, 'D'], [5, 7, 'E'], [8, 12, 'F1'], [8, 12, 'F2'], [8, 22, 'G'], [10, 13, 'H']];
for (i = 0, len = intervals.length; i < len; i++) {
ref = intervals[i], lo = ref[0], hi = ref[1], id = ref[2], value = ref[3];
SL.add_interval(skiplist, lo, hi, id, value);
}
T.eq(find(skiplist, 0), '');
T.eq(find(skiplist, 1), 'A');
T.eq(find(skiplist, 2), 'A,B');
T.eq(find(skiplist, 3), 'A,B,C');
T.eq(find(skiplist, 4), 'B,C,D');
T.eq(find(skiplist, 5), 'B,C,E');
T.eq(find(skiplist, 6), 'B,C,E');
T.eq(find(skiplist, 7), 'B,C,E');
T.eq(find(skiplist, 8), 'B,F1,F2,G');
T.eq(find(skiplist, 9), 'B,F1,F2,G');
T.eq(find(skiplist, 10), 'B,F1,F2,G,H');
T.eq(find(skiplist, 11), 'B,F1,F2,G,H');
T.eq(find(skiplist, 12), 'B,F1,F2,G,H');
T.eq(find(skiplist, 13), 'B,G,H');
T.eq(find(skiplist, 14), 'B,G');
T.eq(find(skiplist, 15), 'G');
T.eq(find(skiplist, 16), 'G');
T.eq(find(skiplist, 17), 'G');
T.eq(find(skiplist, 18), 'G');
return null;
};
this['_test interval tree 2'] = function() {
var error_count, i, interval, intervals, len, tree;
tree = SL.new_tree();
intervals = [[17, 19, 'A'], [5, 8, 'B'], [21, 24, 'C'], [4, 8, 'D'], [15, 18, 'E'], [7, 10, 'F'], [16, 22, 'G']];
for (i = 0, len = intervals.length; i < len; i++) {
interval = intervals[i];
SL.add_interval(tree, interval);
}
SL._decorate(tree['%self']['root']);
show(tree['%self']['root']);
error_count = 0;
debug(rpr(find(tree, [8, 9])));
debug(rpr(find(tree, [5, 8])));
debug(rpr(find(tree, [21, 24])));
debug(rpr(find(tree, [4, 8])));
if (error_count !== 0) {
throw Error("there were " + error_count + " errors");
}
return null;
};
this['test type_of'] = function(T) {

@@ -99,0 +40,0 @@ T.eq(CND.type_of(new WeakMap()), 'weakmap');

17

package.json
{
"name": "cnd",
"version": "3.2.0",
"version": "4.0.5",
"description": "a grab-bag NodeJS package mainly for functionalities that used to live in coffeenode-trm, coffeenode-bitsnpieces, and coffeenode-types",

@@ -8,3 +8,3 @@ "main": "lib/main.js",

"build": "coffee --map -o lib -c src",
"push": "git add . && git commit -m'update' && git push -u origin master",
"push": "git add . && git commit -m'update' && git push",
"pub": "npm run build && npm run push && npm version patch && npm publish",

@@ -29,13 +29,4 @@ "test": "npm run build && node lib/tests.js"

"homepage": "https://github.com/loveencounterflow/cnd",
"dependencies": {
"bloem": "^0.2.4",
"columnify": "^1.5.4",
"equals": "^1.1.0",
"interval-skip-list": "^2.0.1",
"lodash": "^4.13.1",
"permute": "^1.0.0"
},
"devDependencies": {
"guy-test": "^1.2.1"
}
"dependencies": {},
"devDependencies": {}
}

@@ -333,1 +333,107 @@ <!-- START doctoc generated TOC please keep comment here to allow auto update -->

```
## CND.TEXT.to_width
```
2
|北|2
|P |2
|Pe|2
|……|2
|P…|2
|a…|2
|x…|2
|a…|2
|a…|2
|……|2
|……|2
3
|北 |3
|P |3
|Pe |3
|北…|3
|Pe…|3
|a …|3
|xa…|3
|àx…|4
|a⃝b…|4
|北…|3
|北…|3
4
|北 |4
|P |4
|Pe |4
|北京|4
|Pek…|4
|a n…|4
|xàx…|5
|àxa…|5
|a⃝b⃞c…|6
|北……|4
|北……|4
5
|北 |5
|P |5
|Pe |5
|北京 |5
|Peki…|5
|a ni…|5
|xàxa…|6
|àxáx…|7
|a⃝b⃞c⃟a…|8
|北京…|5
|北京…|5
10
|北 |10
|P |10
|Pe |10
|北京 |10
|Peking |10
|a nice te…|10
|xàxáxâxãx…|14
|àxáxâxãxa…|14
|a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c…|18
|北京 (Pek…|10
|北京 (Pek…|10
15
|北 |15
|P |15
|Pe |15
|北京 |15
|Peking |15
|a nice test to…|15
|xàxáxâxãxāxa̅xa…|21
|àxáxâxãxāxa̅xăx…|22
|a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟…|25
|北京 (Peking) …|15
|北京 (Peking) …|15
20
|北 |20
|P |20
|Pe |20
|北京 |20
|Peking |20
|a nice test to see …|20
|xàxáxâxãxāxa̅xăxȧxax…|28
|àxáxâxãxāxa̅xăxȧxaxa…|28
|a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟…|25
|北京 (Peking) 位於……|20
|北京 (Peking) 位於……|20
25
|北 |25
|P |25
|Pe |25
|北京 |25
|Peking |25
|a nice test to see the e…|25
|xàxáxâxãxāxa̅xăxȧxaxa̠xa̡xa…|35
|àxáxâxãxāxa̅xăxȧxaxa̠xa̡xa̢x…|36
|a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟a⃝b⃞c⃟ |25
|北京 (Peking) 位於華北 (…|25
|北京 (Peking) 位於華北 (…|25
0 1 2 3
0123456789012345678901234567890123456789
a nice test to see the effect*
北京 (Peking) 位於華北 (North*
北京 (Peking) 位於華北 (North*
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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