buffer-codec
Advanced tools
Comparing version 1.4.0 to 1.5.0
(function() { | ||
var AbstractError, Codec, Errors, InvalidArgumentError, InvalidFormatError, InvalidUtf8Error, NotImplementedError, createError, createObject, inherits, isBuffer, isInheritedFrom, isNumber, util, | ||
var AbstractError, Codec, Errors, InvalidArgumentError, InvalidFormatError, InvalidUtf8Error, NotImplementedError, createError, createObject, inherits, isBuffer, isInheritedFrom, isNumber, isString, util, | ||
__slice = [].slice; | ||
@@ -13,2 +13,4 @@ | ||
isString = util.isString; | ||
createObject = util.createObject; | ||
@@ -35,4 +37,6 @@ | ||
module.exports = Codec = (function() { | ||
var aliases, codecs; | ||
var UNSAFE_CHARS, aliases, codecs, escapeString, unescapeString; | ||
UNSAFE_CHARS = '%'; | ||
Codec.bufferSize = 1024; | ||
@@ -325,3 +329,21 @@ | ||
Codec.escapeString = escapeString = function(aString, aUnSafeChars) { | ||
var c, result, _i, _len; | ||
if (!isString(aString) || aString.length === 0) { | ||
return aString; | ||
} | ||
if (aUnSafeChars == null) { | ||
aUnSafeChars = UNSAFE_CHARS; | ||
} | ||
result = ""; | ||
for (_i = 0, _len = aString.length; _i < _len; _i++) { | ||
c = aString[_i]; | ||
result += aUnSafeChars.indexOf(c) >= 0 ? "%" + aString.charCodeAt(_i).toString(16) : c; | ||
} | ||
return result; | ||
}; | ||
Codec.unescapeString = unescapeString = decodeURIComponent; | ||
/* | ||
@@ -328,0 +350,0 @@ * Count bytes in a string's UTF-8 representation. |
{ | ||
"name": "buffer-codec", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "add the codec ability to abstract-nosql database.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/snowyu/node-buffer-codec", |
@@ -1,2 +0,2 @@ | ||
# AbstractCodec [![Build Status](https://secure.travis-ci.org/snowyu/node-buffer-codec.png?branch=master)](http://travis-ci.org/snowyu/node-buffer-codec) [![npm](https://img.shields.io/npm/v/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) [![downloads](https://img.shields.io/npm/dm/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) [![license](https://img.shields.io/npm/l/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) | ||
# AbstractCodec [![Build Status](https://img.shields.io/travis/snowyu/node-buffer-codec/master.svg)](http://travis-ci.org/snowyu/node-buffer-codec) [![npm](https://img.shields.io/npm/v/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) [![downloads](https://img.shields.io/npm/dm/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) [![license](https://img.shields.io/npm/l/buffer-codec.svg)](https://npmjs.org/package/buffer-codec) | ||
@@ -7,2 +7,3 @@ Add the String/Buffer codec to the [abstract-nosql](https://github.com/snowyu/abstract-nosql) database. | ||
* name: the codec name. | ||
* options: the options passed via the encode/decode. | ||
* encode(value, options): encode the value. | ||
@@ -138,4 +139,7 @@ * return the encoded string, or encoded buffer if options.buffer is true | ||
* decodeString: return the same string. | ||
* Bytewise Codec package: A binary string serialization which sorts bytewise for arbitrarily complex data structures, respecting [bytewise](https://github.com/deanlandolt/bytewise) structured sorting efficiently. | ||
* [buffer-codec-bytewise](https://github.com/snowyu/node-buffer-codec-bytewise) | ||
* npm install buffer-codec-bytewise | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96110
884
144