UNPKG

sk-polyfill

Version:
101 lines (75 loc) 4.86 kB
# [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 [![][versioneye img]][versioneye] [![][david img]][david] [![][davidDev img]][davidDev] [![][davidPeer img]][davidPeer] ## Build [![][travis img]][travis] ## Test [![][codecov img]][codecov] [![][codacy img]][codacy] ## Release [![][npmbadge img]][npmbadge] [![][npmDownloadbadge img]][npmDownloadbadge] [![][npmDetailBadge img]][npmDetailBadge] ## Discussion [![][gitter img]][gitter] ## License [![][license img]][license] ShaneKing is released under [MIT][]. [ShaneKing for Polyfill]: http://shaneking.org/c/sk-polyfill [sk-js]: https://github.com/ShaneKing/sk-js [shaneking.org]: http://shaneking.org/ [versioneye]:https://www.versioneye.com/user/projects/56fa93a735630e0034fda5fb [versioneye img]:https://www.versioneye.com/user/projects/56fa93a735630e0034fda5fb/badge.svg [david]:https://david-dm.org/ShaneKing/sk-polyfill [david img]:https://david-dm.org/ShaneKing/sk-polyfill.svg [davidDev]:https://david-dm.org/ShaneKing/sk-polyfill#info=devDependencies [davidDev img]:https://david-dm.org/ShaneKing/sk-polyfill/dev-status.svg [davidPeer]:https://david-dm.org/ShaneKing/sk-polyfill#info=peerDependencies [davidPeer img]:https://david-dm.org/ShaneKing/sk-polyfill/peer-status.svg [travis]:https://travis-ci.org/ShaneKing/sk-polyfill [travis img]:https://travis-ci.org/ShaneKing/sk-polyfill.png [codecov]:https://codecov.io/github/ShaneKing/sk-polyfill?branch=mirror [codecov img]:https://codecov.io/github/ShaneKing/sk-polyfill/coverage.svg?branch=mirror [codacy]:https://www.codacy.com/app/ShaneKing/sk-polyfill [codacy img]:https://api.codacy.com/project/badge/grade/2d74f2fcacf34466b33da168bb732f44 [saucelabs]:https://saucelabs.com/u/ShaneKing [saucelabs img]:https://saucelabs.com/browser-matrix/ShaneKing.svg [npmbadge]:https://www.npmjs.com/package/sk-polyfill [npmbadge img]:https://img.shields.io/npm/v/sk-polyfill.svg [npmDownloadbadge]:https://www.npmjs.com/package/sk-polyfill [npmDownloadbadge img]:http://img.shields.io/npm/dm/sk-polyfill.svg [npmDetailBadge]:https://www.npmjs.com/package/sk-polyfill [npmDetailBadge img]:https://nodei.co/npm/sk-polyfill.png?downloads=true&downloadRank=true&stars=true [gitter]:https://gitter.im/ShaneKing/sk-polyfill?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge [gitter img]:https://badges.gitter.im/Join%20Chat.svg [MIT]: https://opensource.org/licenses/MIT [license]:LICENSE [license img]:https://img.shields.io/badge/License-MIT-blue.svg