mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
Add type description for cookie.js
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/// <reference path="cookiejs.d.ts" />
|
||||
|
||||
// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js
|
||||
|
||||
cookie.set({a: '1', b: '2', c: '3'});
|
||||
|
||||
cookie;
|
||||
cookie.enabled();
|
||||
|
||||
cookie.set('n', '5');
|
||||
|
||||
cookie.get('a');
|
||||
cookie.get('__undef__');
|
||||
cookie.get('__undef__', 'fallback');
|
||||
cookie.get(['a', 'b']);
|
||||
cookie.get(['a', '__undef__'], 'fallback');
|
||||
|
||||
cookie('a');
|
||||
cookie('__undef__');
|
||||
cookie('__undef__', 'fallback');
|
||||
cookie(['a', 'b']);
|
||||
cookie(['a', '__undef__'], 'fallback');
|
||||
|
||||
cookie.remove('a');
|
||||
cookie.remove('a', 'b');
|
||||
cookie.remove(['a', 'b']);
|
||||
|
||||
cookie.empty();
|
||||
|
||||
cookie.all();
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for cookie.js v1.0.0
|
||||
// Project: https://github.com/js-coder/cookie.js
|
||||
// Definitions by: Boltmade <https://github.com/Boltmade>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function cookie(key : string, fallback?: string) : string;
|
||||
declare function cookie(keys : string[], fallback?: string) : string;
|
||||
|
||||
declare module cookie {
|
||||
export function set(key : string, value : string, options? : any) : void;
|
||||
export function set(obj : any, options? : any) : void;
|
||||
export function remove(key : string) : void;
|
||||
export function remove(keys : string[]) : void;
|
||||
export function remove(...args : string[]) : void;
|
||||
export function empty() : void;
|
||||
export function get(key : string, fallback?: string) : string;
|
||||
export function get(keys : string[], fallback?: string) : string;
|
||||
export function all() : any;
|
||||
export function enabled() : boolean;
|
||||
}
|
||||
|
||||
declare module "cookiejs" {
|
||||
export = cookie;
|
||||
}
|
||||
Reference in New Issue
Block a user