1.2.0 • Published 4 years ago

dbash v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

DBash

Tool for converting data between SQL and JS types easily. It's more like a test library to see how npm packages work. Name inspired by Lodash - the ultimate JavaScript toolkit.

Installation

Installation is same for most of the Node.js packages:

# NPM
$ npm install --save dbash

# Yarn
$ yarn add dbash

DBash is also available from GitHub Package Registry.

Usage

// CommonJS
var _ = require('dbash');
console.log(_.sqlIntJsBool(1));

// ES2015
import { sqlIntJsBool } from 'dbash';
console.log(sqlIntJsBool(1));

// Also ES2015
import * as _ from 'dbash';
console.log(_.sqlIntJsBool(1));

Functions

Boolean

Integer

jsBoolSqlInt(input: boolean): number
// Takes JavaScript boolean and returns 1 or 0

sqlIntJsBool(input: number): boolean
// Takes SQL number and returns true or false

String

jsBoolSqlString(input: boolean): string
// Takes JavaScript boolean and returns 'true' or 'false'

sqlStringJsBool(input: string): boolean
// Takes SQL string and returns and returns true or false

Date

Date

jsDateSqlDate(input: Date): string
// Takes JavaScript Date and returns corresponding SQL Date string

sqlDateJsDate(input: string): Date
// Takes SQL DATE and returns corresponding JS Date object
// Accepts `2010-07-28` and `10-07-28` formats

DateTime

jsDateSqlDateTime(input: Date): string
// Takes JavaScript Date and returns corresponding SQL DateTime string

sqlDateTimeJsDate(input: string): Date
// Takes SQL DateTime and returns corresponding JS Date object
// Accepts `2010-07-28 11:12:13` and `10-07-28 11:12:13` formats
1.2.0

4 years ago

1.1.0

4 years ago

0.3.15

4 years ago

0.3.14

4 years ago

0.3.13

4 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago