npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mgnlq_model

v0.0.214

Published

model access via mongoose, model loading

Downloads

24

Readme

mgnlq_model Build StatusCoverage Status

model load and processing code

this will be slowly migrated to anychronous processing, separating the processes:

  1. metamodel building
  2. model index building for processing access
  3. rule index building
  4. data loading and validation

for a nested document

{$match:{"bar.text":"Hi"}}, {$unwind:"$bar"}, {$match:{"bar.text":"Hi"}}, {$group:{"_id":"$_id","bars":{$push:"$bar"}}}

Database used for testing containing data

(set up via node js/makedb.js or npm load_data ) mongodb://localhost/testdb'

Creating a database

via

node js/makedb.js

or

npm run load_testdb

to load the testdb2, use project mgnql_testmodel2 and npm run load_testdb2

a mongo db instance is created, The name of the DB and the source data is controlled via the environment parameters:

var mongoConnectionString = process.env.MONGO_DBURL || 'mongodb://localhost/testdb'; var modelPath = process.env.MGNLQ_MODELPATH || 'node_modules/mgnlq_testmodel/testmodel/';

recording the test queries

SET MONGO_TEST_RECORD=RECORD

run the tests -> data is created in node_modules/mgnql_testmodel_replay/mgrecrep/data

(typcially linked with npm link mgnlq_testmodel_replay ) This data must be checked in, the package version increased and published, subsequently the dependency has to be updated to allow running unit tests on travis etc.

Testing

The unit test use mongoose_record_replay and data in (npm module) mgnlq_testmodel_replay to be run without a mongoose instance.

Alternatively, by setting MONGO_TEST_RECORD='RECORD' Unit tests can be run against a mongodb installed on

'mongodb://localhost/testdb';

var mode = 'REPLAY';
if (process.env.MONGO_TEST_RECORD) {
  mode = 'RECORD';
}
var mongoose = require('mongoose_record_replay').instrumentMongoose(require('mongoose'),
  'node_modules/mgnlq_testmodel_replay/mgrecrep/',
  mode);

This DB must be filled with data, see

  nmp run load_data

to create the db from files

Cache file control

Model data is written and read from a cache file in modelPath unless MQNLQ_MODEL_NO_FILECACHE is set to true

TODO

  • Analyze model for mismatches in category aliases
 e.g.   DomainA   element name  synonyms: [  "element names", "elementname"]
        DomainB   element name  synonyms:[ "elements" ]

When this occurs a mismatch "elements" will match only DomainB,

  • Analyze model for casing mismatches, e.g.

abc => Abc abc => abc

test migration from nodenunit to jest

npm i -g jscodeshift
jscodeshift   --print -d