Update website with latest releases of DivaBot.

pull/5/head
sigonasr2 4 years ago
parent 5d0de5240b
commit e93fbbb3c5
  1. 316
      frontend/src/App.js
  2. 28
      frontend/src/setupProxy.js
  3. 152
      server/app.js
  4. BIN
      server/files/releases/DivaBot01.zip
  5. BIN
      server/files/releases/DivaBot01A.zip
  6. BIN
      server/files/releases/DivaBot01B.zip
  7. 21
      server/node_modules/arr-flatten/LICENSE
  8. 86
      server/node_modules/arr-flatten/README.md
  9. 22
      server/node_modules/arr-flatten/index.js
  10. 115
      server/node_modules/arr-flatten/package.json
  11. 44
      server/node_modules/arraybuffer-to-string/.eslintrc.json
  12. 5
      server/node_modules/arraybuffer-to-string/.travis.yml
  13. 45
      server/node_modules/arraybuffer-to-string/browser.js
  14. 11
      server/node_modules/arraybuffer-to-string/index.js
  15. 65
      server/node_modules/arraybuffer-to-string/package.json
  16. 27
      server/node_modules/arraybuffer-to-string/readme.md
  17. 257
      server/node_modules/arraybuffer-to-string/test.js
  18. 6
      server/node_modules/atob-lite/.npmignore
  19. 18
      server/node_modules/atob-lite/LICENSE.md
  20. 37
      server/node_modules/atob-lite/README.md
  21. 3
      server/node_modules/atob-lite/atob-browser.js
  22. 3
      server/node_modules/atob-lite/atob-node.js
  23. 67
      server/node_modules/atob-lite/package.json
  24. 2
      server/node_modules/bmp-js/.npmignore
  25. 21
      server/node_modules/bmp-js/LICENSE
  26. 44
      server/node_modules/bmp-js/README.md
  27. 9
      server/node_modules/bmp-js/bmp-js.iml
  28. 15
      server/node_modules/bmp-js/index.js
  29. 485
      server/node_modules/bmp-js/lib/decoder.js
  30. 81
      server/node_modules/bmp-js/lib/encoder.js
  31. 60
      server/node_modules/bmp-js/package.json
  32. BIN
      server/node_modules/bmp-js/test/bit1.bmp
  33. BIN
      server/node_modules/bmp-js/test/bit16_565.bmp
  34. BIN
      server/node_modules/bmp-js/test/bit16_565_out.bmp
  35. BIN
      server/node_modules/bmp-js/test/bit16_a444.bmp
  36. BIN
      server/node_modules/bmp-js/test/bit16_a444_out.bmp
  37. BIN
      server/node_modules/bmp-js/test/bit16_a555.bmp
  38. BIN
      server/node_modules/bmp-js/test/bit16_a555_out.bmp
  39. BIN
      server/node_modules/bmp-js/test/bit16_x444.bmp
  40. BIN
      server/node_modules/bmp-js/test/bit16_x444_out.bmp
  41. BIN
      server/node_modules/bmp-js/test/bit16_x555.bmp
  42. BIN
      server/node_modules/bmp-js/test/bit16_x555_out.bmp
  43. BIN
      server/node_modules/bmp-js/test/bit1_out.bmp
  44. BIN
      server/node_modules/bmp-js/test/bit24.bmp
  45. BIN
      server/node_modules/bmp-js/test/bit24_out.bmp
  46. BIN
      server/node_modules/bmp-js/test/bit32.bmp
  47. BIN
      server/node_modules/bmp-js/test/bit32_alpha.bmp
  48. BIN
      server/node_modules/bmp-js/test/bit32_alpha_out.bmp
  49. BIN
      server/node_modules/bmp-js/test/bit32_out.bmp
  50. BIN
      server/node_modules/bmp-js/test/bit4.bmp
  51. BIN
      server/node_modules/bmp-js/test/bit4_RLE.bmp
  52. BIN
      server/node_modules/bmp-js/test/bit4_RLE_out.bmp
  53. BIN
      server/node_modules/bmp-js/test/bit4_out.bmp
  54. BIN
      server/node_modules/bmp-js/test/bit8.bmp
  55. BIN
      server/node_modules/bmp-js/test/bit8_RLE.bmp
  56. BIN
      server/node_modules/bmp-js/test/bit8_RLE_out.bmp
  57. BIN
      server/node_modules/bmp-js/test/bit8_out.bmp
  58. 33
      server/node_modules/bmp-js/test/test.js
  59. 4
      server/node_modules/buffer-equal/.travis.yml
  60. 62
      server/node_modules/buffer-equal/README.markdown
  61. 14
      server/node_modules/buffer-equal/example/eq.js
  62. 14
      server/node_modules/buffer-equal/index.js
  63. 62
      server/node_modules/buffer-equal/package.json
  64. 35
      server/node_modules/buffer-equal/test/eq.js
  65. 18
      server/node_modules/buffer-to-uint8array/LICENSE
  66. 5
      server/node_modules/buffer-to-uint8array/example/buf.js
  67. 11
      server/node_modules/buffer-to-uint8array/index.js
  68. 60
      server/node_modules/buffer-to-uint8array/package.json
  69. 37
      server/node_modules/buffer-to-uint8array/readme.markdown
  70. 10
      server/node_modules/buffer-to-uint8array/test/buf.js
  71. 10
      server/node_modules/buffer-to-uint8array/test/str.js
  72. 15
      server/node_modules/buffer-to-uint8array/test/u8.js
  73. 2
      server/node_modules/clamp/.npmignore
  74. 21
      server/node_modules/clamp/LICENSE.md
  75. 17
      server/node_modules/clamp/README.md
  76. 7
      server/node_modules/clamp/index.js
  77. 61
      server/node_modules/clamp/package.json
  78. 11
      server/node_modules/clamp/test.js
  79. 44
      server/node_modules/clip-pixels/.eslintrc.json
  80. 13
      server/node_modules/clip-pixels/.travis.yml
  81. 24
      server/node_modules/clip-pixels/index.js
  82. 54
      server/node_modules/clip-pixels/package.json
  83. 22
      server/node_modules/clip-pixels/readme.md
  84. 31
      server/node_modules/clip-pixels/test.js
  85. 21
      server/node_modules/compute-dims/LICENSE
  86. 137
      server/node_modules/compute-dims/README.md
  87. 114
      server/node_modules/compute-dims/lib/index.js
  88. 83
      server/node_modules/compute-dims/package.json
  89. 21
      server/node_modules/const-max-uint32/LICENSE
  90. 130
      server/node_modules/const-max-uint32/README.md
  91. 5
      server/node_modules/const-max-uint32/lib/index.js
  92. 104
      server/node_modules/const-max-uint32/package.json
  93. 21
      server/node_modules/const-pinf-float64/LICENSE
  94. 124
      server/node_modules/const-pinf-float64/README.md
  95. 5
      server/node_modules/const-pinf-float64/lib/index.js
  96. 102
      server/node_modules/const-pinf-float64/package.json
  97. 7
      server/node_modules/crypto/README.md
  98. 45
      server/node_modules/crypto/package.json
  99. 16
      server/node_modules/cwise-compiler/.npmignore
  100. 6
      server/node_modules/cwise-compiler/.travis.yml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -13,7 +13,8 @@ import {
import { import {
Modal, Modal,
Button Button,
Form
} from "react-bootstrap"; } from "react-bootstrap";
const REMOTE_ADDR = "http://45.33.13.215:4502"; const REMOTE_ADDR = "http://45.33.13.215:4502";
@ -957,8 +958,8 @@ function Rankings(){
<th className="header"><Sort setIsLoading={setIsLoading} updateUsers={updateUsers} setUpdateUsers={setUpdateUsers} label="FC Count" order="fccount"/></th> <th className="header"><Sort setIsLoading={setIsLoading} updateUsers={updateUsers} setUpdateUsers={setUpdateUsers} label="FC Count" order="fccount"/></th>
</tr> </tr>
</thead> </thead>
{users.map((user)=> {users.map((user,i)=>
<tbody key={user.id}> <tbody key={i}>
<tr> <tr>
<td className={(isLoading)?"loading":""}><Link to={"/user/"+user.username}>{user.username}</Link></td> <td className={(isLoading)?"loading":""}><Link to={"/user/"+user.username}>{user.username}</Link></td>
<td className={(isLoading)?"loading":""} className={(isLoading)?"loading":""} className={(isLoading)?"loading":""}>{user.last_played}</td> <td className={(isLoading)?"loading":""} className={(isLoading)?"loading":""} className={(isLoading)?"loading":""}>{user.last_played}</td>
@ -1218,10 +1219,294 @@ function RecentPlays(p) {
) )
} }
function LoginInfo(p) {
const [username,setUsername] = useState(undefined)
const [authToken,setAuthToken] = useState(undefined)
const [loggedIn,setLoggedIn] = useState(false)
//Load our storage data if exists.
useEffect(()=>{
try {
setUsername(localStorage.getItem("username"))
setAuthToken(localStorage.getItem("authToken"))
}catch{
console.log("Not logged in!");
}
},[p.update])
useEffect(()=>{
if (username!==undefined&&authToken!==undefined) {
axios.post("http://projectdivar.com/authenticate/login",{username:username,authCode:authToken})
.then((data)=>{
setLoggedIn(true);
p.setUsername(username);
})
.catch((err)=>{
setLoggedIn(false);
})
}
},[username,authToken])
return (
<>
{loggedIn?<>
Welcome, <b>{username}</b>!<br/>
<Link to="/auth">App Auth Code</Link><br/>
</>:<>
<Link to="/login">Login</Link><br/>
<Link to="/register">Register</Link>
</>}
</>
)
}
function Login(p) {
const [username,setUsername] = useState("")
const [authCode,setAuthCode] = useState("")
const [authCodeVisible,setAuthCodeVisible] = useState(false)
const [error,setError] = useState(false)
const [disabled,setDisabled] = useState(false)
let history = useHistory();
if (p.isLoggedIn) {
history.push("/")
}
return (
<>
<Form>
{error&&<h3 style={{color:"red"}}>{error}</h3>}
{authCodeVisible&&<><h3>We have sent you an email containing your login code!</h3>
<br/>
Please submit it to finish the login process.
</>}
<Form.Group controlId="formUsername">
<Form.Label>Username</Form.Label>
<Form.Control disabled={authCodeVisible} isInvalid={username.length<1} onChange={(e)=>{setUsername(e.currentTarget.value)}} placeholder="MikuMiku" value={username} />
<Form.Text className="text-muted">
We will send an email to the registered email of this account.
</Form.Text>
</Form.Group>
{authCodeVisible&&<>
<div className="row">
<div className="col-4">
<Form.Group controlId="formCode">
<Form.Label>Authentication Code</Form.Label>
<Form.Control isInvalid={authCode.length!=5} onChange={(e)=>{setAuthCode(e.currentTarget.value)}} placeholder="XXXXX" value={authCode} />
<Form.Text className="text-muted">
Please enter the code you received in your email here. Then submit again.
</Form.Text>
</Form.Group>
</div>
</div></>
}
<Button disabled={disabled} variant="primary" type="submit" onClick={(e)=>{e.preventDefault()
if (username.length>=1) {
setDisabled(true)
setError(false)
if (authCode.length===5) {
axios.post("http://projectdivar.com/authenticate/login",{username:username,authCode:authCode})
.then((data)=>{
localStorage.setItem("username",username)
localStorage.setItem("authToken",authCode)
p.setLoginPanelUpdate(true)
history.push("/")
})
.catch((err)=>{
if (err) {
setError("Invalid Authentication Code!")
setDisabled(false)
}
})
} else {
axios.post("http://projectdivar.com/sendemail/login",{username:username})
.then((data)=>{
setAuthCodeVisible(true)
setDisabled(false)
})
.catch((err)=>{
if (err) {
setError("Invalid credentials provided!")
setDisabled(false)
}
})
}
}
}}>
{authCodeVisible?"Submit Code":"Login"}
</Button>
</Form>
</>
)
}
function Register(p) {
const [username,setUsername] = useState("")
const [email,setEmail] = useState("")
const [authCode,setAuthCode] = useState("")
const [authCodeVisible,setAuthCodeVisible] = useState(false)
const [error,setError] = useState(false)
const [disabled,setDisabled] = useState(false)
let history = useHistory();
if (p.isLoggedIn) {
history.push("/")
}
return (
<>
<Form>
{error&&<h3 style={{color:"red"}}>{error}</h3>}
{authCodeVisible&&<><h3>We have sent you an email containing your registration code!</h3>
<br/>
Please submit it to finish the registration process.
</>}
<Form.Group controlId="formUsername">
<Form.Label>Username</Form.Label>
<Form.Control disabled={authCodeVisible} isInvalid={username.length<1} onChange={(e)=>{setUsername(e.currentTarget.value)}} placeholder="MikuMiku" value={username} />
</Form.Group>
<Form.Group controlId="formEmail">
<Form.Label>Email Address</Form.Label>
<Form.Control disabled={authCodeVisible} type="email" disabled={authCodeVisible} isInvalid={email.length<1} onChange={(e)=>{setEmail(e.currentTarget.value)}} placeholder="MikuMiku@39.net" value={email} />
<Form.Text className="text-muted">
Please provide a valid email address! We use your email account as your "password", so it is a requirement for this site.
</Form.Text>
</Form.Group>
{authCodeVisible&&<>
<div className="row">
<div className="col-4">
<Form.Group controlId="formAuthCode">
<Form.Label>Authentication Code</Form.Label>
<Form.Control isInvalid={authCode.length!=5} onChange={(e)=>{setAuthCode(e.currentTarget.value)}} placeholder="XXXXX" value={authCode} />
<Form.Text className="text-muted">
Please enter the code you received in your email here. Then submit again.
</Form.Text>
</Form.Group>
</div>
</div></>
}
<Button disabled={disabled} variant="primary" type="submit" onClick={(e)=>{e.preventDefault()
if (username.length>=1&&email.length>=1) {
setDisabled(true)
setError(false)
if (authCode.length===5) {
axios.post("http://projectdivar.com/authenticate/login",{username:username,authCode:authCode})
.then((data)=>{
localStorage.setItem("username",username)
localStorage.setItem("authToken",authCode)
p.setLoginPanelUpdate(true)
return axios.patch("http://projectdivar.com/updateRegisteredState",{username:username,authCode:authCode})
})
.then((data)=>{
//console.log(data)
history.push("/")
})
.catch((err)=>{
if (err) {
setError("Invalid Authentication Code!")
setDisabled(false)
}
})
} else {
axios.post("http://projectdivar.com/sendemail/register",{username:username,email:email})
.then((data)=>{
setAuthCodeVisible(true)
setDisabled(false)
})
.catch((err)=>{
if (err) {
setError("Username or Email already in use!")
setDisabled(false)
}
})
}
}
}}>
{authCodeVisible?"Submit Code":"Register"}
</Button>
</Form>
</>
)
}
function UserAuth(p) {
const[showAuthCode,setShowAuthCode] = useState(false)
const[authToken,setAuthToken] = useState("")
let history = useHistory();
if (!p.isLoggedIn) {
history.push("/")
}
return(<>
Your <b>App Authentication Code</b> is used for verifying your identity when using apps such as <b>DivaBot</b>. By clicking the <b>{"<Reveal Code>"}</b> button, you understand that you should not share this code or show it to anyone!
<br/><br/>
{showAuthCode?
<input readOnly value={authToken}></input>
:<button onClick={()=>{
axios.post("http://projectdivar.com/authenticate/authToken",{username:localStorage.getItem("username"),
authCode:localStorage.getItem("authToken")})
.then((data)=>{
setAuthToken(data.data.authentication_token)
setShowAuthCode(true)
})
.catch((err)=>{
setAuthToken(err.message)
})
}
}>
{"<Click to reveal App Authentication Code>"}
</button>
}
</>)
}
function ReleaseList(p) {
return(
<>
<ul className="list-group">
{p.releases.map((release,i)=>
<li key={i} className="list-group-item">
<b>{release[0]}</b> - <a href={release[1]}>{release[1].replace("http://projectdivar.com/files/releases/","")}</a> <i>(Released {release[2]})</i>
</li>
)}
</ul>
</>
)
}
function DivaBot() {
const releases=[
["01B","http://projectdivar.com/files/releases/DivaBot01B.zip","13 Sep 2020"],
["01A","http://projectdivar.com/files/releases/DivaBot01A.zip","13 Sep 2020"],
["01","http://projectdivar.com/files/releases/DivaBot01.zip","13 Sep 2020"]]
return (
<>
<b>DivaBot</b> was created by <b>sigonasr2</b> in order to allow Project Diva streamers to personalize their stream setups with their personal scores and achievements into their game.
<br/><br/>
The app works by monitoring your game's capture area as you are streaming in order to identify what song you are playing, and what scores you achieve. It is used with this website to make score
submitting and tracking easier.
<br/>
The app currently supports <b>Megamix</b>. Other games will be supported in the future.
<hr/>
<h3>Setup Instructions</h3>
{<iframe width="100%" height="480" src="https://www.youtube.com/embed/IAPpbp5EFto" frameBorder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>}
<hr/>
<h3>Downloads</h3>
<ReleaseList releases={releases}/>
</>
)
}
function Website() { function Website() {
const [songs,setSongs] = useState([]) const [songs,setSongs] = useState([])
const [update,setUpdate] = useState(false) const [update,setUpdate] = useState(false)
const [tooltip,setTooltip] = useState("") const [tooltip,setTooltip] = useState("")
const [loginPanelUpdate,setLoginPanelUpdate] = useState(false)
const [username,setUsername] = useState(undefined)
useEffect(()=>{ useEffect(()=>{
axios.get("http://www.projectdivar.com/songs") axios.get("http://www.projectdivar.com/songs")
@ -1233,11 +1518,11 @@ function Website() {
return ( return (
<div className="row"> <div className="row">
<div className="col-md-2 pt-3 pb-3 overflow-hidden text-center"> <div className="col-md-2 pt-3 pb-3 overflow-hidden text-center">
<h3 className="d-none d-md-block">Sidebar Contents</h3> <h3 className="d-none d-md-block">Menu</h3>
<LoginInfo setUsername={setUsername} update={loginPanelUpdate}/>
<br/><br/>
<Link to="/rankings/rating/desc">Rankings</Link><br/> <Link to="/rankings/rating/desc">Rankings</Link><br/>
Item 2<br/> <Link to="/divabot">DivaBot</Link><br/>
Item 3<br/>
Item 4<br/>
</div> </div>
<div className="col-md-10 pt-3 pb-3"> <div className="col-md-10 pt-3 pb-3">
<Switch> <Switch>
@ -1252,13 +1537,26 @@ function Website() {
<Route path="/submitplay"> <Route path="/submitplay">
<Submit songs={songs}/> <Submit songs={songs}/>
</Route> </Route>
<Route path="/sendmail"> <Route path="/divabot">
<SendMail/> <h1 className="title">DivaBot</h1>
<DivaBot/>
</Route>
<Route path="/auth">
<h1 className="title">App Authentication Token</h1>
<UserAuth username={username} isLoggedIn={username!==undefined}/>
</Route> </Route>
<Route path="/recentplays"> <Route path="/recentplays">
<h1 className="title">Project DivaR</h1> <h1 className="title">Project DivaR</h1>
<RecentPlays songs={songs}/> <RecentPlays songs={songs}/>
</Route> </Route>
<Route path="/login">
<h1 className="title">Login to Project DivaR</h1>
<Login isLoggedIn={username!==undefined} setLoginPanelUpdate={setLoginPanelUpdate}/>
</Route>
<Route path="/register">
<h1 className="title">Register New Account</h1>
<Register isLoggedIn={username!==undefined} setLoginPanelUpdate={setLoginPanelUpdate}/>
</Route>
<Route path="/"> <Route path="/">
<h1 className="title">Project DivaR</h1> <h1 className="title">Project DivaR</h1>
Under construction! Under construction!

@ -1,6 +1,27 @@
const { createProxyMiddleware } = require('http-proxy-middleware'); const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) { module.exports = function(app) {
app.use(
"/authenticate/authToken",
createProxyMiddleware({
target: 'http://server:4501',
changeOrigin: true,
})
);
app.use(
"/updateRegisteredState",
createProxyMiddleware({
target: 'http://server:4501',
changeOrigin: true,
})
);
app.use(
"/authenticate/login",
createProxyMiddleware({
target: 'http://server:4501',
changeOrigin: true,
})
);
app.use( app.use(
"/authenticateuser", "/authenticateuser",
createProxyMiddleware({ createProxyMiddleware({
@ -106,13 +127,6 @@ module.exports = function(app) {
changeOrigin: true, changeOrigin: true,
}) })
); );
app.use(
"/register",
createProxyMiddleware({
target: 'http://server:4501',
changeOrigin: true,
})
);
app.use( app.use(
"/remove", "/remove",
createProxyMiddleware({ createProxyMiddleware({

@ -16,6 +16,7 @@ const nodemailer = require('nodemailer');
const fileUpload = require('express-fileupload'); const fileUpload = require('express-fileupload');
const unzipper = require('unzipper'); const unzipper = require('unzipper');
const fs = require('fs'); const fs = require('fs');
const moment = require('moment');
app.use( app.use(
fileUpload({createParentPath:true, fileUpload({createParentPath:true,
limits: { fileSize: 15 * 1024 * 1024, files: 1 }, limits: { fileSize: 15 * 1024 * 1024, files: 1 },
@ -81,7 +82,7 @@ app.get('/songs', (req, res) => {
}) })
}) })
app.post('/register', (req, res) => { /*app.post('/register', (req, res) => {
if (req.body && req.body.username && if (req.body && req.body.username &&
req.body.username.length>2 && req.body.email) { req.body.username.length>2 && req.body.email) {
var duplicateFound=false; var duplicateFound=false;
@ -98,7 +99,7 @@ req.body.username.length>2 && req.body.email) {
} else { } else {
res.status(400).json("Invalid username!") res.status(400).json("Invalid username!")
} }
}) })*/
app.delete('/remove',(req,res)=>{ app.delete('/remove',(req,res)=>{
if (req.body && if (req.body &&
@ -281,6 +282,9 @@ CalculateSongScore=(song)=>{
console.log("Is PFC? "+(song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0))*/ console.log("Is PFC? "+(song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0))*/
var scoreMult=1; var scoreMult=1;
var percentMult=1; var percentMult=1;
if (song.percent>110) {
song.percent=100
}
if (song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0){scoreMult=2.4}else if(comboBreaks===0){scoreMult=1.4}else{scoreMult=1} if (song.fine===0&&song.safe===0&&song.sad===0&&song.worst===0){scoreMult=2.4}else if(comboBreaks===0){scoreMult=1.4}else{scoreMult=1}
switch (song.difficulty){ switch (song.difficulty){
case "E":{if(song.percent<30){percentMult=0;}else{percentMult=1+Math.pow(1.0*((song.percent-30)/70.0),3)}}break; case "E":{if(song.percent<30){percentMult=0;}else{percentMult=1+Math.pow(1.0*((song.percent-30)/70.0),3)}}break;
@ -704,7 +708,30 @@ app.post('/song/:songname/:difficulty',(req,res)=>{
}) })
function CheckUserExists(username,email) { function CheckUserExists(username,email) {
return db.query("select id,username,email from users where username=$1 or email=$2 limit 1",[username,email]) return db.query("select id,username,email,registered from users where username=$1 or email=$2 limit 1",[username,email])
}
function SendLoginEmail(username,emailTo,authCode) {
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'admin@projectdivar.com',
pass: process.env.GMAIL // naturally, replace both with your real credentials or an application-specific password
}
});
transporter.sendMail({
from: 'admin@projectdivar.com',
to: emailTo,
subject: 'Project DivaR Login Code',
html: `<b>${username}</b>,<br><br>Thank you for using Project DivaR!<br><br>Your authentication code is <b>${authCode}</b>!`
}, (err, info) => {
if (err) {
console.log(err.message)
} else {
console.log(info.envelope);
console.log(info.messageId);
}
});
} }
function SendRegistrationEmail(username,emailTo,authCode) { function SendRegistrationEmail(username,emailTo,authCode) {
@ -730,24 +757,127 @@ function SendRegistrationEmail(username,emailTo,authCode) {
}); });
} }
function GetUserInfo(username) {
return db.query("select id,username,email,code_time from users where username=$1 limit 1",[username])
}
function GetUserLoginAllowed(username,authCode) {
return db.query("select id,username,email,code_time from users where username=$1 and code=$2 limit 1",[username,authCode])
}
app.post('/authenticate/authToken',(req,res)=>{
if (req.body&&req.body.username&&req.body.authCode) {
GetUserLoginAllowed(req.body.username.trim(),req.body.authCode.trim())
.then((data)=>{
if (data.rows.length>0) {
return db.query("select authentication_token from users where id=$1",[data.rows[0].id])
} else {
return new Error("Failed login!")
}
})
.then((data)=>{
if (data.rows.length>0) {
res.status(200).json(data.rows[0])
} else {
return new Error("Failed to get authentication token!")
}
})
.catch((err)=>{
res.status(500).json(err.message)
})
} else {
res.status(400).json("Invalid Credentials!")
}
})
app.post('/authenticate/login',(req,res)=>{
if (req.body&&req.body.username&&req.body.authCode) {
GetUserLoginAllowed(req.body.username.trim(),req.body.authCode.trim())
.then((data)=>{
if (data.rows.length>0) {
res.status(200).json("Login allowed!")
} else {
res.status(400).json("Failed login!")
}
})
} else {
res.status(400).json("Invalid Credentials!")
}
})
app.post('/sendemail/login',function(req,res) {
if (req.body&&req.body.username) {
GetUserInfo(req.body.username.trim())
.then((data)=>{
if (data.rows.length>0) {
res.status(200).json("Email sent.")
//console.log(data.rows[0].code_time)
if (data.rows[0].code_time) {
if (moment(data.rows[0].code_time,"YYYY-MM-DD HH:mm:ss.SSSZ").diff(moment(),'minutes')<=-15) {
var authCode=Math.floor(Math.random()*90000)+10000
SendLoginEmail(req.body.username,data.rows[0].email,authCode)
db.query("update users set code=$1,code_time=$3 where id=$2",[authCode,data.rows[0].id,moment()])
}
//console.log(moment(data.rows[0].code_time,"YYYY-MM-DD HH:mm:ss.SSSZ").diff(moment(),'minutes'))
} else {
var authCode=Math.floor(Math.random()*90000)+10000
SendLoginEmail(req.body.username,data.rows[0].email,authCode)
db.query("update users set code=$1,code_time=$3 where id=$2",[authCode,data.rows[0].id,moment()])
}
} else {
res.status(400).json("User does not exist!")
}
})
} else {
res.status(400).json("Invalid credentials!")
}
})
app.patch('/updateRegisteredState',function(req,res) {
if (req.body&&req.body.username&&req.body.authCode) {
GetUserLoginAllowed(req.body.username,req.body.authCode)
.then((data)=>{
if (data.rows.length>0) {
return db.query("update users set registered=$1 where id=$2",[true,data.rows[0].id])
} else {
throw new Error("Could not login!")
}
})
.then((data)=>{
res.status(200).json("Registered!")
})
.catch((err)=>{
res.status(500).json("Could not finish registration!")
})
} else {
res.status(400).json("Invalid credentials!")
}
})
app.post('/sendemail/register',function(req,res) { app.post('/sendemail/register',function(req,res) {
if (req.body&&req.body.username&&req.body.email) { if (req.body&&req.body.username&&req.body.email) {
//Generate a token for the user to login with. //Generate a token for the user to login with.
CheckUserExists(req.body.username,req.body.email) CheckUserExists(req.body.username.trim(),req.body.email.trim())
.then((data)=>{ .then((data)=>{
var authCode=Math.floor(Math.random()*90000)+10000 var authCode=Math.floor(Math.random()*90000)+10000
var authenticationToken=String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000); var authenticationToken=String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000)+"-"+String(Math.floor(Math.random()*90000)+10000);
if (data.rows.length>0) { if (data.rows.length>0) {
db.query("update users set code=$1 where id=$2",[authCode,data.rows[0].id]) //db.query("update users set code=$1 where id=$2",[authCode,data.rows[0].id])
if (data.rows[0].registered) {
throw new Error("User already exists!")
} else {
return db.query("update users set code=$1 where id=$2 returning code",[authCode,data.rows[0].id])
}
} else { } else {
db.query("insert into users(username,email,authentication_token,code) values($1,$2,$3,$4)", return db.query("insert into users(username,email,authentication_token,code) values($1,$2,$3,$4) returning code",
[req.body.username,req.body.email,authenticationToken,authCode]) [req.body.username,req.body.email,authenticationToken,authCode])
} }
return authCode
}) })
.then((authCode)=>{ .then((data)=>{
res.status(200).json("Email sent.") if (data.rows.length>0) {
SendRegistrationEmail(req.body.username,req.body.email,authCode) res.status(200).json("Email sent.")
SendRegistrationEmail(req.body.username,req.body.email,data.rows[0].code)
} else {
res.status(500).json("Something bad happened!")
}
}) })
.catch((err)=>{ .catch((err)=>{
res.status(500).json(err.message) res.status(500).json(err.message)
@ -763,7 +893,7 @@ function AuthenticateUser(username,auth) {
app.post('/authenticateuser',function(req,res) { app.post('/authenticateuser',function(req,res) {
if (req.body&&req.body.username&&req.body.authenticationToken) { if (req.body&&req.body.username&&req.body.authenticationToken) {
AuthenticateUser(req.body.username,req.body.authenticationToken) AuthenticateUser(req.body.username.trim(),req.body.authenticationToken.trim())
.then((data)=>{ .then((data)=>{
if (data.rows.length>0) { if (data.rows.length>0) {
res.status(200).json("Authentication Success!") res.status(200).json("Authentication Success!")

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -1,86 +0,0 @@
# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)
> Recursively flatten an array or arrays.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save arr-flatten
```
## Install
Install with [bower](https://bower.io/)
```sh
$ bower install arr-flatten --save
```
## Usage
```js
var flatten = require('arr-flatten');
flatten(['a', ['b', ['c']], 'd', ['e']]);
//=> ['a', 'b', 'c', 'd', 'e']
```
## Why another flatten utility?
I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
## About
### Related projects
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.")
* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.")
* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.")
* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [lukeed](https://github.com/lukeed) |
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._

@ -1,22 +0,0 @@
/*!
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
module.exports = function (arr) {
return flat(arr, []);
};
function flat(arr, res) {
var i = 0, cur;
var len = arr.length;
for (; i < len; i++) {
cur = arr[i];
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
}
return res;
}

@ -1,115 +0,0 @@
{
"_from": "arr-flatten@^1.1.0",
"_id": "arr-flatten@1.1.0",
"_inBundle": false,
"_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
"_location": "/arr-flatten",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arr-flatten@^1.1.0",
"name": "arr-flatten",
"escapedName": "arr-flatten",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/image-pixels",
"/pxls",
"/to-uint8"
],
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1",
"_spec": "arr-flatten@^1.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-pixels",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Luke Edwards",
"url": "https://lukeed.com"
}
],
"deprecated": false,
"description": "Recursively flatten an array or arrays.",
"devDependencies": {
"ansi-bold": "^0.1.1",
"array-flatten": "^2.1.1",
"array-slice": "^1.0.0",
"benchmarked": "^1.0.0",
"compute-flatten": "^1.0.0",
"flatit": "^1.1.1",
"flatten": "^1.0.2",
"flatten-array": "^1.0.0",
"glob": "^7.1.1",
"gulp-format-md": "^0.1.12",
"just-flatten-it": "^1.1.23",
"lodash.flattendeep": "^4.4.0",
"m_flattened": "^1.0.1",
"mocha": "^3.2.0",
"utils-flatten": "^1.0.0",
"write": "^0.3.3"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"keywords": [
"arr",
"array",
"elements",
"flat",
"flatten",
"nested",
"recurse",
"recursive",
"recursively"
],
"license": "MIT",
"main": "index.js",
"name": "arr-flatten",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/arr-flatten.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"arr-filter",
"arr-union",
"array-each",
"array-unique"
]
},
"lint": {
"reflinks": true
}
},
"version": "1.1.0"
}

@ -1,44 +0,0 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"strict": 2,
"indent": 0,
"linebreak-style": 0,
"quotes": 0,
"semi": 0,
"no-cond-assign": 1,
"no-constant-condition": 1,
"no-duplicate-case": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-global-assign": 1,
"no-implicit-globals": 2,
"no-inner-declarations": ["error", "functions"],
"no-irregular-whitespace": 2,
"no-loop-func": 1,
"no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}],
"no-multi-str": 1,
"no-mixed-spaces-and-tabs": 1,
"no-proto": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-useless-call": 1,
"no-void": 1,
"no-with": 2,
"wrap-iife": 1,
"no-redeclare": 1,
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-sparse-arrays": 1
}
}

@ -1,5 +0,0 @@
language: node_js
node_js:
- '6'
- '5'
- '4'

@ -1,45 +0,0 @@
/**
* @module arraybuffer-to-string/browser
*/
'use strict'
module.exports = function ArrayBufferToString (buffer, encoding) {
if (encoding == null) encoding = 'utf8'
var uint8 = new Uint8Array(buffer)
if (encoding === 'hex') {
var out = ''
for (var i = 0, l = uint8.byteLength; i < l; ++i) {
out += toHex(uint8[i])
}
return out
}
if (encoding === 'base64') {
str = String.fromCharCode.apply(null, uint8)
return btoa(str)
}
if (encoding === 'binary' ||
encoding === 'latin1' ||
!global.TextDecoder) {
str = String.fromCharCode.apply(null, uint8)
return str
}
//TextDecoder way
if (encoding === 'utf16le') encoding = 'utf-16le'
var decoder = new TextDecoder(encoding)
var str = decoder.decode(uint8)
return str
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}

@ -1,11 +0,0 @@
/**
* @module arraybuffer-to-string
*/
'use strict'
module.exports = function ArrayBufferToString (buffer, encoding) {
if (encoding == null) encoding = 'utf8'
return Buffer.from(buffer).toString(encoding)
}

@ -1,65 +0,0 @@
{
"_from": "arraybuffer-to-string@^1.0.2",
"_id": "arraybuffer-to-string@1.0.2",
"_inBundle": false,
"_integrity": "sha512-WbIYlLVmvIAyUBdQRRuyGOJRriOQy9OAsWcyURmsRQp9+g647hdMSS2VFKXbJLVw0daUu06hqwLXm9etVrXI9A==",
"_location": "/arraybuffer-to-string",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arraybuffer-to-string@^1.0.2",
"name": "arraybuffer-to-string",
"escapedName": "arraybuffer-to-string",
"rawSpec": "^1.0.2",
"saveSpec": null,
"fetchSpec": "^1.0.2"
},
"_requiredBy": [
"/image-pixels"
],
"_resolved": "https://registry.npmjs.org/arraybuffer-to-string/-/arraybuffer-to-string-1.0.2.tgz",
"_shasum": "c373aa7bb0e6844d9a2bc9654c8889a9570a26e2",
"_spec": "arraybuffer-to-string@^1.0.2",
"_where": "/home/sigonasr2/divar/server/node_modules/image-pixels",
"author": {
"name": "Dima Yv",
"email": "dfcreative@gmail.com"
},
"browser": "./browser.js",
"bugs": {
"url": "https://github.com/dfcreative/arraybuffer-to-string/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Convert ArrayBuffer to string",
"devDependencies": {
"buffer-to-arraybuffer": "0.0.4",
"is-browser": "^2.0.1",
"string-to-arraybuffer": "^1.0.0",
"tape": "^4.7.0"
},
"homepage": "https://github.com/dfcreative/arraybuffer-to-string#readme",
"keywords": [
"arraybuffer",
"array-buffer",
"array",
"buffer",
"string",
"base64",
"atob",
"btoa",
"datauri"
],
"license": "MIT",
"main": "index.js",
"name": "arraybuffer-to-string",
"repository": {
"type": "git",
"url": "git+https://github.com/dfcreative/arraybuffer-to-string.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.0.2"
}

@ -1,27 +0,0 @@
# arraybuffer-to-string [![unstable](https://img.shields.io/badge/stability-unstable-orange.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dfcreative/arraybuffer-to-string.svg)](https://travis-ci.org/dfcreative/arraybuffer-to-string)
Convert _ArrayBuffer_ to string with optional encoding.
[![npm install arraybuffer-to-string](https://nodei.co/npm/arraybuffer-to-string.png?mini=true)](https://npmjs.org/package/arraybuffer-to-string/)
```js
var ab2str = require('arraybuffer-to-string')
var uint8 = new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])
ab2str(uint8) // 'Hello World!'
ab2str(uint8, 'base64') // 'SGVsbG8gV29ybGQh'
ab2str(uint8, 'hex') // '48656c6c6f20576f726c6421'
ab2str(uint8, 'iso-8859-2') // 'Hello World!'
```
### var str = arrayBufferToString(buffer, encoding='utf8')
Convert ArrayBuffer/ArrayBufferView/Array `buffer` to string with defined encoding. Available encoding: `utf8`, `binary`, `base64`, `hex`, `ascii`, `latin1`, `ucs2`, `utf16` and [many others](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding).
Note: in browser it relies on [TextDecoder API](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode), so if you are dealing with charsets other than `utf8`, `ascii`, `binary` or `base64` in old browsers, please include [encoding polyfill](https://github.com/inexorabletash/text-encoding).
### Related
* [string-to-arraybuffer](https://github.com/dfcreative/string-to-arraybuffer) − convert string to arraybuffer.
* [create-data-uri](https://www.npmjs.com/package/create-data-uri) − convert binary data to datauri string.

@ -1,257 +0,0 @@
'use strict'
var toString = require('./');
var t = require('tape')
var b2ab = require('buffer-to-arraybuffer')
var isBrowser = require('is-browser')
var str2ab = require('string-to-arraybuffer')
t('basics', t => {
t.equal(
toString(new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])),
'Hello World!'
)
t.end()
})
t('utf8 buffer to base64', function (t) {
t.equal(
toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'base64'),
'1YHXkGFi'
)
t.end()
})
t('utf8 buffer to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'hex'),
'd581d7906162'
)
t.end()
})
t('utf8 to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'utf8'),
'öäüõÖÄÜÕ'
)
t.end()
})
t('utf16le to utf16', function (t) {
t.equal(
toString(b2ab(Buffer.from(toString(b2ab(Buffer.from('abcd', 'utf8')), 'utf16le'), 'utf16le')), 'utf8'),
'abcd'
)
t.end()
})
t('utf16le to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('abcd', 'utf16le')), 'hex'),
'6100620063006400'
)
t.end()
})
t('ascii buffer to base64', function (t) {
t.equal(
toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'base64'),
'MTIzNDU2IUAjJCVe'
)
t.end()
})
t('ascii buffer to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'hex'),
'31323334353621402324255e'
)
t.end()
})
t('base64 buffer to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('1YHXkGFi', 'base64')), 'utf8'),
'Ձאab'
)
t.end()
})
t('hex buffer to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('d581d7906162', 'hex')), 'utf8'),
'Ձאab'
)
t.end()
})
t('base64 buffer to ascii', function (t) {
t.equal(
toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'ascii'),
'123456!@#$%^'
)
t.end()
})
t('hex buffer to ascii', function (t) {
t.equal(
toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'ascii'),
'123456!@#$%^'
)
t.end()
})
t('base64 buffer to binary', function (t) {
t.equal(
toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'binary'),
'123456!@#$%^'
)
t.end()
})
t('hex buffer to binary', function (t) {
t.equal(
toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'binary'),
'123456!@#$%^'
)
t.end()
})
t('utf8 to binary', function (t) {
/* jshint -W100 */
t.equal(
toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'binary'),
'öäüõÖÄÜÕ'
)
/* jshint +W100 */
t.end()
})
t('utf8 replacement chars (1 byte sequence)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0x80 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0x7F ])) ),
'\u007F'
)
t.end()
})
t('utf8 replacement chars (2 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xC7 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC7, 0xB1 ])) ),
'\u01F1'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC0, 0xB1 ])) ),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC1, 0xB1 ])) ),
'\uFFFD\uFFFD'
)
t.end()
})
//FIXME: browser-only case in some reason
isBrowser && t('utf8 replacement chars (3 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xE0 ])) ),
'\uFFFD'
)
t.equal(
toString(Buffer.from([ 0xE0, 0xAC ]) ),
// new Buffer([ 0xE0, 0xAC ]).toString(),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xE0, 0xAC, 0xB9 ])) ),
'\u0B39'
)
t.end()
})
isBrowser && t('utf8 replacement chars (4 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xF4 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F ])) ),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80 ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80, 0x84 ])) ),
'\uDBFC\uDC04'
)
t.equal(
toString(b2ab(Buffer.from([ 0xFF ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xFF, 0x8F, 0x80, 0x84 ])) ),
'\uFFFD\uFFFD\uFFFD\uFFFD'
)
t.end()
})
t.skip('bad utf part', t => {
t.equal(
toString(new Uint8Array([236, 134, 219])),
'<EFBFBD><EFBFBD><EFBFBD>'
)
t.end()
})
t.skip('utf8 replacement chars on 256 random bytes', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 152, 130, 206, 23, 243, 238, 197, 44, 27, 86, 208, 36, 163, 184, 164, 21, 94, 242, 178, 46, 25, 26, 253, 178, 72, 147, 207, 112, 236, 68, 179, 190, 29, 83, 239, 147, 125, 55, 143, 19, 157, 68, 157, 58, 212, 224, 150, 39, 128, 24, 94, 225, 120, 121, 75, 192, 112, 19, 184, 142, 203, 36, 43, 85, 26, 147, 227, 139, 242, 186, 57, 78, 11, 102, 136, 117, 180, 210, 241, 92, 3, 215, 54, 167, 249, 1, 44, 225, 146, 86, 2, 42, 68, 21, 47, 238, 204, 153, 216, 252, 183, 66, 222, 255, 15, 202, 16, 51, 134, 1, 17, 19, 209, 76, 238, 38, 76, 19, 7, 103, 249, 5, 107, 137, 64, 62, 170, 57, 16, 85, 179, 193, 97, 86, 166, 196, 36, 148, 138, 193, 210, 69, 187, 38, 242, 97, 195, 219, 252, 244, 38, 1, 197, 18, 31, 246, 53, 47, 134, 52, 105, 72, 43, 239, 128, 203, 73, 93, 199, 75, 222, 220, 166, 34, 63, 236, 11, 212, 76, 243, 171, 110, 78, 39, 205, 204, 6, 177, 233, 212, 243, 0, 33, 41, 122, 118, 92, 252, 0, 157, 108, 120, 70, 137, 100, 223, 243, 171, 232, 66, 126, 111, 142, 33, 3, 39, 117, 27, 107, 54, 1, 217, 227, 132, 13, 166, 3, 73, 53, 127, 225, 236, 134, 219, 98, 214, 125, 148, 24, 64, 142, 111, 231, 194, 42, 150, 185, 10, 182, 163, 244, 19, 4, 59, 135, 16 ])) ),
'\uFFFD\uFFFD\uFFFD\u0017\uFFFD\uFFFD\uFFFD\u002C\u001B\u0056\uFFFD\u0024\uFFFD\uFFFD\uFFFD\u0015\u005E\uFFFD\uFFFD\u002E\u0019\u001A\uFFFD\uFFFD\u0048\uFFFD\uFFFD\u0070\uFFFD\u0044\uFFFD\uFFFD\u001D\u0053\uFFFD\uFFFD\u007D\u0037\uFFFD\u0013\uFFFD\u0044\uFFFD\u003A\uFFFD\uFFFD\uFFFD\u0027\uFFFD\u0018\u005E\uFFFD\u0078\u0079\u004B\uFFFD\u0070\u0013\uFFFD\uFFFD\uFFFD\u0024\u002B\u0055\u001A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0039\u004E\u000B\u0066\uFFFD\u0075\uFFFD\uFFFD\uFFFD\u005C\u0003\uFFFD\u0036\uFFFD\uFFFD\u0001\u002C\uFFFD\uFFFD\u0056\u0002\u002A\u0044\u0015\u002F\uFFFD\u0319\uFFFD\uFFFD\uFFFD\u0042\uFFFD\uFFFD\u000F\uFFFD\u0010\u0033\uFFFD\u0001\u0011\u0013\uFFFD\u004C\uFFFD\u0026\u004C\u0013\u0007\u0067\uFFFD\u0005\u006B\uFFFD\u0040\u003E\uFFFD\u0039\u0010\u0055\uFFFD\uFFFD\u0061\u0056\uFFFD\uFFFD\u0024\uFFFD\uFFFD\uFFFD\uFFFD\u0045\uFFFD\u0026\uFFFD\u0061\uFFFD\uFFFD\uFFFD\uFFFD\u0026\u0001\uFFFD\u0012\u001F\uFFFD\u0035\u002F\uFFFD\u0034\u0069\u0048\u002B\uFFFD\uFFFD\uFFFD\u0049\u005D\uFFFD\u004B\uFFFD\u0726\u0022\u003F\uFFFD\u000B\uFFFD\u004C\uFFFD\uFFFD\u006E\u004E\u0027\uFFFD\uFFFD\u0006\uFFFD\uFFFD\uFFFD\uFFFD\u0000\u0021\u0029\u007A\u0076\u005C\uFFFD\u0000\uFFFD\u006C\u0078\u0046\uFFFD\u0064\uFFFD\uFFFD\uFFFD\uFFFD\u0042\u007E\u006F\uFFFD\u0021\u0003\u0027\u0075\u001B\u006B\u0036\u0001\uFFFD\uFFFD\uFFFD\u000D\uFFFD\u0003\u0049\u0035\u007F\uFFFD\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u007D\uFFFD\u0018\u0040\uFFFD\u006F\uFFFD\uFFFD\u002A\uFFFD\uFFFD\u000A\uFFFD\uFFFD\uFFFD\u0013\u0004\u003B\uFFFD\u0010'
)
t.end()
})
isBrowser && t('utf8 replacement chars for anything in the surrogate pair range', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0x9F, 0xBF ])) ),
'\uD7FF'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xA0, 0x80 ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xBE, 0x8B ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xBF, 0xBF ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xEE, 0x80, 0x80 ])) ),
'\uE000'
)
t.end()
})
t('utf8 don\'t replace the replacement char', function (t) {
t.equal(
toString(b2ab(Buffer.from('\uFFFD')) ),
'\uFFFD'
)
t.end()
})

@ -1,6 +0,0 @@
node_modules
*.log
.DS_Store
bundle.js
test
test.js

@ -1,18 +0,0 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,37 +0,0 @@
# atob-lite
![](http://img.shields.io/badge/stability-stable-orange.svg?style=flat)
![](http://img.shields.io/npm/v/atob-lite.svg?style=flat)
![](http://img.shields.io/npm/dm/atob-lite.svg?style=flat)
![](http://img.shields.io/npm/l/atob-lite.svg?style=flat)
Smallest/simplest possible means of using atob with both Node and browserify.
In the browser, decoding base64 strings is done using:
``` javascript
var decoded = atob(encoded)
```
However in Node, it's done like so:
``` javascript
var decoded = new Buffer(encoded, 'base64').toString('utf8')
```
You can easily check if `Buffer` exists and switch between the approaches
accordingly, but using `Buffer` anywhere in your browser source will pull
in browserify's `Buffer` shim which is pretty hefty. This package uses
the `main` and `browser` fields in its `package.json` to perform this
check at build time and avoid pulling `Buffer` in unnecessarily.
## Usage
[![NPM](https://nodei.co/npm/atob-lite.png)](https://nodei.co/npm/atob-lite/)
### `decoded = atob(encoded)`
Returns the decoded value of a base64-encoded string.
## License
MIT. See [LICENSE.md](http://github.com/hughsk/atob-lite/blob/master/LICENSE.md) for details.

@ -1,3 +0,0 @@
module.exports = function _atob(str) {
return atob(str)
}

@ -1,3 +0,0 @@
module.exports = function atob(str) {
return Buffer.from(str, 'base64').toString('binary')
}

@ -1,67 +0,0 @@
{
"_from": "atob-lite@^2.0.0",
"_id": "atob-lite@2.0.0",
"_inBundle": false,
"_integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=",
"_location": "/atob-lite",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "atob-lite@^2.0.0",
"name": "atob-lite",
"escapedName": "atob-lite",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/string-to-arraybuffer"
],
"_resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
"_shasum": "0fef5ad46f1bd7a8502c65727f0367d5ee43d696",
"_spec": "atob-lite@^2.0.0",
"_where": "/home/sigonasr2/divar/server/node_modules/string-to-arraybuffer",
"author": {
"name": "Hugh Kennedy",
"email": "hughskennedy@gmail.com",
"url": "http://hughsk.io/"
},
"browser": "atob-browser.js",
"bugs": {
"url": "https://github.com/hughsk/atob-lite/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Smallest/simplest possible means of using atob with both Node and browserify",
"devDependencies": {
"browserify": "^10.2.4",
"smokestack": "^3.3.0",
"tap-closer": "^1.0.0",
"tap-spec": "^4.0.0",
"tape": "^4.0.0"
},
"homepage": "https://github.com/hughsk/atob-lite",
"keywords": [
"atob",
"base64",
"isomorphic",
"browser",
"node",
"shared"
],
"license": "MIT",
"main": "atob-node.js",
"name": "atob-lite",
"repository": {
"type": "git",
"url": "git://github.com/hughsk/atob-lite.git"
},
"scripts": {
"test": "npm run test-node && npm run test-browser",
"test-browser": "browserify test | smokestack | tap-spec",
"test-node": "node test | tap-spec"
},
"version": "2.0.0"
}

@ -1,2 +0,0 @@
node_modules
.idea

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 @丝刀口
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,44 +0,0 @@
bmp-js
======
A pure javascript Bmp encoder and decoder for node.js
Supports all bits decoding(1,4,8,16,24,32) and encoding with 24bit.
##Install
$ npm install bmp-js
How to use?
---
###Decode BMP
```js
var bmp = require("bmp-js");
var bmpBuffer = fs.readFileSync('bit24.bmp');
var bmpData = bmp.decode(bmpBuffer);
```
`bmpData` has all properties includes:
1. fileSize,reserved,offset
2. headerSize,width,height,planes,bitPP,compress,rawSize,hr,vr,colors,importantColors
3. palette
4. data-------byte array order by ABGR ABGR ABGR,4 bytes per pixel
###Encode RGB
```js
var bmp = require("bmp-js");
//bmpData={data:Buffer,width:Number,height:Height}
var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file
```
License
---
U can use on free with [MIT License](https://github.com/shaozilee/bmp-js/blob/master/LICENSE)

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,15 +0,0 @@
/**
* @author shaozilee
*
* support 1bit 4bit 8bit 24bit decode
* encode with 24bit
*
*/
var encode = require('./lib/encoder'),
decode = require('./lib/decoder');
module.exports = {
encode: encode,
decode: decode
};

@ -1,485 +0,0 @@
/**
* @author shaozilee
*
* Bmp format decoder,support 1bit 4bit 8bit 24bit bmp
*
*/
function BmpDecoder(buffer,is_with_alpha) {
this.pos = 0;
this.buffer = buffer;
this.is_with_alpha = !!is_with_alpha;
this.bottom_up = true;
this.flag = this.buffer.toString("utf-8", 0, this.pos += 2);
if (this.flag != "BM") throw new Error("Invalid BMP File");
this.parseHeader();
this.parseRGBA();
}
BmpDecoder.prototype.parseHeader = function() {
this.fileSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.reserved = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.offset = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.headerSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.width = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.height = this.buffer.readInt32LE(this.pos);
this.pos += 4;
this.planes = this.buffer.readUInt16LE(this.pos);
this.pos += 2;
this.bitPP = this.buffer.readUInt16LE(this.pos);
this.pos += 2;
this.compress = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.rawSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.hr = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.vr = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.colors = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.importantColors = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
if(this.bitPP === 16 && this.is_with_alpha){
this.bitPP = 15
}
if (this.bitPP < 15) {
var len = this.colors === 0 ? 1 << this.bitPP : this.colors;
this.palette = new Array(len);
for (var i = 0; i < len; i++) {
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var quad = this.buffer.readUInt8(this.pos++);
this.palette[i] = {
red: red,
green: green,
blue: blue,
quad: quad
};
}
}
if(this.height < 0) {
this.height *= -1;
this.bottom_up = false;
}
}
BmpDecoder.prototype.parseRGBA = function() {
var bitn = "bit" + this.bitPP;
var len = this.width * this.height * 4;
this.data = new Buffer(len);
this[bitn]();
};
BmpDecoder.prototype.bit1 = function() {
var xlen = Math.ceil(this.width / 8);
var mode = xlen%4;
var y = this.height >= 0 ? this.height - 1 : -this.height
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < xlen; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x*8*4;
for (var i = 0; i < 8; i++) {
if(x*8+i<this.width){
var rgb = this.palette[((b>>(7-i))&0x1)];
this.data[location+i*4] = 0;
this.data[location+i*4 + 1] = rgb.blue;
this.data[location+i*4 + 2] = rgb.green;
this.data[location+i*4 + 3] = rgb.red;
}else{
break;
}
}
}
if (mode != 0){
this.pos+=(4 - mode);
}
}
};
BmpDecoder.prototype.bit4 = function() {
//RLE-4
if(this.compress == 2){
this.data.fill(0xff);
var location = 0;
var lines = this.bottom_up?this.height-1:0;
var low_nibble = false;//for all count of pixel
while(location<this.data.length){
var a = this.buffer.readUInt8(this.pos++);
var b = this.buffer.readUInt8(this.pos++);
//absolute mode
if(a == 0){
if(b == 0){//line end
if(this.bottom_up){
lines--;
}else{
lines++;
}
location = lines*this.width*4;
low_nibble = false;
continue;
}else if(b == 1){//image end
break;
}else if(b ==2){
//offset x,y
var x = this.buffer.readUInt8(this.pos++);
var y = this.buffer.readUInt8(this.pos++);
if(this.bottom_up){
lines-=y;
}else{
lines+=y;
}
location +=(y*this.width*4+x*4);
}else{
var c = this.buffer.readUInt8(this.pos++);
for(var i=0;i<b;i++){
if (low_nibble) {
setPixelData.call(this, (c & 0x0f));
} else {
setPixelData.call(this, (c & 0xf0)>>4);
}
if ((i & 1) && (i+1 < b)){
c = this.buffer.readUInt8(this.pos++);
}
low_nibble = !low_nibble;
}
if ((((b+1) >> 1) & 1 ) == 1){
this.pos++
}
}
}else{//encoded mode
for (var i = 0; i < a; i++) {
if (low_nibble) {
setPixelData.call(this, (b & 0x0f));
} else {
setPixelData.call(this, (b & 0xf0)>>4);
}
low_nibble = !low_nibble;
}
}
}
function setPixelData(rgbIndex){
var rgb = this.palette[rgbIndex];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
location+=4;
}
}else{
var xlen = Math.ceil(this.width/2);
var mode = xlen%4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < xlen; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x*2*4;
var before = b>>4;
var after = b&0x0F;
var rgb = this.palette[before];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
if(x*2+1>=this.width)break;
rgb = this.palette[after];
this.data[location+4] = 0;
this.data[location+4 + 1] = rgb.blue;
this.data[location+4 + 2] = rgb.green;
this.data[location+4 + 3] = rgb.red;
}
if (mode != 0){
this.pos+=(4 - mode);
}
}
}
};
BmpDecoder.prototype.bit8 = function() {
//RLE-8
if(this.compress == 1){
this.data.fill(0xff);
var location = 0;
var lines = this.bottom_up?this.height-1:0;
while(location<this.data.length){
var a = this.buffer.readUInt8(this.pos++);
var b = this.buffer.readUInt8(this.pos++);
//absolute mode
if(a == 0){
if(b == 0){//line end
if(this.bottom_up){
lines--;
}else{
lines++;
}
location = lines*this.width*4;
continue;
}else if(b == 1){//image end
break;
}else if(b ==2){
//offset x,y
var x = this.buffer.readUInt8(this.pos++);
var y = this.buffer.readUInt8(this.pos++);
if(this.bottom_up){
lines-=y;
}else{
lines+=y;
}
location +=(y*this.width*4+x*4);
}else{
for(var i=0;i<b;i++){
var c = this.buffer.readUInt8(this.pos++);
setPixelData.call(this, c);
}
if(b&1 == 1){
this.pos++;
}
}
}else{//encoded mode
for (var i = 0; i < a; i++) {
setPixelData.call(this, b);
}
}
}
function setPixelData(rgbIndex){
var rgb = this.palette[rgbIndex];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
location+=4;
}
}else {
var mode = this.width % 4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
if (b < this.palette.length) {
var rgb = this.palette[b];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
} else {
this.data[location] = 0;
this.data[location + 1] = 0xFF;
this.data[location + 2] = 0xFF;
this.data[location + 3] = 0xFF;
}
}
if (mode != 0) {
this.pos += (4 - mode);
}
}
}
};
BmpDecoder.prototype.bit15 = function() {
var dif_w =this.width % 3;
var _11111 = parseInt("11111", 2),_1_5 = _11111;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
var B = this.buffer.readUInt16LE(this.pos);
this.pos+=2;
var blue = (B & _1_5) / _1_5 * 255 | 0;
var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0;
var red = (B >> 10 & _1_5) / _1_5 * 255 | 0;
var alpha = (B>>15)?0xFF:0x00;
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += dif_w;
}
};
BmpDecoder.prototype.bit16 = function() {
var dif_w =(this.width % 2)*2;
//default xrgb555
this.maskRed = 0x7C00;
this.maskGreen = 0x3E0;
this.maskBlue =0x1F;
this.mask0 = 0;
if(this.compress == 3){
this.maskRed = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskGreen = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskBlue = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.mask0 = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
}
var ns=[0,0,0];
for (var i=0;i<16;i++){
if ((this.maskRed>>i)&0x01) ns[0]++;
if ((this.maskGreen>>i)&0x01) ns[1]++;
if ((this.maskBlue>>i)&0x01) ns[2]++;
}
ns[1]+=ns[0]; ns[2]+=ns[1]; ns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
var B = this.buffer.readUInt16LE(this.pos);
this.pos+=2;
var blue = (B&this.maskBlue)<<ns[0];
var green = (B&this.maskGreen)>>ns[1];
var red = (B&this.maskRed)>>ns[2];
var location = line * this.width * 4 + x * 4;
this.data[location] = 0;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += dif_w;
}
};
BmpDecoder.prototype.bit24 = function() {
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
//Little Endian rgb
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = 0;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += (this.width % 4);
}
};
/**
* add 32bit decode func
* @author soubok
*/
BmpDecoder.prototype.bit32 = function() {
//BI_BITFIELDS
if(this.compress == 3){
this.maskRed = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskGreen = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskBlue = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.mask0 = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
//Little Endian rgba
var alpha = this.buffer.readUInt8(this.pos++);
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
}
}else{
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
//Little Endian argb
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var alpha = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
}
}
};
BmpDecoder.prototype.getData = function() {
return this.data;
};
module.exports = function(bmpData) {
var decoder = new BmpDecoder(bmpData);
return decoder;
};

@ -1,81 +0,0 @@
/**
* @author shaozilee
*
* BMP format encoder,encode 24bit BMP
* Not support quality compression
*
*/
function BmpEncoder(imgData){
this.buffer = imgData.data;
this.width = imgData.width;
this.height = imgData.height;
this.extraBytes = this.width%4;
this.rgbSize = this.height*(3*this.width+this.extraBytes);
this.headerInfoSize = 40;
this.data = [];
/******************header***********************/
this.flag = "BM";
this.reserved = 0;
this.offset = 54;
this.fileSize = this.rgbSize+this.offset;
this.planes = 1;
this.bitPP = 24;
this.compress = 0;
this.hr = 0;
this.vr = 0;
this.colors = 0;
this.importantColors = 0;
}
BmpEncoder.prototype.encode = function() {
var tempBuffer = new Buffer(this.offset+this.rgbSize);
this.pos = 0;
tempBuffer.write(this.flag,this.pos,2);this.pos+=2;
tempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4;
tempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4;
tempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2;
tempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2;
tempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4;
var i=0;
var rowBytes = 3*this.width+this.extraBytes;
for (var y = 0; y <this.height; y++){
for (var x = 0; x < this.width; x++){
var p = this.pos+y*rowBytes+x*3;
i++;//a
tempBuffer[p]= this.buffer[i++];//b
tempBuffer[p+1] = this.buffer[i++];//g
tempBuffer[p+2] = this.buffer[i++];//r
}
if(this.extraBytes>0){
var fillOffset = this.pos+y*rowBytes+this.width*3;
tempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes);
}
}
return tempBuffer;
};
module.exports = function(imgData, quality) {
if (typeof quality === 'undefined') quality = 100;
var encoder = new BmpEncoder(imgData);
var data = encoder.encode();
return {
data: data,
width: imgData.width,
height: imgData.height
};
};

@ -1,60 +0,0 @@
{
"_from": "bmp-js@^0.1.0",
"_id": "bmp-js@0.1.0",
"_inBundle": false,
"_integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=",
"_location": "/bmp-js",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "bmp-js@^0.1.0",
"name": "bmp-js",
"escapedName": "bmp-js",
"rawSpec": "^0.1.0",
"saveSpec": null,
"fetchSpec": "^0.1.0"
},
"_requiredBy": [
"/image-decode"
],
"_resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"_shasum": "e05a63f796a6c1ff25f4771ec7adadc148c07233",
"_spec": "bmp-js@^0.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-decode",
"author": {
"name": "shaozilee",
"email": "shaozilee@gmail.com"
},
"bugs": {
"url": "https://github.com/shaozilee/bmp-js/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "A pure javascript BMP encoder and decoder",
"devDependencies": {},
"homepage": "https://github.com/shaozilee/bmp-js#readme",
"keywords": [
"bmp",
"1bit",
"4bit",
"8bit",
"16bit",
"24bit",
"32bit",
"encoder",
"decoder",
"image",
"javascript",
"js"
],
"license": "MIT",
"main": "index.js",
"name": "bmp-js",
"repository": {
"type": "git",
"url": "git+https://github.com/shaozilee/bmp-js.git"
},
"version": "0.1.0"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

@ -1,33 +0,0 @@
var fs = require("fs");
var coder = require("../index.js");
var bmps = ["./bit1", "./bit4", "./bit4_RLE", "./bit8", "./bit8_RLE", "./bit16_565", "./bit16_a444", "./bit16_a555", "./bit16_x444", "./bit16_x555", "./bit24", "./bit32", "./bit32_alpha"];
console.log("test bmp decoding and encoding...");
for(var b=0; b<bmps.length;b++){
var src =bmps[b];
console.log("----------------"+src+".bmp");
var bufferData = fs.readFileSync(src+".bmp");
var decoder = coder.decode(bufferData);
console.log("width:",decoder.width);
console.log("height",decoder.height);
console.log("fileSize:",decoder.fileSize);
//encode with 24bit
var encodeData = coder.encode(decoder);
fs.writeFileSync(src+"_out.bmp", encodeData.data);
}
console.log("test bmp success!");

@ -1,4 +0,0 @@
language: node_js
node_js:
- 0.8
- "0.10"

@ -1,62 +0,0 @@
buffer-equal
============
Return whether two buffers are equal.
[![build status](https://secure.travis-ci.org/substack/node-buffer-equal.png)](http://travis-ci.org/substack/node-buffer-equal)
example
=======
``` js
var bufferEqual = require('buffer-equal');
console.dir(bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
));
console.dir(bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
));
console.dir(bufferEqual(
new Buffer('abc'),
'abc'
));
```
output:
```
true
false
undefined
```
methods
=======
``` js
var bufferEqual = require('buffer-equal')
```
bufferEqual(a, b)
-----------------
Return whether the two buffers `a` and `b` are equal.
If `a` or `b` is not a buffer, return `undefined`.
install
=======
With [npm](http://npmjs.org) do:
```
npm install buffer-equal
```
license
=======
MIT

@ -1,14 +0,0 @@
var bufferEqual = require('../');
console.dir(bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
));
console.dir(bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
));
console.dir(bufferEqual(
new Buffer('abc'),
'abc'
));

@ -1,14 +0,0 @@
var Buffer = require('buffer').Buffer; // for use with browserify
module.exports = function (a, b) {
if (!Buffer.isBuffer(a)) return undefined;
if (!Buffer.isBuffer(b)) return undefined;
if (typeof a.equals === 'function') return a.equals(b);
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
};

@ -1,62 +0,0 @@
{
"_from": "buffer-equal@0.0.1",
"_id": "buffer-equal@0.0.1",
"_inBundle": false,
"_integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=",
"_location": "/buffer-equal",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "buffer-equal@0.0.1",
"name": "buffer-equal",
"escapedName": "buffer-equal",
"rawSpec": "0.0.1",
"saveSpec": null,
"fetchSpec": "0.0.1"
},
"_requiredBy": [
"/readimage"
],
"_resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz",
"_shasum": "91bc74b11ea405bc916bc6aa908faafa5b4aac4b",
"_spec": "buffer-equal@0.0.1",
"_where": "/home/sigonasr2/divar/server/node_modules/readimage",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bugs": {
"url": "https://github.com/substack/node-buffer-equal/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "return whether two buffers are equal",
"devDependencies": {
"tap": "0.2.4"
},
"directories": {
"example": "example",
"test": "test"
},
"engines": {
"node": ">=0.4.0"
},
"homepage": "https://github.com/substack/node-buffer-equal#readme",
"keywords": [
"buffer",
"equal"
],
"license": "MIT",
"main": "index.js",
"name": "buffer-equal",
"repository": {
"type": "git",
"url": "git://github.com/substack/node-buffer-equal.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "0.0.1"
}

@ -1,35 +0,0 @@
var bufferEqual = require('../');
var test = require('tap').test;
test('equal', function (t) {
var eq = bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
);
t.strictEqual(eq, true);
t.end();
});
test('not equal', function (t) {
var eq = bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
);
t.strictEqual(eq, false);
t.end();
});
test('not equal not buffer', function (t) {
var eq = bufferEqual(
new Buffer('abc'),
'abc'
);
t.strictEqual(eq, undefined);
t.end();
});
test('equal not buffer', function (t) {
var eq = bufferEqual('abc', 'abc');
t.strictEqual(eq, undefined);
t.end();
});

@ -1,18 +0,0 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,5 +0,0 @@
var tou8 = require('../');
var buf = new Buffer('whatever');
var a = tou8(buf);
console.log(a.constructor.name);
console.log(a);

@ -1,11 +0,0 @@
module.exports = function (buf) {
if (!buf) return undefined;
if (buf.constructor.name === 'Uint8Array'
|| buf.constructor === Uint8Array) {
return buf;
}
if (typeof buf === 'string') buf = Buffer(buf);
var a = new Uint8Array(buf.length);
for (var i = 0; i < buf.length; i++) a[i] = buf[i];
return a;
};

@ -1,60 +0,0 @@
{
"_from": "buffer-to-uint8array@^1.1.0",
"_id": "buffer-to-uint8array@1.1.0",
"_inBundle": false,
"_integrity": "sha1-z29BKHwCL0WNp1LDkcGo1TXsX3I=",
"_location": "/buffer-to-uint8array",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "buffer-to-uint8array@^1.1.0",
"name": "buffer-to-uint8array",
"escapedName": "buffer-to-uint8array",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/image-decode"
],
"_resolved": "https://registry.npmjs.org/buffer-to-uint8array/-/buffer-to-uint8array-1.1.0.tgz",
"_shasum": "cf6f41287c022f458da752c391c1a8d535ec5f72",
"_spec": "buffer-to-uint8array@^1.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-decode",
"author": {
"name": "substack"
},
"bugs": {
"url": "https://github.com/substack/buffer-to-uint8array/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "convert a buffer (or string) to a Uint8Array",
"devDependencies": {
"tape": "^4.0.0"
},
"directories": {
"example": "example",
"test": "test"
},
"homepage": "https://github.com/substack/buffer-to-uint8array#readme",
"keywords": [
"Uint8Array",
"u8",
"byte",
"buffer",
"typedarray"
],
"license": "MIT",
"main": "index.js",
"name": "buffer-to-uint8array",
"repository": {
"type": "git",
"url": "git://github.com/substack/buffer-to-uint8array.git"
},
"scripts": {
"test": "tape test/*.js"
},
"version": "1.1.0"
}

@ -1,37 +0,0 @@
# buffer-to-uint8array
convert a buffer (or string) to a Uint8Array
# example
``` js
var tou8 = require('buffer-to-uint8array');
var buf = new Buffer('whatever');
var a = tou8(buf);
console.log(a.constructor.name);
console.log(a);
```
# methods
``` js
var tou8 = require('buffer-to-uint8array')
```
## var u = tou8(buf)
Convert `buf`, a `Buffer` or `string` to a `Uint8Array`.
If `buf` is already a Uint8Array, it will be returned.
# install
With [npm](https://npmjs.org) do:
```
npm install buffer-to-uint8array
```
# license
MIT

@ -1,10 +0,0 @@
var test = require('tape');
var tou8 = require('../');
test('buffer to uint8', function (t) {
t.plan(2);
var buf = new Buffer('whatever');
var a = tou8(buf);
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'buffer length');
});

@ -1,10 +0,0 @@
var test = require('tape');
var tou8 = require('../');
test('string to uint8', function (t) {
t.plan(2);
var str = 'whatever';
var a = tou8(str);
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'length');
});

@ -1,15 +0,0 @@
var test = require('tape');
var tou8 = require('../');
test('uint8 to uint8', function (t) {
t.plan(3);
var a = new Uint8Array(8);
var buf = Buffer('whatever');
for (var i = 0; i < buf.length; i++) a[i] = buf[i];
var b = tou8(a);
t.equal(a, b, 'reference equality');
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'u8 length');
});

@ -1,2 +0,0 @@
node_modules
*.log

@ -1,21 +0,0 @@
## The MIT License (MIT) ##
Copyright (c) 2013 Hugh Kennedy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -1,17 +0,0 @@
# clamp [![frozen](http://hughsk.github.io/stability-badges/dist/frozen.svg)](http://github.com/hughsk/stability-badges) #
Clamp a value between two other values. It's as simple as modules come - saving
keystrokes because I've had to write this function too many times.
## Usage ##
[![clamp](https://nodei.co/npm/clamp.png?mini=true)](https://nodei.co/npm/clamp)
### `clamp(value, a, b)` ###
Returns `value`, if it is between `a` and `b`. Otherwise, returns the number
it's gone past.
## License ##
MIT. See [LICENSE.md](http://github.com/hughsk/clamp/blob/master/LICENSE.md) for details.

@ -1,7 +0,0 @@
module.exports = clamp
function clamp(value, min, max) {
return min < max
? (value < min ? min : value > max ? max : value)
: (value < max ? max : value > min ? min : value)
}

@ -1,61 +0,0 @@
{
"_from": "clamp@^1.0.1",
"_id": "clamp@1.0.1",
"_inBundle": false,
"_integrity": "sha1-ZqDmQBGBbjcZaCj9yMjBRzEshjQ=",
"_location": "/clamp",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "clamp@^1.0.1",
"name": "clamp",
"escapedName": "clamp",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/to-uint8"
],
"_resolved": "https://registry.npmjs.org/clamp/-/clamp-1.0.1.tgz",
"_shasum": "66a0e64011816e37196828fdc8c8c147312c8634",
"_spec": "clamp@^1.0.1",
"_where": "/home/sigonasr2/divar/server/node_modules/to-uint8",
"author": {
"name": "Hugh Kennedy",
"email": "hughskennedy@gmail.com",
"url": "http://github.com/hughsk"
},
"browser": "index.js",
"bugs": {
"url": "https://github.com/hughsk/clamp/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Clamp a value between two other values",
"devDependencies": {
"tape": "~2.0.0"
},
"homepage": "https://github.com/hughsk/clamp#readme",
"keywords": [
"clamp",
"math",
"greater",
"less",
"than",
"between"
],
"license": "MIT",
"main": "index.js",
"name": "clamp",
"repository": {
"type": "git",
"url": "git://github.com/hughsk/clamp.git"
},
"scripts": {
"test": "node test"
},
"version": "1.0.1"
}

11
server/node_modules/clamp/test.js generated vendored

@ -1,11 +0,0 @@
var test = require('tape')
var clamp = require('./')
test('clamp', function(t) {
t.equal(clamp(0, -100, 100), 0)
t.equal(clamp(0, 100, 100), 100)
t.equal(clamp(0, 100, -100), 0)
t.equal(clamp(100, 0, 50), 50)
t.equal(clamp(50, 100, 150), 100)
t.end()
})

@ -1,44 +0,0 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"strict": 2,
"indent": 0,
"linebreak-style": 0,
"quotes": 0,
"semi": 0,
"no-cond-assign": 1,
"no-constant-condition": 1,
"no-duplicate-case": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-global-assign": 1,
"no-implicit-globals": 2,
"no-inner-declarations": ["error", "functions"],
"no-irregular-whitespace": 2,
"no-loop-func": 1,
"no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}],
"no-multi-str": 1,
"no-mixed-spaces-and-tabs": 1,
"no-proto": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-useless-call": 1,
"no-void": 1,
"no-with": 2,
"wrap-iife": 1,
"no-redeclare": 1,
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-sparse-arrays": 1
}
}

@ -1,13 +0,0 @@
sudo: false
language: node_js
node_js:
- "6"
- "5"
- "4"
- "0.12"
- "0.10"
matrix:
fast_finish: true
allow_failures:
- node_js: "0.10"
- node_js: "0.12"

@ -1,24 +0,0 @@
'use strict'
module.exports = function clip (pixels, shape, rect) {
var stride = shape[2] || 4
var row = shape[0],
col = shape[1] || Math.floor(pixels.length / stride / row)
var x = rect[0],
y = rect[1] || 0,
w = rect[2] || row - x,
h = rect[3] || col - y
var result = Array(w * stride * h)
var off = y * row * stride + x * stride
for (var j = 0; j < h; j++) {
for (var i = 0; i < w; i++) {
for (var k = 0; k < stride; k++) {
result[j * w * stride + i * stride + k] = pixels[off + j * row * stride + i * stride + k]
}
}
}
return result
}

@ -1,54 +0,0 @@
{
"_from": "clip-pixels@^1.0.1",
"_id": "clip-pixels@1.0.1",
"_inBundle": false,
"_integrity": "sha512-nJ22fZvCwkJfMppkOEE7GciLX08rDnVzEJ+U46kBFZtwNzH2V4tNxMWa9Tc365WspCxy1c3NtGJ5EeT4SgjmCA==",
"_location": "/clip-pixels",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "clip-pixels@^1.0.1",
"name": "clip-pixels",
"escapedName": "clip-pixels",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/image-pixels"
],
"_resolved": "https://registry.npmjs.org/clip-pixels/-/clip-pixels-1.0.1.tgz",
"_shasum": "c6304c5b82f6a5b555f1a5990a1cde84077614f8",
"_spec": "clip-pixels@^1.0.1",
"_where": "/home/sigonasr2/divar/server/node_modules/image-pixels",
"author": {
"name": "dy"
},
"bugs": {
"url": "https://github.com/dy/clip-pixels/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Slice rectangle from pixels array",
"homepage": "https://github.com/dy/clip-pixels#readme",
"keywords": [
"clip",
"slice",
"ndarray",
"flip-pixels",
"pxls",
"pixels"
],
"license": "MIT",
"main": "index.js",
"name": "clip-pixels",
"repository": {
"type": "git",
"url": "git+https://github.com/dy/clip-pixels.git"
},
"scripts": {
"test": "node test"
},
"version": "1.0.1"
}

@ -1,22 +0,0 @@
[![Build Status](https://travis-ci.org/dy/clip-pixels.svg?branch=master)](https://travis-ci.org/dy/clip-pixels)
Slice rectangle from an array with pixels.
### `clip(arr, shape=[w, h?, channels=4], rect=[x, y?, w?, h?])`
```js
var clip = require('clip-pixels')
var pixels = [
0, 1, 0,
1, 1, 1,
0, 1, 0
]
pixels = clip(pixels, [3, 3, 1], [1, 0, 2, 3])
/*
1, 0,
1, 1,
1, 0
*/
```

@ -1,31 +0,0 @@
'use strict'
var clip = require('./')
var a = require('assert')
var pixels = [
0, 1, 0,
1, 1, 1,
0, 1, 0
]
a.deepEqual(clip(pixels, [3, 3, 1], [1, 0, 2, 3]),
[
1, 0,
1, 1,
1, 0
])
// short args
var pixels = [
0,0,0,0, 1,1,1,1, 0,0,0,0,
1,1,1,1, 1,1,1,1, 1,1,1,1,
0,0,0,0, 1,1,1,1, 0,0,0,0
]
a.deepEqual(clip(pixels, [3], [1, 0]),
[
1,1,1,1, 0,0,0,0,
1,1,1,1, 1,1,1,1,
1,1,1,1, 0,0,0,0
])

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014-2015 The Compute.io Authors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,137 +0,0 @@
dims
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]
> Computes dimensions for arrays and matrices.
## Installation
``` bash
$ npm install compute-dims
```
For use in the browser, use [browserify](https://github.com/substack/node-browserify).
## Usage
``` javascript
var dims = require( 'compute-dims' );
```
#### dims( x[, max] )
Computes dimensions of `x`. `x` may be either an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) (including nested `arrays`) or a [`matrix`](https://github.com/dstructs/matrix).
``` javascript
var matrix = require( 'dstructs-matrix' ),
data,
d;
data = [ 1, 2 ];
d = dims( data );
// returns [2]
data = [ [1,2], [1,2] ];
d = dims( data );
// returns [2,2]
data = matrix( [1,2,3,4], [2,2] )
d = dims( data );
// returns [2,2]
```
If an `array` element has a dimension inconsistent with other elements, the function returns `null`.
``` javascript
data = [ [1,2], [1] ];
d = dims( data );
// returns null
```
To limit the number of dimensions returned, set the `max` option.
``` javascript
data = [ [[1,2], [3,4]] ]; // 1x2x2
d = dims( data, 2 );
// returns [1,2]
data = [ [[1,2], [3,4,5,6,7,8]] ];
d = dims( data );
// returns null
d = dims( data, 2 );
// returns [1,2]
data = matrix( [1,2,3,4], [2,2] );
d = dims( data, 1 );
// returns [2]
```
## Examples
To run the example code from the top-level application directory,
``` bash
$ node ./examples/index.js
```
## Tests
### Unit
Unit tests use the [Mocha](http://mochajs.org) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:
``` bash
$ make test
```
All new feature development should have corresponding unit tests to validate correct functionality.
### Test Coverage
This repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
``` bash
$ make test-cov
```
Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,
``` bash
$ make view-cov
```
---
## License
[MIT license](http://opensource.org/licenses/MIT).
## Copyright
Copyright &copy; 2014-2015. The [Compute.io](https://github.com/compute-io) Authors.
[npm-image]: http://img.shields.io/npm/v/compute-dims.svg
[npm-url]: https://npmjs.org/package/compute-dims
[travis-image]: http://img.shields.io/travis/compute-io/dims/master.svg
[travis-url]: https://travis-ci.org/compute-io/dims
[coveralls-image]: https://img.shields.io/coveralls/compute-io/dims/master.svg
[coveralls-url]: https://coveralls.io/r/compute-io/dims?branch=master
[dependencies-image]: http://img.shields.io/david/compute-io/dims.svg
[dependencies-url]: https://david-dm.org/compute-io/dims
[dev-dependencies-image]: http://img.shields.io/david/dev/compute-io/dims.svg
[dev-dependencies-url]: https://david-dm.org/dev/compute-io/dims
[github-issues-image]: http://img.shields.io/github/issues/compute-io/dims.svg
[github-issues-url]: https://github.com/compute-io/dims/issues

@ -1,114 +0,0 @@
'use strict';
// MODULES //
var isPositiveInteger = require( 'validate.io-positive-integer' ),
isArray = require( 'validate.io-array' ),
ndarrayLike = require( 'validate.io-ndarray-like' ),
createCopy = require( 'utils-copy' );
// DIMS //
/**
* FUNCTION: dims( x, d, max )
* Computes array dimensions.
*
* @private
* @param {Array} arr - input array
* @param {Array} d - dimensions array
* @param {Number} max - max number of dimensions
* @returns {Array} dimensions array
*/
function dims( arr, d, max ) {
if ( max && d.length === max ) {
return;
}
if ( !isArray( arr[0] ) ) {
return;
}
d.push( arr[0].length );
dims( arr[ 0 ], d, max );
} // end FUNCTION dims()
/**
* FUNCTION: check( arr, d )
* Checks that all array elements have the same dimensions.
*
* @private
* @param {Array} arr - input array
* @param {Array} d - dimensions array
* @returns {Boolean} boolean indicating if all array elements have the same dimensions
*/
function check( arr, d ) {
var len = arr.length,
dim = d.shift(),
nDims = d.length,
val,
flg;
for ( var i = 0; i < len; i++ ) {
val = arr[ i ];
if ( !isArray( val ) || val.length !== dim ) {
return false;
}
if ( nDims ) {
flg = check( val, d.slice() );
if ( !flg ) {
return false;
}
}
}
return true;
} // end FUNCTION check()
/**
* FUNCTION: compute( x[, max] )
* Computes dimensions.
*
* @param {Array} x - input object
* @param {Number} [max] - limits the number of dimensions returned
* @returns {Array|null} array of dimensions or null
*/
function compute( x, max ) {
var d, flg;
if ( arguments.length > 1 ) {
if ( !isPositiveInteger( max ) ) {
throw new TypeError( 'dims()::invalid input argument. `max` option must be a positive integer.' );
}
}
if ( ndarrayLike( x ) === true ) {
d = createCopy( x.shape );
if ( max && max <= d.length ) {
d.length = max;
}
return d;
}
if ( isArray( x ) ) {
// [0] Initialize the dimensions array:
d = [ x.length ];
// [1] Recursively determine array dimensions:
dims( x, d, max );
// [2] Check that all array element dimensions are consistent...
if ( d.length > 1 ) {
flg = check( x, d.slice( 1 ) );
if ( !flg ) {
return null;
}
}
return d;
}
throw new TypeError( 'dims()::invalid input argument. Must provide an array, matrix or ndarray.' );
} // end FUNCTION compute()
// EXPORTS //
module.exports = compute;

@ -1,83 +0,0 @@
{
"_from": "compute-dims@^1.1.0",
"_id": "compute-dims@1.1.0",
"_inBundle": false,
"_integrity": "sha512-YHMiIKjH/8Eom8zATk3g8/lH3HxGCZcVQyEfEoVrfWI7od/WRpTgRGShnei3jArYSx77mQqPxZNokjGHCdLfxg==",
"_location": "/compute-dims",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "compute-dims@^1.1.0",
"name": "compute-dims",
"escapedName": "compute-dims",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/pxls"
],
"_resolved": "https://registry.npmjs.org/compute-dims/-/compute-dims-1.1.0.tgz",
"_shasum": "6d5b712929b6c531af3b4d580ed5adacbbd77e0c",
"_spec": "compute-dims@^1.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/pxls",
"author": {
"name": "Athan Reines",
"email": "kgryte@gmail.com"
},
"bugs": {
"url": "https://github.com/compute-io/dims/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Athan Reines",
"email": "kgryte@gmail.com"
}
],
"dependencies": {
"utils-copy": "^1.0.0",
"validate.io-array": "^1.0.6",
"validate.io-matrix-like": "^1.0.2",
"validate.io-ndarray-like": "^1.0.0",
"validate.io-positive-integer": "^1.0.0"
},
"deprecated": false,
"description": "Computes array dimensions.",
"devDependencies": {
"chai": "3.x.x",
"coveralls": "^2.11.1",
"dstructs-matrix": "^2.0.0",
"istanbul": "^0.3.0",
"jshint": "2.x.x",
"jshint-stylish": "2.x.x",
"mocha": "2.x.x"
},
"homepage": "https://github.com/compute-io/dims#readme",
"keywords": [
"compute.io",
"compute",
"computation",
"array",
"utilities",
"utils",
"dimensions",
"size",
"shape",
"dims"
],
"license": "MIT",
"main": "./lib",
"name": "compute-dims",
"repository": {
"type": "git",
"url": "git://github.com/compute-io/dims.git"
},
"scripts": {
"coveralls": "istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls",
"test": "mocha",
"test-cov": "istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec"
},
"version": "1.1.0"
}

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015-2016 The Compute.io Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,130 +0,0 @@
Max Uint32
===
[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]
> Maximum unsigned 32-bit integer.
## Installation
``` bash
$ npm install const-max-uint32
```
## Usage
``` javascript
var MAX_UINT32 = require( 'const-max-uint32' );
```
#### MAX_UINT32
Maximum unsigned 32-bit `integer`.
``` javascript
MAX_UINT32 === Math.pow( 2, 32 ) - 1;
```
## Notes
- `MAX_UINT32` is the maximum `array` length.
## Examples
``` javascript
var MAX_UINT32 = require( 'const-max-uint32' );
console.log( MAX_UINT32 );
// returns 4294967295
```
To run the example code from the top-level application directory,
``` bash
$ node ./examples/index.js
```
---
## Tests
### Unit
This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:
``` bash
$ make test
```
All new feature development should have corresponding unit tests to validate correct functionality.
### Test Coverage
This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
``` bash
$ make test-cov
```
Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,
``` bash
$ make view-cov
```
### Browser Support
This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:
``` bash
$ make test-browsers
```
To view the tests in a local web browser,
``` bash
$ make view-browser-tests
```
<!-- [![browser support][browsers-image]][browsers-url] -->
---
## License
[MIT license](http://opensource.org/licenses/MIT).
## Copyright
Copyright &copy; 2015-2016. The [Compute.io][compute-io] Authors.
[npm-image]: http://img.shields.io/npm/v/const-max-uint32.svg
[npm-url]: https://npmjs.org/package/const-max-uint32
[build-image]: http://img.shields.io/travis/const-io/max-uint32/master.svg
[build-url]: https://travis-ci.org/const-io/max-uint32
[coverage-image]: https://img.shields.io/codecov/c/github/const-io/max-uint32/master.svg
[coverage-url]: https://codecov.io/github/const-io/max-uint32?branch=master
[dependencies-image]: http://img.shields.io/david/const-io/max-uint32.svg
[dependencies-url]: https://david-dm.org/const-io/max-uint32
[dev-dependencies-image]: http://img.shields.io/david/dev/const-io/max-uint32.svg
[dev-dependencies-url]: https://david-dm.org/dev/const-io/max-uint32
[github-issues-image]: http://img.shields.io/github/issues/const-io/max-uint32.svg
[github-issues-url]: https://github.com/const-io/max-uint32/issues
[tape]: https://github.com/substack/tape
[istanbul]: https://github.com/gotwarlost/istanbul
[testling]: https://ci.testling.com
[compute-io]: https://github.com/compute-io

@ -1,5 +0,0 @@
'use strict';
// EXPORTS //
module.exports = 4294967295; // 2**32 - 1

@ -1,104 +0,0 @@
{
"_from": "const-max-uint32@^1.0.2",
"_id": "const-max-uint32@1.0.2",
"_inBundle": false,
"_integrity": "sha1-8Am7YjDmeO2HTdLWqc2ePL+rtnY=",
"_location": "/const-max-uint32",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "const-max-uint32@^1.0.2",
"name": "const-max-uint32",
"escapedName": "const-max-uint32",
"rawSpec": "^1.0.2",
"saveSpec": null,
"fetchSpec": "^1.0.2"
},
"_requiredBy": [
"/validate.io-array-like"
],
"_resolved": "https://registry.npmjs.org/const-max-uint32/-/const-max-uint32-1.0.2.tgz",
"_shasum": "f009bb6230e678ed874dd2d6a9cd9e3cbfabb676",
"_spec": "const-max-uint32@^1.0.2",
"_where": "/home/sigonasr2/divar/server/node_modules/validate.io-array-like",
"author": {
"name": "Athan Reines",
"email": "kgryte@gmail.com"
},
"bugs": {
"url": "https://github.com/const-io/max-uint32/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Athan Reines",
"email": "kgryte@gmail.com"
}
],
"dependencies": {},
"deprecated": false,
"description": "Maximum unsigned 32-bit integer.",
"devDependencies": {
"browserify": "12.x.x",
"codecov": "1.x.x",
"istanbul": "^0.4.1",
"jshint": "2.x.x",
"jshint-stylish": "2.x.x",
"math-power": "^1.0.0",
"tap-spec": "4.x.x",
"tape": "4.x.x",
"testling": "1.x.x"
},
"homepage": "https://github.com/const-io/max-uint32#readme",
"keywords": [
"compute.io",
"compute",
"computation",
"max",
"array",
"length",
"uint32",
"integer",
"unsigned",
"32-bit",
"const",
"const-io",
"const.io",
"constant"
],
"license": "MIT",
"main": "./lib",
"name": "const-max-uint32",
"repository": {
"type": "git",
"url": "git://github.com/const-io/max-uint32.git"
},
"scripts": {
"coverage": "istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov",
"test": "if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi",
"test-browsers": "browserify ./test/*.js | testling | tap-spec",
"test-ci": "npm run test-local && xvfb-run npm run test-browsers",
"test-cov": "istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"",
"test-local": "tape \"./test/*.js\" | tap-spec"
},
"testling": {
"files": [
"test/*.js"
],
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..latest",
"firefox/nightly",
"chrome/4.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "1.0.2"
}

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 The Compute.io Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,124 +0,0 @@
Positive Infinity
===
[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]
> Positive infinity.
## Installation
``` bash
$ npm install const-pinf-float64
```
## Usage
``` javascript
var pinf = require( 'const-pinf-float64' );
```
#### pinf
Positive infinity.
``` javascript
pinf === Number.POSITIVE_INFINITY;
```
## Examples
``` javascript
var pinf = require( 'const-pinf-float64' );
console.log( pinf );
```
To run the example code from the top-level application directory,
``` bash
$ node ./examples/index.js
```
---
## Tests
### Unit
This repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:
``` bash
$ make test
```
All new feature development should have corresponding unit tests to validate correct functionality.
### Test Coverage
This repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
``` bash
$ make test-cov
```
Istanbul creates a `./reports/coverage` directory. To access an HTML version of the report,
``` bash
$ make view-cov
```
### Browser Support
This repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:
``` bash
$ make test-browsers
```
To view the tests in a local web browser,
``` bash
$ make view-browser-tests
```
<!-- [![browser support][browsers-image]][browsers-url] -->
---
## License
[MIT license](http://opensource.org/licenses/MIT).
## Copyright
Copyright &copy; 2016. The [Compute.io][compute-io] Authors..
[npm-image]: http://img.shields.io/npm/v/const-pinf-float64.svg
[npm-url]: https://npmjs.org/package/const-pinf-float64
[build-image]: http://img.shields.io/travis/const-io/pinf-float64/master.svg
[build-url]: https://travis-ci.org/const-io/pinf-float64
[coverage-image]: https://img.shields.io/codecov/c/github/const-io/pinf-float64/master.svg
[coverage-url]: https://codecov.io/github/const-io/pinf-float64?branch=master
[dependencies-image]: http://img.shields.io/david/const-io/pinf-float64.svg
[dependencies-url]: https://david-dm.org/const-io/pinf-float64
[dev-dependencies-image]: http://img.shields.io/david/dev/const-io/pinf-float64.svg
[dev-dependencies-url]: https://david-dm.org/dev/const-io/pinf-float64
[github-issues-image]: http://img.shields.io/github/issues/const-io/pinf-float64.svg
[github-issues-url]: https://github.com/const-io/pinf-float64/issues
[tape]: https://github.com/substack/tape
[istanbul]: https://github.com/gotwarlost/istanbul
[testling]: https://ci.testling.com
[compute-io]: https://github.com/compute-io/

@ -1,5 +0,0 @@
'use strict';
// EXPORTS //
module.exports = Number.POSITIVE_INFINITY;

@ -1,102 +0,0 @@
{
"_from": "const-pinf-float64@^1.0.0",
"_id": "const-pinf-float64@1.0.0",
"_inBundle": false,
"_integrity": "sha1-9u+w15+cCYbT558pI6v5twtj1yY=",
"_location": "/const-pinf-float64",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "const-pinf-float64@^1.0.0",
"name": "const-pinf-float64",
"escapedName": "const-pinf-float64",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/utils-copy"
],
"_resolved": "https://registry.npmjs.org/const-pinf-float64/-/const-pinf-float64-1.0.0.tgz",
"_shasum": "f6efb0d79f9c0986d3e79f2923abf9b70b63d726",
"_spec": "const-pinf-float64@^1.0.0",
"_where": "/home/sigonasr2/divar/server/node_modules/utils-copy",
"author": {
"name": "Athan Reines",
"email": "kgryte@gmail.com"
},
"bugs": {
"url": "https://github.com/const-io/pinf-float64/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Athan Reines",
"email": "kgryte@gmail.com"
}
],
"dependencies": {},
"deprecated": false,
"description": "Positive infinity.",
"devDependencies": {
"browserify": "12.x.x",
"codecov": "1.x.x",
"istanbul": "^0.4.1",
"jshint": "2.x.x",
"jshint-stylish": "2.x.x",
"tap-spec": "4.x.x",
"tape": "4.x.x",
"testling": "1.x.x"
},
"homepage": "https://github.com/const-io/pinf-float64#readme",
"keywords": [
"const.io",
"const",
"constant",
"const-io",
"compute.io",
"compute-io",
"computation",
"compute",
"mathematics",
"math",
"pinf",
"positive",
"infinity"
],
"license": "MIT",
"main": "./lib",
"name": "const-pinf-float64",
"repository": {
"type": "git",
"url": "git://github.com/const-io/pinf-float64.git"
},
"scripts": {
"coverage": "istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov",
"test": "if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi",
"test-browsers": "browserify ./test/*.js | testling | tap-spec",
"test-ci": "npm run test-local && xvfb-run npm run test-browsers",
"test-cov": "istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"",
"test-local": "tape \"./test/*.js\" | tap-spec"
},
"testling": {
"files": [
"test/*.js"
],
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..latest",
"firefox/nightly",
"chrome/4.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"version": "1.0.0"
}

@ -1,7 +0,0 @@
# Deprecated Package
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
Please contact support@npmjs.com if you have questions about this package.

@ -1,45 +0,0 @@
{
"_from": "crypto",
"_id": "crypto@1.0.1",
"_inBundle": false,
"_integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
"_location": "/crypto",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "crypto",
"name": "crypto",
"escapedName": "crypto",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
"_shasum": "2af1b7cad8175d24c8a1b0778255794a21803037",
"_spec": "crypto",
"_where": "/home/sigonasr2/divar/server",
"author": "",
"bugs": {
"url": "https://github.com/npm/deprecate-holder/issues"
},
"bundleDependencies": false,
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.",
"description": "This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.",
"homepage": "https://github.com/npm/deprecate-holder#readme",
"license": "ISC",
"main": "index.js",
"name": "crypto",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/deprecate-holder.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.1"
}

@ -1,16 +0,0 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
npm-debug.log
node_modules/*
test/*

@ -1,6 +0,0 @@
language: node_js
node_js:
- "0.8"
- "0.10"
before_install:
- npm install -g npm@~1.4.6

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save