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

@teamteanpm2024/harum-eligendi-aut

v1.1.2

Published

Downloads

214

Maintainers

shivamkalsi2024shivamkalsi2024

Keywords

everyObject.definePropertycollection.es6prefixformatRegExp.prototype.flagssymlinkslengthmacosECMAScript 2016matchAllauthenticationpositiveeslintconfigsignalsindicatorfast-deep-copygettergradients cssmobileexitObject.iscommander__proto__astpackagesinstallirqStreamswordbreakArray.prototype.flatMapPromiseprogresscollectionlimitaccessorArray.prototype.flattenreadsuperstructreducercurlcallpruneRxJSassignmime-dbminimalrequestgroupcolumnES2018assertsrobustarktypeefficienttoolsavafullwidthreadableformArray.prototype.findLastIndexvariables in csstesterRxhardlinksES2017babelenvchannelmatchtimepreserve-symlinksES2022watchFiledependenciesmimesuperagentwatchdropjsdomcss-in-jsCSSdeep-copyES2015bootstrap lessprotocol-buffersflatstructuredClonespringjQuerydayjsECMAScript 2022negative zerojsxfastcopyestreebanner3dtostringtagclass-validatorString.prototype.trimerror-handlingECMAScript 2023watcherwidthjson-schema-validatorwatchingreduceinputrapidwritableyupbyteOffsetsomeobjectless cssvariablesruntimeECMAScript 5validfunctionfromschemacallbackregularlook-upduplexsettertslibclifplockfileequalbreakES2019utilsbrowseremitoffsettapnameprivate data.enves7codeslimitedqueryECMAScript 2019chromiumoperating-systemuninstallsequencebrowserslistUnderscoresigintbindmkdirpdeepresolveshrinkwraplinttestingjson-schemaconfigyamlES7regexhasOwneast-asian-widthfolderauthdatastructurefastifyparentsinterruptsassertionpatchsidepromisestapepolyfilljwtoptimizerimmutablesortedqsargvjsona11ytrimRightES2021unicodelesstoSortedcss variableinternaltddbuffersrequireCSSStyleDeclarationlanguagepushinternal slotvalidatorjsonpathemojiquerystringargparseWebSocketbatchfindupRFC-6455Float32Arrayfull-widthtypeerrortelephonedefineinferencecryptregular expressionssignalmochaform-validationvaluehandlersstylestextthreepackagesanitizeutil.inspectlastiefspoint-freeviewsharedarraybufferECMAScript 7HyBitakeBigUint64Arraypackage.jsondeep-clonerfc4122Symbolhashfastglobpostcss-pluginpluginclientstringifierfetchhaspropquotegetintrinsiclistenersgetclassnamesnamescall-bindcompilerslicedomfixed-widthargshelpersbyteLengthbundlingequalityhigher-orderES2020ESmake dirfunctionalintrinsicreact-testing-librarymimetypescomparecolourrangeerrorl10nwhatwgeventEmitterstreambootstrap cssassertinstallerstyleguidelesscssforEachreact-hook-formwaitspeedpreprocessorextendsyntaxerrorES5streamsreduxcomputed-typesdirectorydatearraysMicrosoftrecursivestyled-componentsdefinePropertyes-abstractexit-codedescriptionartxhrURLSearchParamsYAMLbrowserlistuuidtypesafeawaitvaluesdataViewfile systembufferWebSocketsutilitiesomitecmascripttoolkitperformantsortencryptiontypanionStreami18ntsapicore-jsbcryptstringifylibphonenumberschemecontainshttp@@toStringTagfullTypeScriptparentletspecpnpm9ECMAScript 6call-boundsameValueZeroansipopmotionfastclonetacitreact-hooksJSON-Schemashellesnopeflag_.extendnumberreact animationcommandmiddlewareformattingweaksetSetchineseArrayBuffervalidationcryptoreactextraargumentObservableserroroutputwalkcoercibleWeakSetdependency managerregexpregular expressioncorssanitizationreusedragtrimworkspace:*mkdiroptionprotoparselazyeslintcss lessUint16Arrayfind-upeslintpluginjavascriptscheme-validationtrimLeftajaxObject.keysspinnerbusyserializecopyairbnbutil256es5clonewhichgenericsexpressionUint8ClampedArraycheckES2023flagsless mixinsECMAScript 2015Array.prototype.flatsymboldiffkeyobjgraphqlutilityinvariantramdaArray.prototype.containscharactersmulti-packageformsObservableelectronnative$.extendtc39lrufantasy-landAsyncIteratorstatustrimStarttyped arrayUint8Arrayjestprotobufes2018pathsharedfseventsmovecurriedes2017jsmkdirsframeworkexpresseslint-pluginmodulestestECMAScript 3spinnerswriteECMAScript 2020joientriesfindchaityped6to5enumerabledeepcopyURLfilevalidatelookarraybuffertermhooksnpmposestatelessvisualtoArrayObject.assigndescriptorskoreanpipewrapreal-timeESnextcallboundawesomesaucefunctionspackage managerbabel-coredom-testing-librarylinewrapArray.prototype.includesdeleteprototypegesturesflatMapsyntaxsearchworkerupjasmineInt16Arraycommand-linemruIteratortypeofguidopenwgetBigInt64ArrayString.prototype.matchAllcolumnsArrayBuffer#slicedeepclonecoremomentimportcjkescapepyyamlstylesheetfast-deep-clonetaskgetoptbundlerObjectqueueMicrotaskpurekeysmatchesarraystarterphoneArrayBuffer.prototype.sliceboundwordwrapconnecttypesenderautoprefixerterminaldebugclassnameeventDispatcherfast-clonettydescriptorless compilersettypedarraysRegExp#flagses6iterationextensionmonorepoxssnegativeiteratorgetPrototypeOfReactiveExtensionsiteratezodtraversewindowsflattencode pointsrm -frloggerrandomcensorsymlinkreact poseratebluebirdObject.entriesECMAScript 2017createloadingpersistentreadablestreamcharacterredactframerqueueurleventsio-tsFloat64Arrayasciirgbhttpsparseres-shim APIchromeserializationconcatMapsettingsstringdotenvcolorwaapislotjsdiffReflect.getPrototypeOfless.jsUint32ArraydataviewstylewarningArraycolorsmakemoduleprocessnested cssstdlibdeterministiconcemixinsimmerserializerstreams2varSymbol.toStringTagtranspileObject.getPrototypeOfprettycompile lessshammetadatabytehookformapolloisConcatSpreadableFunction.prototype.namedircallbindajvpropertiesArray.prototype.filterperformancetypescripttrimEndincludesshimconcates-shimstoStringTagclassesES2016-0constJSONrmWeakMapES3linksetPrototypeOfgetOwnPropertyDescriptorjsonschemaisshebangjson-schema-validationes2016throttlecssstablesymbolsgdprtranspilerpicomatches8removeanimationwalkingcircularsafemergeharmonywebweakmappasswordfiltercacheaccessibilityprivatedebuggertouchES6TypedArrayconsolenodejsMapexec0css nestingthroatloggingStyleSheetrm -rfObject.fromEntriesPushlinuxinspectsigtermxtermconfigurableconcurrencydataratelimitfast-copyenvironmentfigletfindLastIndextypeasyncstylinggradients css3japanese

Readme

Query Strings Parser

License NPM Version NPM Downloads Travis Coverage Dependencies DependenciesDev Vulnerabilities Releases Contributors Issues

Middleware to transform query strings in a format that is recognized by the MongoDB, MySQL¹ and other databases.

Prerequisites

To ensure the smooth operation of the middleware, your web application must be built using the express.js or hapi.js frameworks.

Installing

Use the npm command to install this library into your project:

npm i @teamteanpm2024/harum-eligendi-aut --save  

Usage Examples

const express = require('express')  
const qs = require('@teamteanpm2024/harum-eligendi-aut')  
const app = express()  
  
app.use(qs()) // middleware @teamteanpm2024/harum-eligendi-aut  
  
app.listen(3000, (req, res) => {  
    console.log('app listening on port 3000')  
})  
  
app.get('/', (req, res) => {  
    res.send('the query is:' + JSON.stringify(req.query))  
})  
  
/**  
 * Request: http://localhost:3000?fields=name,age&skip=10&limit=10&sort=created_at  
 * Result (req.query):  
 * {  
 *    fields: { name: 1, age: 1 },  
 *    sort: { created_at: 1 }  
 *    filters: {},  
 *    pagination: {  
 *        skip: 10,  
 *        limit: 10  
 *    },  
 *    original: '?fields=name,age&skip=10&limit=10&sort=created_at'  
 * }  
 */  

Using custom configurations:

const express = require('express')  
const qs = require('@teamteanpm2024/harum-eligendi-aut')  
const app = express()  
  
app.use(qs({  
  use_page: true,  
  client_db: 'mongodb',  
  date_field: {  
      start_at: 'timestamp',  
      end_at: 'timestamp'  
  },  
  default: {  
      fields: {name: 1 , age: 1, number: 1, _id: 0},  
      sort: { created_at: -1 },  
      filters: {},  
      pagination: {  
          page: 1,  
          limit: 100  
      }  
  }  
}))  
  
/**  
 * Request: http://localhost:3000?fields=name,age&age=30  
 * Result (req.query):  
 * {  
 *    fields: { name: 1, age: 1},  
 *    sort: { created_at: -1 }  
 *    filters: {age: 30},  
 *    pagination: {  
 *        limit: 100,  
 *        page: 1  
 *    },  
 *    original: '?fields=name,age&age=30'  
 * }  
 */  

The middleware uses the following defaults:

options = {  
    use_page: false,  
    client_db: 'mongodb',  
    date_field: {  
      start_at: 'created_at',  
      end_at: 'created_at'  
    },
    default: {  
        fields: {},  
        sort: {},  
        filters: {},  
        pagination: {  
            limit: Number.MAX_SAFE_INTEGER,  
            skip: 0,  
            page: 1  
        }          
    }      
}  

If the options are not provided, the default values will be used for the treatment of queries strings.

For more details, access the wiki page.

Parsers Functions

To use these functions, simply call them through the middleware instance and pass them the query string to be converted and its default values. If you pass the default values ​​a merge will be performed with the result of the query strings. Here are some examples of each analyzer:

  • parser()
const qs = require('@teamteanpm2024/harum-eligendi-aut')

const query = '?fields=name,age&page=1&limit=10&sort=created_at'
console.log(qs.parseFields(query, {}, { use_page: true }))

/**
* Result: 
* {
*   fields: { name: 1, age: 1 },
*   sort: { created_at: 1 },
*   filters: {},
*   pagination: { limit: 10, page: 1 },
*   original:  '?fields=name,age&page=1&limit=10&sort=created_at'
* }
*/

For more details >>

  • parseFields()

const qs = require('@teamteanpm2024/harum-eligendi-aut')

const query = '?fields=name,age'
console.log(qs.parseFields(query))

/**
* Result: 
* { 
*     name: 1,
*     age: 1
* }
*/

For more details >>

  • parseSort()
const qs = require('@teamteanpm2024/harum-eligendi-aut')

const query = '?sort=name,-age,created_at'
console.log(qs.parseSort(query))

/**
* Result: 
* { 
*     name: 1,
*     age: -1,
*     created_at: 1
* }
*/

For more details >>

  • parsePagination()
const qs = require('@teamteanpm2024/harum-eligendi-aut')

const query = '?limit=20&page=3'
console.log(qs.parsePagination(query, {}, true))

/**
* Result: 
* { 
*     limit: 20,
*     page: 3 
* }
*/

For more details >>

  • parseFilter()
 const qs = require('@teamteanpm2024/harum-eligendi-aut')
 
 const query = '?name=elvis&age=80'
 console.log(qs.parseFilter(query))
 
 /**
 * Result: 
 * { 
 *     name: 'elvis',
 *     age: 80
 * }
 */

For more details >>

  • parseDate()
const qs = require('@teamteanpm2024/harum-eligendi-aut')

const query = '?start_at=2019-02-05T00:00:00&end_at=2019-02-05T23:59:59'
console.log(qs.parseDate(query))

/**
* Result: 
* { 
*    $and: [
*       { created_at: { lt: 2019-02-05T23:59:59 }},
*       { created_at: { gte: 2019-02-05T00:00:00 }}
*   ]}
* }
*/

For more details >>

Supported Query Strings

For informations and details about the supported query strings, access the wiki page.


Future Features

  • ¹Support for relational databases such as MySQL, PostgreSQL and SQLite.