Socket
Socket
Sign inDemoInstall

objection

Package Overview
Dependencies
Maintainers
2
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

objection - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

6

lib/initialize.js

@@ -9,7 +9,3 @@ 'use strict';

for (const modelClass of modelClasses) {
await modelClass.fetchTableMetadata({
knex
});
}
await Promise.all(modelClasses.map(modelClass => modelClass.fetchTableMetadata({ knex })));
}

@@ -16,0 +12,0 @@

12

lib/model/AjvValidator.js

@@ -249,6 +249,14 @@ 'use strict';

const subSchemaProps = ['anyOf', 'oneOf', 'allOf', 'not', 'then', 'else'];
return Object.assign(
omit(jsonSchema, ['required', ...subSchemaProps]),
...subSchemaProps.map(prop => subSchemaWithoutRequired(jsonSchema, prop))
...subSchemaProps.map(prop => subSchemaWithoutRequired(jsonSchema, prop)),
jsonSchema && jsonSchema.definitions
? {
definitions: Object.assign(
...Object.keys(jsonSchema.definitions).map(prop => ({
[prop]: jsonSchemaWithoutRequired(jsonSchema.definitions[prop])
}))
)
}
: {}
);

@@ -255,0 +263,0 @@ }

@@ -24,3 +24,10 @@ 'use strict';

// objection uses internally, work.
function snakeCase(str, { upperCase = false, underscoreBeforeDigits = false } = {}) {
function snakeCase(
str,
{
upperCase = false,
underscoreBeforeDigits = false,
underscoreBetweenUppercaseLetters = false
} = {}
) {
if (str.length === 0) {

@@ -56,8 +63,12 @@ return str;

if (char === upperChar && upperChar !== lowerChar) {
// Multiple consecutive upper case characters shouldn't add underscores.
// For example "fooBAR" should be converted to "foo_bar".
if (prevChar === prevUpperChar && prevUpperChar !== prevLowerChar) {
const prevCharacterIsUppercase =
prevChar === prevUpperChar && prevUpperChar !== prevLowerChar;
// If underscoreBetweenUppercaseLetters is true, we always place an underscore
// before consecutive uppercase letters (e.g. "fooBAR" becomes "foo_b_a_r").
// Otherwise, we don't (e.g. "fooBAR" becomes "foo_bar").
if (underscoreBetweenUppercaseLetters || !prevCharacterIsUppercase) {
out += '_' + lowerChar;
} else {
out += lowerChar;
} else {
out += '_' + lowerChar;
}

@@ -64,0 +75,0 @@ } else {

{
"name": "objection",
"version": "2.1.2",
"version": "2.1.3",
"description": "An SQL-friendly ORM for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/objection.js",

@@ -23,2 +23,7 @@ [![Build Status](https://travis-ci.org/Vincit/objection.js.svg?branch=master)](https://travis-ci.org/Vincit/objection.js) [![Coverage Status](https://coveralls.io/repos/github/Vincit/objection.js/badge.svg?branch=master&service=github)](https://coveralls.io/github/Vincit/objection.js?branch=master) [![Join the chat at https://gitter.im/Vincit/objection.js](https://badges.gitter.im/Vincit/objection.js.svg)](https://gitter.im/Vincit/objection.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

- **A fully object oriented view of your database**
With objection you don't work with entities. You work with queries. Objection doesn't try to wrap every concept with an
object oriented equivalent. The best attempt to do that (IMO) is Hibernate, which is excellent, but it has 800k lines
of code and a lot more concepts to learn than SQL itself. The point is, writing a good traditional ORM is borderline
impossible. Objection attempts to provide a completely different way of working with SQL.
- **A custom query DSL. SQL is used as a query language.**

@@ -25,0 +30,0 @@ This doesn't mean you have to write SQL strings though. A query builder based on [knex](http://knexjs.org) is

@@ -1288,2 +1288,3 @@ /// <reference types="node" />

underscoreBeforeDigits?: boolean;
underscoreBetweenUppercaseLetters?: boolean;
}

@@ -1290,0 +1291,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