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

leoric

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leoric - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

src/contants.js

9

History.md

@@ -0,1 +1,10 @@

2.0.1 / 2022-01-05
==================
## What's Changed
* fix: format numeric result by @JimmyDaddy in https://github.com/cyjake/leoric/pull/253
* fix: should still return number if value is '0.000' by @cyjake in https://github.com/cyjake/leoric/pull/254
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.1...v2.0.1
2.0.0 / 2021-12-28

@@ -2,0 +11,0 @@ ==================

2

package.json
{
"name": "leoric",
"version": "2.0.0",
"version": "2.0.1",
"description": "JavaScript Object-relational mapping alchemy",

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

'use strict';
const { AGGREGATOR_MAP } = require('./contants');
const AGGREGATORS = Object.values(AGGREGATOR_MAP);
/**

@@ -90,4 +93,10 @@ * An extended Array to represent collections of models.

const row = rows[0];
const result = row && (row[''] || row[table]);
return result && result[value] || 0;
const record = row && (row[''] || row[table]);
const result = record && record[value];
// see https://www.w3schools.com/mysql/mysql_ref_functions.asp
if (AGGREGATORS.includes(args[0].name)) {
const num = Number(result);
return isNaN(num) ? result : num;
}
return result;
}

@@ -94,0 +103,0 @@ }

@@ -14,2 +14,3 @@ 'use strict';

const Raw = require('./raw');
const { AGGREGATOR_MAP } = require('./contants');

@@ -907,10 +908,2 @@ /**

const AGGREGATOR_MAP = {
count: 'count',
average: 'avg',
minimum: 'min',
maximum: 'max',
sum: 'sum'
};
for (const aggregator in AGGREGATOR_MAP) {

@@ -917,0 +910,0 @@ const func = AGGREGATOR_MAP[aggregator];

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