model.create(someData)
.catch(function (err) {
console.error('ValidationError:', err.ValidationError);
console.error('Message:', err.message);
});
Outputs:
ValidationError: {
import { parse } from 'csv-parse' | |
import fs from 'fs' | |
import { pipeline } from 'stream/promises' | |
/** | |
* Do something async with a row. | |
* | |
* @param {*} row A row of the CSV as an object. | |
*/ | |
async function handleRow(row) { |
import { PrimaryGeneratedColumn, Entity, Column } from 'typeorm'; | |
@Entity('foo') | |
export class Foo { | |
@PrimaryGeneratedColumn() | |
public id: number; | |
@Column({ default: '' }) | |
public get link(): string { | |
let value = this._link; |
class SafeObserver { | |
constructor(private _next: (value: any) => void = () => {}, | |
public error: (errorValue: any) => void = (e: any) => { throw e; }, | |
private _complete: (completeValue?: any) => void = () => {}) {} | |
public next(value: any) { | |
try { | |
this._next(value); | |
} | |
catch (e) { |
"use strict"; | |
var Readable = require('stream').Readable; | |
/** | |
* Create a stream from batching a Sequelize select query. | |
* | |
* @param {Function} query - Function that returns a promise. | |
* @param {object} options | |
* @param {number} options.limit - The limit for the number of rows to return in each "batch" |
model.create(someData)
.catch(function (err) {
console.error('ValidationError:', err.ValidationError);
console.error('Message:', err.message);
});
Outputs:
ValidationError: {
{ | |
"devDependencies": { | |
"app-root-path": "^1.0.0", | |
"jshint": "^2.7.0", | |
"mocha": "^2.2.5", | |
"supertest": "^1.0.1" | |
}, | |
"scripts": { | |
"check": "npm outdated", | |
"lint": "node_modules/.bin/jshint lib/ test/", |
/** | |
* Collection Interface. | |
* | |
* Concrete implementations would exist INSIDE the boundary interfaces. | |
* | |
* - Must be able to add one or more entities to the collection. | |
* - Must be able to find entities in the collection. | |
* - Must be able update entities in the collection. | |
* - Must be able to remove entities from the collection. | |
* |
function extractColumn(arr, column) { | |
function reduction(previousValue, currentValue) { | |
previousValue.push(currentValue[column]); | |
return previousValue; | |
} | |
return arr.reduce(reduction, []); | |
} |
<?php | |
/** | |
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE | |
*/ | |
namespace Joomla\Data; | |
use Psr\Cache\CacheInterface; |