fix(camelCase)
This commit is contained in:
@ -78,7 +78,7 @@ export class List {
|
|||||||
List.from = function (obj) {
|
List.from = function (obj) {
|
||||||
const list = new List()
|
const list = new List()
|
||||||
for (const value of obj) {
|
for (const value of obj) {
|
||||||
list.push_back(value)
|
list.pushBack(value)
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,19 +103,19 @@ export class SequenceContainer {
|
|||||||
this.erase(this.begin(), this.end())
|
this.erase(this.begin(), this.end())
|
||||||
}
|
}
|
||||||
|
|
||||||
push_front(value) {
|
pushFront(value) {
|
||||||
this.insert(this.begin(), value)
|
this.insert(this.begin(), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
push_back(value) {
|
pushBack(value) {
|
||||||
this.insert(this.end(), value)
|
this.insert(this.end(), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_front() {
|
popFront() {
|
||||||
this.erase(this.begin())
|
this.erase(this.begin())
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_back() {
|
popBack() {
|
||||||
this.erase(this.end().dec())
|
this.erase(this.end().dec())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +166,10 @@ SequenceContainer.is = function (obj, ...args) {
|
|||||||
'assign',
|
'assign',
|
||||||
'erase',
|
'erase',
|
||||||
'clear',
|
'clear',
|
||||||
'push_front',
|
'pushFront',
|
||||||
'push_back',
|
'pushBack',
|
||||||
'pop_front',
|
'popFront',
|
||||||
'pop_back',
|
'popBack',
|
||||||
Symbol.iterator,
|
Symbol.iterator,
|
||||||
'toJSON',
|
'toJSON',
|
||||||
'toString',
|
'toString',
|
||||||
|
|||||||
@ -115,13 +115,13 @@ test('erase, clear', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test('push_back, push_front, pop_back, pop_front, back, front', () => {
|
test('pushBack, pushFront, popBack, popFront, back, front', () => {
|
||||||
const list = List.from([1, 2, 3])
|
const list = List.from([1, 2, 3])
|
||||||
list.pop_front()
|
list.popFront()
|
||||||
list.push_front(5)
|
list.pushFront(5)
|
||||||
list.pop_back()
|
list.popBack()
|
||||||
list.pop_back()
|
list.popBack()
|
||||||
list.push_back(10)
|
list.pushBack(10)
|
||||||
expect(listEquArray(list, [5, 10])).toBeTruthy()
|
expect(listEquArray(list, [5, 10])).toBeTruthy()
|
||||||
expect(list.front).toEqual(5)
|
expect(list.front).toEqual(5)
|
||||||
expect(list.back).toEqual(10)
|
expect(list.back).toEqual(10)
|
||||||
|
|||||||
Reference in New Issue
Block a user