URL.createObjectURL(new Blob).split('/')[3]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function n(lit) { | |
const [str] = lit | |
const [start, end] = str.split('..').map((item) => parseInt(item)) | |
return Array.from({ length: end - start + 1 }, (v, k) => k + start) | |
} | |
console.log(n`1..8`) // [1,2,3,4,5,6,7,8] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CryptoJS from 'crypto-js' | |
function byteArrayToWordArray(ba: Uint8Array) { | |
const wa: number[] = [] | |
for (let i = 0; i < ba.length; i++) { | |
wa[(i / 4) | 0] |= ba[i] << (24 - 8 * i) | |
} | |
return CryptoJS.lib.WordArray.create(wa, ba.length) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { exec } = require('shelljs') | |
const path = require('path') | |
const exit = () => { | |
console.log('JavaScript Standard Style errors were detected. Aborting commit.') | |
process.exit(1) | |
} | |
const gitdiff = exec(`git diff --name-only --cached --relative`) | |
if (gitdiff.stderr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* source: https://github.com/fex-team/kityminder-core/blob/dev/src/module/text.js#L10-L127 | |
*/ | |
/** | |
* 针对不同系统、不同浏览器、不同字体做居中兼容性处理 | |
* 暂时未增加Linux的处理 | |
*/ | |
var FONT_ADJUST = { | |
'safari': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"v8.x": { | |
"all": [ | |
"assert", | |
"async_hooks", | |
"buffer", | |
"child_process", | |
"cluster", | |
"crypto", | |
"dns", |
- 可以从
Model
里获取
const Users = mongoose.model('User', new mongoose.Schema({}), 'users')
const db = Users.db
// 然后就可以使用db了,比如 db.collection('users').find({}).toArray()