Skip to content

Commit

Permalink
Remove gearbox.str.uniq() API.
Browse files Browse the repository at this point in the history
  • Loading branch information
cssmagic committed Dec 1, 2016
1 parent f524358 commit 7653232
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 60 deletions.
24 changes: 8 additions & 16 deletions dist/gearbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Gearbox | MIT | https://github.com/CMUI/gearbox */
/*! Gearbox | MIT License | https://github.com/CMUI/gearbox */
!function (window, undefined) {
// check conflict
if (window.gearbox) return false
Expand All @@ -23,11 +23,6 @@ var document = window.document
void function (window, gearbox) {
'use strict'

/**
* bind a set of apis to a key of `_` as namespace
* @param moduleName {string}
* @param apiSet {object}
*/
gearbox.__defineModule = function (moduleName, apiSet) {
if (!moduleName || !_.isString(moduleName) || !apiSet || !_.isObject(apiSet)) return

Expand All @@ -45,6 +40,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// str ////////////////////
void function (window, gearbox) {
Expand Down Expand Up @@ -156,16 +152,6 @@ void function (window, gearbox) {
return str
}

// array of string
str.uniq = str.unique = function (arr) {
if (!_.isArray(arr)) return false
var obj = {}
_.each(arr, function (str) {
obj[String(str)] = null
})
return _.keys(obj)
}

// more `toNumber` methods
str.toFloat = function (str) {return parseFloat(str)}
str.toInt = function (str) {
Expand All @@ -179,6 +165,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// root ////////////////////
void function (window, gearbox) {
Expand All @@ -202,6 +189,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// ua ////////////////////
void function (window, gearbox) {
Expand Down Expand Up @@ -364,6 +352,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// url ////////////////////
void function (window, gearbox) {
Expand Down Expand Up @@ -451,6 +440,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// dom ////////////////////
void function (window, gearbox) {
Expand Down Expand Up @@ -482,6 +472,7 @@ void function (window, gearbox) {

}(window, gearbox)

;

//////////////////// action ////////////////////
// include and wrap external module: Action
Expand Down Expand Up @@ -619,6 +610,7 @@ var action = (function () {
gearbox.__defineModule('action', action)

}(window, gearbox)
;

//////////////////// template ////////////////////
// include and wrap external module: Underscore-template
Expand Down
4 changes: 2 additions & 2 deletions dist/gearbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions doc/api-str.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,6 @@ gearbox.str.stripHash(' #foo-bar') // => 'foo-bar'

***

### `.uniq(array)` <a name="js-api--uniq">&nbsp;</a>

从字符串数组中去除重复的项。

#### 注意事项

* 非字符串的值会被转换为字符串后进行比对,即 `null``'null'` 会被视为重复。
* 去重后的各个字符串在数组中的排序无法保证。

#### 参数

* `array` -- 字符串数组。

#### 返回值

数组。去重之后的结果。

#### 示例

```js
gearbox.str.uniq(['foo', 'foo', 'bar']) // => ['foo', 'bar']
```

***

### `.toFloat(string)` <a name="js-api--toFloat">&nbsp;</a>

转换为浮点数。
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cmui-gearbox",
"version": "0.6.0",
"version": "0.7.0",
"homepage": "https://github.com/CMUI/gearbox",
"author": "cssmagic <[email protected]>",
"description": "Lightweight JavaScript utilities for web development.",
Expand Down
10 changes: 0 additions & 10 deletions src/str.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,6 @@ void function (window, gearbox) {
return str
}

// array of string
str.uniq = str.unique = function (arr) {
if (!_.isArray(arr)) return false
var obj = {}
_.each(arr, function (str) {
obj[String(str)] = null
})
return _.keys(obj)
}

// more `toNumber` methods
str.toFloat = function (str) {return parseFloat(str)}
str.toInt = function (str) {
Expand Down
6 changes: 0 additions & 6 deletions test/test-str.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ describe('String', function () {
})
})

describe('String Array', function () {
describe('gearbox.str.uniq()', function () {
it('(dummy test)', function () {})
})
})

describe('To Number', function () {
describe('gearbox.str.toFloat()', function () {
it('does basic functionality', function () {
Expand Down

0 comments on commit 7653232

Please sign in to comment.