sk-polyfill
v0.0.12
Published
ShaneKing for Polyfill
Downloads
28
Readme
ShaneKing for Polyfill
More to see shaneking.org.
NOTE: This project been deprecated in favor of sk-js.
Functions
- [x] Function.isFunction(f): Assert Function
- [x] Object.isObject(o): Assert Object
- [x] Array.prototype.skArr(recursive, keyFunc): [2,{skIdx0:3,skIdx1:[4,{skIdx0:5,skIdx1:[]}]}] -> [2,[3,[4,[5,[]]]]]
- [x] Array.prototype.skFilter(recursive, filterFunc): filter recursive
- [x] Array.prototype.skObj(recursive, keyFunc): [1,{a:2,b:[3,{c:4,d:[5,{}]}]}] -> {skIdx0:1,skIdx1:{a:2,b:{skIdx0:3,skIdx1:{c:4,d:{skIdx0:5,skIdx1:{}}}}}}
- [x] Array.prototype.skSomeIn(arr, compareFunc): [{id: 1}, {id: 2}, {id: 3}].skSomeIn([{id: 2, text: '2'}, {id: 3, text: '3'}, {id: 4, text: '4'}], function (i1, i2) {return i1.id === i2.id;}) -> [{id: 2}, {id: 3}]
- [x] Array.prototype.skUnique(): [1, 2, 2, 3].skUnique() -> [1, 2, 3]
- [x] Number.prototype.skCurrencyFmt(fraction): (-123456.789).skCurrencyFmt(2) -> '-123,456.79'
- [x] Number.prototype.skIn(arr): (1).skIn([1, 2, 3]) -> true
- [x] Object.prototype.skArr(recursive, keyFunc): {skIdx0:1,skIdx1:[2,{skIdx0:3,skIdx1:[4,{skIdx0:5,skIdx1:[]}]}]} -> [1,[2,[3,[4,[5,[]]]]]]
- [x] Object.prototype.skFilter(recursive, filterFunc): filter recursive
- [x] Object.prototype.skObj(recursive, keyFunc): {a:2,b:[3,{c:4,d:[5,{}]}]} -> {a:2,b:{skIdx0:3,skIdx1:{c:4,d:{skIdx0:5,skIdx1:{}}}}}
- [x] Object.prototype.skVal(str, val): like $.val()
- [x] Object.prototype.skVals(): {a: {x: 1}, b: {y: 2}} -> [{x: 1}, {y: 2}]
- [x] String.prototype.skBlank(): ' '.skBlank() -> true, ''.skBlank() -> true
- [x] String.prototype.skCurrencyFmt(fraction): '987654.321'.skCurrencyFmt(2) -> '987,654.32'
- [x] String.prototype.skEmpty(): ' '.skEmpty() -> false, ''.skEmpty() -> true
- [x] String.prototype.skEndWith(searchString, position): 'ShaneKing'.skEndWith('King') -> true
- [x] String.prototype.skFmt(o): 'My $name {is} ${name}, i {am from ${city}'.skFmt({name: 'ShaneKing', city: 'Shanghai'}) -> 'My $name {is} ShaneKing, i {am from Shanghai'
- [x] String.prototype.skFmtArr(a): 'My $name ${is} $1, i am$ from $2'.skFmtArr(['ShaneKing', 'Shanghai']) -> 'My $name ${is} ShaneKing, i am$ from Shanghai'
- [x] String.prototype.skIn(arr): '1'.skIn(['1', '2', '3']) -> true
- [x] String.prototype.skStartWith(prefix): 'ShaneKing'.skStartWith('Shane') -> true
Dependencies
Build
Test
Release
Discussion
License
ShaneKing is released under MIT.