sk-polyfill

0.0.12 • Public • Published

ShaneKing for Polyfill

More to see shaneking.org.

NOTE: This project been deprecated in favor of sk-js.

Functions

  • Function.isFunction(f): Assert Function
  • Object.isObject(o): Assert Object
  • Array.prototype.skArr(recursive, keyFunc): [2,{skIdx0:3,skIdx1:[4,{skIdx0:5,skIdx1:[]}]}] -> [2,[3,[4,[5,[]]]]]
  • Array.prototype.skFilter(recursive, filterFunc): filter recursive
  • 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:{}}}}}}
  • 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}]
  • Array.prototype.skUnique(): [1, 2, 2, 3].skUnique() -> [1, 2, 3]
  • Number.prototype.skCurrencyFmt(fraction): (-123456.789).skCurrencyFmt(2) -> '-123,456.79'
  • Number.prototype.skIn(arr): (1).skIn([1, 2, 3]) -> true
  • Object.prototype.skArr(recursive, keyFunc): {skIdx0:1,skIdx1:[2,{skIdx0:3,skIdx1:[4,{skIdx0:5,skIdx1:[]}]}]} -> [1,[2,[3,[4,[5,[]]]]]]
  • Object.prototype.skFilter(recursive, filterFunc): filter recursive
  • 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:{}}}}}
  • Object.prototype.skVal(str, val): like $.val()
  • Object.prototype.skVals(): {a: {x: 1}, b: {y: 2}} -> [{x: 1}, {y: 2}]
  • String.prototype.skBlank(): ' '.skBlank() -> true, ''.skBlank() -> true
  • String.prototype.skCurrencyFmt(fraction): '987654.321'.skCurrencyFmt(2) -> '987,654.32'
  • String.prototype.skEmpty(): ' '.skEmpty() -> false, ''.skEmpty() -> true
  • String.prototype.skEndWith(searchString, position): 'ShaneKing'.skEndWith('King') -> true
  • 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'
  • String.prototype.skFmtArr(a): 'My $name ${is} $1, i am$ from $2'.skFmtArr(['ShaneKing', 'Shanghai']) -> 'My $name ${is} ShaneKing, i am$ from Shanghai'
  • String.prototype.skIn(arr): '1'.skIn(['1', '2', '3']) -> true
  • String.prototype.skStartWith(prefix): 'ShaneKing'.skStartWith('Shane') -> true

Dependencies

Build

Test

Release

Discussion

License

ShaneKing is released under MIT.

Readme

Keywords

Package Sidebar

Install

npm i sk-polyfill

Weekly Downloads

1

Version

0.0.12

License

MIT

Last publish

Collaborators

  • shaneking