File: //home/imagzxcb/public_html/db127a/umask.tar
.npmignore 0000644 00000001113 15204556312 0006542 0 ustar 00 # Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
# Users Environment Variables
.lock-wscript
LICENSE 0000644 00000002065 15204556312 0005557 0 ustar 00 The MIT License (MIT)
Copyright (c) 2015 Sam Mikes
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.
ChangeLog 0000644 00000000320 15204556312 0006314 0 ustar 00 2015-01-15 Sam Mikes <smikes@cubane.com>
* index.js: (convert_fromString) accept decimal strings provided they
don't begin with '0'
2015-01-14 Sam Mikes <smikes@cubane.com>
* index.js: initial rev
README.md 0000644 00000003534 15204556312 0006033 0 ustar 00 # umask
Convert umask from string <-> number.
## Installation & Use
```
$ npm install -S umask
var umask = require('umask');
console.log(umask.toString(18)); // 0022
console.log(umask.fromString('0777')) // 511
```
## API
### `toString( val )`
Converts `val` to a 0-padded octal string. `val` is assumed to be a
Number in the correct range (0..511)
### `fromString( val, [cb] )`
Converts `val` to a Number that can be used as a umask. `val` can
be of the following forms:
* String containing octal number (leading 0)
* String containing decimal number
* Number
In all cases above, the value obtained is then converted to an integer and
checked against the legal `umask` range 0..511
`fromString` can be used as a simple converter, with no error feedback, by
omitting the optional callback argument `cb`:
```
var mask = umask.fromString(val);
// mask is now the umask descibed by val or
// the default, 0022 (18 dec)
```
The callback arguments are `(err, val)` where `err` is either `null` or an
Error object and `val` is either the converted umask or the default umask, `0022`.
```
umask.fromString(val, function (err, val) {
if (err) {
console.error("invalid umask: " + err.message)
}
/* do something with val */
});
```
The callback, if provided, is always called **synchronously**.
### `validate( data, k, val )`
This is a validation function of the form expected by `nopt`. If
`val` is a valid umask, the function returns true and sets `data[k]`.
If `val` is not a valid umask, the function returns false.
The `validate` function is stricter than `fromString`: it only accepts
Number or octal String values, and the String value must begin with `0`.
The `validate` function does **not** accept Strings containing decimal
numbers.
# Maintainer
Sam Mikes <smikes@cubane.com>
# License
MIT package.json 0000644 00000002443 15204556312 0007040 0 ustar 00 {
"_args": [
[
"umask@1.1.0",
"/Users/rebecca/code/npm"
]
],
"_from": "umask@1.1.0",
"_id": "umask@1.1.0",
"_inBundle": false,
"_integrity": "sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=",
"_location": "/umask",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "umask@1.1.0",
"name": "umask",
"escapedName": "umask",
"rawSpec": "1.1.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
},
"_requiredBy": [
"/",
"/npm