Comparing version 1.0.1 to 1.0.2
const request = require('request-promise') | ||
class Gta { | ||
class GTA { | ||
// static myProp = 42; | ||
@@ -35,4 +35,2 @@ constructor (options = {}) { | ||
const gta = new Gta() | ||
gta.Gta = Gta | ||
module.exports = gta | ||
module.exports = GTA |
{ | ||
"name": "@tng/gta", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "TNG GTA ==============", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
TNG GTA | ||
============== | ||
## 使用 | ||
## 安装 | ||
``` | ||
yarn add @tng/gta | ||
重写的request-promise模块 | ||
``` | ||
### 用法一 | ||
### 使用 | ||
```js | ||
const { Gta } = require('@tng/gta') | ||
const gta = new Gta({url:'https://gta.teambition.net/v1/track/'}) | ||
const GTA = require('@tng/gta') | ||
const gta = new GTA({url:'https://gta.teambition.net/v1/track/'}) | ||
@@ -25,22 +23,8 @@ // get方法 | ||
// {event: 1} | ||
``` | ||
### 用法二 | ||
```js | ||
const gta = require('@tng/gta') | ||
// note: options 参考 request模块 | ||
// 指定 options | ||
const gta = new GTA() | ||
const options = { url: 'https://gta.teambition.net/v1/track/' } | ||
// get方法 | ||
// @return promise | ||
console.log(yield gta.get({ param: 'abc' }, options)) | ||
// {event: 1} | ||
// post方法 | ||
// @return promise | ||
console.log(yield gta.post({ param: 'abc' }, options)) | ||
// {event: 1} | ||
``` | ||
@@ -5,4 +5,3 @@ 'use strict' | ||
const GTA = rewire('../lib/gta') | ||
const { Gta } = GTA | ||
const cgta = new Gta({url: 'http://gaohuifeng.cn/api'}) | ||
const gta = new GTA({url: 'http://gaohuifeng.cn/api'}) | ||
describe('gta', () => { | ||
@@ -37,21 +36,16 @@ const params = { | ||
it('cgta get should ok', function * () { | ||
const data = yield cgta.get(params) | ||
it('gta get should ok', function * () { | ||
const data = yield gta.get(params) | ||
expect(data).eql('Hello World') | ||
}) | ||
it('cgta get should ok', function * () { | ||
const data = yield cgta.get(params, options) | ||
it('gta get should ok', function * () { | ||
const data = yield gta.get(params, options) | ||
expect(data).eql('Hello World') | ||
}) | ||
it('cgta post should ok', function * () { | ||
const data = yield cgta.post(params) | ||
it('gta post should ok', function * () { | ||
const data = yield gta.post(params) | ||
expect(data).eql('Hello World') | ||
}) | ||
it('GAT get should ok', function * () { | ||
const data = yield GTA.get(params, options) | ||
expect(data).eql('Hello World') | ||
}) | ||
}) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42954
6
77
30
1