Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knex

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex - npm Package Compare versions

Comparing version 0.4.10 to 0.4.11

4

knex.js

@@ -1,2 +0,2 @@

// Knex.js 0.4.10
// Knex.js 0.4.11
// --------------

@@ -94,3 +94,3 @@

// Keep in sync with package.json
knex.VERSION = '0.4.10';
knex.VERSION = '0.4.11';

@@ -97,0 +97,0 @@ // Runs a new transaction, taking a container and returning a promise

@@ -37,2 +37,5 @@ // Builder

// Valid values for the `order by` clause generation.
var orderBys = ['asc', 'desc'];
_.extend(Builder.prototype, Common, {

@@ -300,3 +303,6 @@

orderBy: function(column, direction) {
this.orders.push({column: column, direction: (direction || 'asc')});
if (!(direction instanceof Raw)) {
if (!_.contains(orderBys, (direction || '').toLowerCase())) direction = 'asc';
}
this.orders.push({column: column, direction: direction});
return this;

@@ -303,0 +309,0 @@ },

{
"name": "knex",
"version": "0.4.10",
"version": "0.4.11",
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.",

@@ -5,0 +5,0 @@ "main": "knex.js",

@@ -291,2 +291,36 @@ var _ = require('underscore');

it('should default to "asc" if no value is provided', function() {
builder.orderBy('columnName');
expect(builder.orders[0].column).to.equal('columnName');
expect(builder.orders[0].direction).to.equal('asc');
});
it('should not allow any values other than "asc" or "desc"', function() {
builder.orderBy('columnName', 'desc, select * from items');
expect(builder.orders[0].column).to.equal('columnName');
expect(builder.orders[0].direction).to.equal('asc');
});
it('should not allow capitalized "desc"', function() {
builder.orderBy('columnName', 'DESC');
expect(builder.toString()).to.equal("select * order by `columnName` DESC");
builder.reset();
builder.orderBy('columnName', 'ASC');
expect(builder.toString()).to.equal("select * order by `columnName` ASC");
});
});

@@ -293,0 +327,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