News from the world of Node: DataCollection.js, Supererror, Readability

Original author: Alex Young
  • Transfer


DataCollection.js * - is a library for executing queries to a data source. You can use it both in the browser and on the Node side . The example in the documentation uses an array of objects, on which selection (filtering) operations are performed using the key / value representation, as well as some near-sql operators, such as max and distinct.

The authors declare that this product is fast, despite the fact that I can not confirm this fact. Although the library includes features such as creating indexes for specific keys. DataCollection.js is a well-documented project and has a test coverage of 95.5% .

var characters = [
    id: 1,
    first_name: 'Jon',
    last_name: 'Snow',
    gender: 'm',
    age: 14,
    location: 'Winterfell'
  } // ....... ,
var charDC = new DataCollection(characters);

// Will return Jon, Eddard and Ramsay
  .filter({gender: 'm', age__lt: 40})
// Updates location
  .filter({location: 'Winterfell'})
  .exclude({first_name: 'Jon'})
  .update({location: 'King\'s Landing'});


You probably had to work on projects in which you recorded (recorded) errors using the instructions console.error. Most likely in such situations you would like to get more useful information (for example, line number) without changing the source code. If this is your case, you will probably be interested in the supererror ** project .

This project changes console.errorby adding backlight, line number, and call stacks for the Error object.

console.error('Some', new Error('transient error'), 'happened using', { some: 'value' });
console.error();     // no info added
console.error('Using %d as a %s.', 42, 'number');



The Readability *** project changes the format of the web page to a simplified version of HTML Arc90 . To do this, use jsdom . Also, this product supports a large number of encodings such as GB2312 , and readability also supports relative URLs, so images continue to be displayed.

I seem to recall the problems with the encoding and relative addresses of images in other branches of the Readability project , so the above statement looks good.


* (GitHub: thestorefront / DataCollection.js , License: MIT, npm: data-collection ) from Storefront.
** (GitHub: nebulade / supererror , License: MIT, npm: supererror ) by Johannes Zellner.
*** (GitHub: luin / node-readability , License: Apache 2.0, npm: node-readability ) by Zihua Li

Also popular now: