dgram-as-promised
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog | ||
## v3.0.1 2019-06-04 | ||
- Minor tweaks in README. | ||
- Added source map to the package. | ||
## v3.0.0 2019-05-08 | ||
@@ -4,0 +9,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib/dgram-as-promised') | ||
module.exports = require("./lib/dgram-as-promised") |
/// <reference types="node" /> | ||
import { RemoteInfo, SocketType } from 'dgram'; | ||
import { SocketAsPromised, SocketAsPromisedOptions } from './socket-as-promised'; | ||
export { BindOptions, RemoteInfo, Socket, SocketOptions, SocketType } from 'dgram'; | ||
export { AddressInfo } from 'net'; | ||
export { SocketAsPromised, SocketAsPromisedOptions } from './socket-as-promised'; | ||
import { RemoteInfo, SocketType } from "dgram"; | ||
import { SocketAsPromised, SocketAsPromisedOptions } from "./socket-as-promised"; | ||
export { BindOptions, RemoteInfo, Socket, SocketOptions, SocketType } from "dgram"; | ||
export { AddressInfo } from "net"; | ||
export { SocketAsPromised, SocketAsPromisedOptions } from "./socket-as-promised"; | ||
export declare class DgramAsPromised { | ||
@@ -8,0 +8,0 @@ static createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): SocketAsPromised; |
@@ -13,3 +13,3 @@ "use strict"; | ||
static createSocket(options, callback) { | ||
if (typeof options === 'string') { | ||
if (typeof options === "string") { | ||
options = { | ||
@@ -25,1 +25,2 @@ type: options, | ||
exports.default = DgramAsPromised; | ||
//# sourceMappingURL=dgram-as-promised.js.map |
/// <reference types="node" /> | ||
import dgram, { BindOptions, Socket, SocketOptions } from 'dgram'; | ||
import { AddressInfo } from 'net'; | ||
import dgram, { BindOptions, Socket, SocketOptions } from "dgram"; | ||
import { AddressInfo } from "net"; | ||
export interface SocketAsPromisedOptions extends SocketOptions { | ||
@@ -5,0 +5,0 @@ dgram?: typeof dgram; |
@@ -30,3 +30,3 @@ "use strict"; | ||
try { | ||
this.socket.once('close', () => { | ||
this.socket.once("close", () => { | ||
resolve(); | ||
@@ -114,1 +114,2 @@ }); | ||
exports.default = SocketAsPromised; | ||
//# sourceMappingURL=socket-as-promised.js.map |
{ | ||
"name": "dgram-as-promised", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Promisify dgram module", | ||
@@ -51,22 +51,16 @@ "main": "lib/dgram-as-promised.js", | ||
"scripts": { | ||
"build": "npm run compile", | ||
"clean": "shx rm -rf lib", | ||
"compile": "tsc --pretty", | ||
"compile": "tsc --pretty --project .", | ||
"clean": "npm run clean:compile && npm run clean:coverage", | ||
"clean:compile": "shx rm -rf lib", | ||
"clean:coverage": "shx rm -rf coverage .nyc_output", | ||
"lint": "npm run compile && tsc --pretty -p examples && tsc --pretty -p test && eslint . && tslint -t stylish -p . && tslint -t stylish -p examples && tslint -t stylish -p test && prettier --ignore-path .gitignore --list-different '**/*.{js,json,md,ts,yml}' && markdownlint \"*.md\"", | ||
"postpublish": "git tag v$npm_package_version -a -m \"Release v$npm_package_version\" && git push --tags", | ||
"prepublishOnly": "npm run build", | ||
"pretest": "npm run build && tsc --pretty -p examples && tsc --pretty -p test && eslint . && tslint -t stylish -p . && tslint -t stylish -p examples && tslint -t stylish -p test && prettier --ignore-path .gitignore --list-different '**/*.js' '**/*.json' '**/*.ts' '**/*.yml' && markdownlint \"*.md\"", | ||
"prepack": "npm run compile", | ||
"prepublishOnly": "npm run test", | ||
"pretest": "npm run lint", | ||
"test": "npm run test:spec", | ||
"test:spec": "npm run ts-mocha -- \"test/*.ts\"", | ||
"test:coverage": "nyc --reporter json npm run test:spec && nyc report", | ||
"ts-mocha": "mocha --use_strict --throw-deprecation --require source-map-support/register --require ts-node/register --timeout 90000" | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"exclude": [ | ||
".*.js", | ||
"**/*.d.ts" | ||
] | ||
"test:coverage": "npm run clean:coverage && cross-env NYC=\"nyc --no-clean --reporter=lcov\" npm run test:spec && nyc report --reporter=text-summary --color", | ||
"ts-mocha": "$NYC mocha --use_strict --throw-deprecation --require source-map-support/register --require ts-node/register --timeout 90000" | ||
} | ||
} |
# dgram-as-promised | ||
<!-- markdownlint-disable MD013 --> | ||
[![Build Status](https://secure.travis-ci.org/dex4er/js-dgram-as-promised.svg)](http://travis-ci.org/dex4er/js-dgram-as-promised) [![Coverage Status](https://coveralls.io/repos/github/dex4er/js-dgram-as-promised/badge.svg)](https://coveralls.io/github/dex4er/js-dgram-as-promised) [![npm](https://img.shields.io/npm/v/dgram-as-promised.svg)](https://www.npmjs.com/package/dgram-as-promised) | ||
<!-- markdownlint-enable MD013 --> | ||
@@ -30,21 +32,2 @@ | ||
Transpiling this module with own settings in `tsconfig.json`: | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"paths": { | ||
"dgram-as-promised": ["node_modules/dgram-as-promised/src/dgram-as-promised"] | ||
}, | ||
"strict": true | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"node_modules/dgram-as-promised/src/*.ts" | ||
] | ||
} | ||
``` | ||
## Usage | ||
@@ -57,10 +40,10 @@ | ||
```js | ||
const {DgramAsPromised} = require('dgram-as-promised') | ||
const {DgramAsPromised} = require("dgram-as-promised") | ||
const socket = DgramAsPromised.createSocket('udp4') | ||
const socket = DgramAsPromised.createSocket("udp4") | ||
const MEMBERSHIP = '224.0.0.1' | ||
const MEMBERSHIP = "224.0.0.1" | ||
const PORT = 41234 | ||
const message = Buffer.from('ABCDEFGH') | ||
const message = Buffer.from("ABCDEFGH") | ||
``` | ||
@@ -71,5 +54,7 @@ | ||
```ts | ||
import DgramAsPromised from 'dgram-as-promised' | ||
import DgramAsPromised from "dgram-as-promised" | ||
// or | ||
import {DgramAsPromised} from "dgram-as-promised" | ||
const socket = DgramAsPromised.createSocket('udp4') | ||
const socket = DgramAsPromised.createSocket("udp4") | ||
``` | ||
@@ -88,3 +73,3 @@ | ||
socket.addMembership(MEMBERSHIP) | ||
console.log('Membership is set') | ||
console.log("Membership is set") | ||
``` | ||
@@ -105,3 +90,3 @@ | ||
await socket.close() | ||
console.log('Socket is closed') | ||
console.log("Socket is closed") | ||
``` | ||
@@ -108,0 +93,0 @@ |
/// <reference types="node" /> | ||
import dgram, {RemoteInfo, SocketType} from 'dgram' | ||
import {SocketAsPromised, SocketAsPromisedOptions} from './socket-as-promised' | ||
import dgram, {RemoteInfo, SocketType} from "dgram" | ||
import {SocketAsPromised, SocketAsPromisedOptions} from "./socket-as-promised" | ||
export {BindOptions, RemoteInfo, Socket, SocketOptions, SocketType} from 'dgram' | ||
export {AddressInfo} from 'net' | ||
export {SocketAsPromised, SocketAsPromisedOptions} from './socket-as-promised' | ||
export {BindOptions, RemoteInfo, Socket, SocketOptions, SocketType} from "dgram" | ||
export {AddressInfo} from "net" | ||
export {SocketAsPromised, SocketAsPromisedOptions} from "./socket-as-promised" | ||
@@ -21,3 +21,3 @@ export class DgramAsPromised { | ||
): SocketAsPromised { | ||
if (typeof options === 'string') { | ||
if (typeof options === "string") { | ||
options = { | ||
@@ -24,0 +24,0 @@ type: options, |
/// <reference types="node" /> | ||
import dgram, {BindOptions, Socket, SocketOptions} from 'dgram' | ||
import {AddressInfo} from 'net' | ||
import dgram, {BindOptions, Socket, SocketOptions} from "dgram" | ||
import {AddressInfo} from "net" | ||
@@ -39,3 +39,3 @@ export interface SocketAsPromisedOptions extends SocketOptions { | ||
try { | ||
this.socket.once('close', () => { | ||
this.socket.once("close", () => { | ||
resolve() | ||
@@ -42,0 +42,0 @@ }) |
@@ -13,4 +13,5 @@ { | ||
"outDir": "./lib", | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "es6", | ||
"strict": true, | ||
"typeRoots": ["node_modules/@types"] | ||
@@ -17,0 +18,0 @@ }, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21929
14
338
2
94