Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ancient-refs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ancient-refs - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

10

CHANGELOG.md

@@ -1,10 +0,6 @@

#### 0.0.2 (2016-9-29)
#### 0.0.2 (2016-11-12)
##### New Features
* **class:** Add id and collection. ([9fc229dc](https://github.com/AncientSouls/Refs/commit/9fc229dcc698276c2a6dd487287e68027159a6ac))
##### Bug Fixes
* **package:** main file ([a2cebf78](https://github.com/AncientSouls/Refs/commit/a2cebf784a241c0dea59819e15b9174b3adfd4b7))
* **types:** Only string or undefined return ([caeb54cb](https://github.com/AncientSouls/Refs/commit/caeb54cb6fc2da4ddc4f47ac453bad5cfc64e0e7))
* **package:** main file ([a2cebf78](https://github.com/AncientSouls/Refs/commit/a2cebf784a241c0dea59819e15b9174b3adfd4b7))
{
"name": "ancient-refs",
"version": "0.0.2",
"version": "0.0.3",
"description": "Multi-storage ids syntax, parse and get methods.",

@@ -38,4 +38,4 @@ "keywords": [

"scripts": {
"jsdoc": "git submodule update --init --recursive --force && cd ./doc && git checkout -f gh-pages && cd ../ && npm i && rm -r ./doc/*/ && find ./doc ! -name '.git' -type f -exec rm -rf {} + && jsdoc ./*.js ./README.md -r -d ./doc -t ./node_modules/minami -c ./jsdoc.conf.json"
"jsdoc": "git submodule update --init --recursive && cd ./doc && git checkout gh-pages && cd ../ && npm i && rm -r ./doc/*/ && find ./doc ! -name '.git' -type f -exec rm -rf {} + && jsdoc ./*.js ./README.md -r -d ./doc -t ./node_modules/minami -c ./jsdoc.conf.json"
}
}

@@ -20,4 +20,12 @@ /**

* @description `refs.generate('items', 'abc'); // 'items/abc'`
* @throws StorageName must be a string!
* @throws Id must be a string!
*/
Refs.prototype.generate = function(storageName, id) {
if (typeof(storageName) != 'string') {
throw new Error('StorageName must be a string!');
}
if (typeof(id) != 'string') {
throw new Error('Id must be a string!');
}
return storageName+'/'+id;

@@ -29,6 +37,9 @@ };

* @param {String} ref
* @return {String[]} _ref
* @return {String[]|undefined} [_ref]
* @description `refs.parse('items/abc'); // ['items','abc']`
*/
Refs.prototype.parse = function(id) {
if (typeof(id) != 'string') {
return undefined;
}
return id.split('/');

@@ -41,2 +52,3 @@ };

* @param {Refs~callback} [callback]
* @return {Object|undefined} [document]
* @description `refs.get('items/abc'); // 123`

@@ -46,2 +58,3 @@ */

var _ref = this.parse(ref);
if (!_ref) return undefined;
return this.getters[_ref[0]](_ref[1], callback);

@@ -53,22 +66,11 @@ };

* @param {String} ref
* @return {*} storage
* @return {*} [storage]
*/
Refs.prototype.storage = function(ref) {
var _ref = this.parse(ref);
if (!_ref) return undefined;
return this.storages[_ref[0]];
};
Refs.prototype.collection = Refs.prototype.storage;
/**
* @memberof Refs
* @param {String} ref
* @return {String} id
*/
Refs.prototype.id = function(ref) {
var _ref = this.parse(ref);
return _ref&&_ref[1]?_ref[1]:undefined;
};
/**
* Callback from get method.

@@ -75,0 +77,0 @@ *

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc