Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
solodynamo committed Dec 10, 2016
0 parents commit f2bffad
Show file tree
Hide file tree
Showing 14 changed files with 432 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/aot

# dependencies
/node_modules
/bower_components

# IDEs and editors
/.idea

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

#System Files
.DS_Store
Thumbs.db
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sudo: false
language: node_js
node_js:
- '5'
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- npm prune
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Solodynamo

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.
21 changes: 21 additions & 0 deletions SYSTEMJS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## SystemJS

In your `system.config.js`

Append to `map`

```js
var map = {
...
'ng2-filter-pipe': 'node_modules/ng2-search-pipe'
}
```

and then add to `packages`

```js
var packages = {
...
'ng2-search-pipe': { main: 'dist/index.js' }
}
````
5 changes: 5 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Created by vadimdez on 28/11/2016.
*/
export * from './src/ng2-filter.module';
export * from './src/ng2-filter.pipe';
55 changes: 55 additions & 0 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Created by Vadym Yatsyuk on 27/11/2016
*/
/*global jasmine, __karma__, window*/
Error.stackTraceLimit = Infinity;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;

__karma__.loaded = function () {
};

var distPath = '/base/dist/';
var appPath = distPath + 'app/';

function isJsFile(path) {
return path.slice(-3) == '.js';
}

function isSpecFile(path) {
return /\.spec\.js$/.test(path);
}

function isAppFile(path) {
return isJsFile(path) && (path.substr(0, appPath.length) == appPath);
}

var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isSpecFile)
.filter(isAppFile);

// Load our SystemJS configuration.
System.config({
baseURL: distPath
});

System.import('system-config.js').then(function() {
// Load and configure the TestComponentBuilder.
return Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]).then(function (providers) {
var coreTesting = providers[0];
var browserTesting = providers[1];
coreTesting.TestBed.initTestEnvironment(
browserTesting.BrowserDynamicTestingModule,
browserTesting.platformBrowserDynamicTesting()
);
});
}).then(function() {
// Finally, load all spec files.
// This will run the tests directly.
return Promise.all(
allSpecFiles.map(function (moduleName) {
return System.import(moduleName);
}));
}).then(__karma__.start, __karma__.error);
51 changes: 51 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher')
],
customLaunchers: {
// chrome setup for travis CI using chromium
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
files: [
{ pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
// Reflect and Zone.js

{ pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/proxy.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/sync-test.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/jasmine-patch.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/async-test.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/fake-async-test.js', included: true, watched: false },

{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: false },
{ pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false },
{ pattern: 'node_modules/zone.js/dist/async-test.js', included: true, watched: false },

{ pattern: 'karma-test-shim.js', included: true, watched: true },

// Distribution folder.
{ pattern: 'dist/**/*', included: false, watched: true }
],
exclude: [
// Vendor packages might include spec files. We don't want to use those.
'dist/vendor/**/*.spec.js'
],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
74 changes: 74 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "ng2-search-filter",
"version": "0.1",
"description": "Angular 2 filter to make custom search",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "ng server",
"postinstall": "typings install"

},
"repository": {
"type": "git",
"url": "git+https://github.com/solodynamo/ng2-search-filter.git"
},
"keywords": [
"angular2",
"search",
"filter",
"ng2",
"angular",
"filter",
"pipe"
],
"dependencies": {},
"devDependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/compiler-cli": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@types/core-js": "^0.9.34",
"@types/jasmine": "^2.2.34",
"@types/node": "^6.0.51",
"@types/phantom": "0.0.29",
"@types/protractor": "^1.5.20",
"@types/selenium-webdriver": "2.44.*",
"@types/systemjs": "^0.19.31",
"angular-cli-ghpages": "^0.3.2",
"codelyzer": "1.0.0-beta.4",
"ember-cli-inject-live-reload": "^1.4.1",
"es6-shim": "^0.35.1",
"jasmine": "^2.5.2",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^2.7.0",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2",
"material-design-lite": "^1.2.1",
"protractor": "^4.0.11",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-rc.3",
"systemjs": "0.19.41",
"ts-node": "^1.7.0",
"tslint": "^4.0.0",
"typescript": "^2.0.10",
"typings": "^2.0.0",
"uglifyjs": "^2.4.10",
"zone.js": "^0.6.26"
},
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist"
],
"author": "solodynamo",
"license": "MIT",
"bugs": {
"url": "https://github.com/solodynamo/ng2-search-filter/issues"
},
"homepage": "https://github.com/solodynamo/ng2-search-filter#readme"
}
12 changes: 12 additions & 0 deletions src/ng2-filter.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Created by vadimdez on 28/11/2016.
*/
import { NgModule } from '@angular/core';
import { Ng2SearchPipe } from './ng2-filter.pipe';

@NgModule({
declarations: [Ng2SearchPipe],
exports: [Ng2SearchPipe]
})

export class Ng2SearchPipeModule {}
17 changes: 17 additions & 0 deletions src/ng2-filter.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Pipe , PipeTransform ,Injectable} from "@angular/core";

@Pipe({
name:'filter',
pure:false
})
@Injectable()
export class Ng2SearchPipe implements PipeTransform {

transform(items :any ,term :any): any {
if(term === undefined) return items;

return items.filter( function(item){
return item.name.toLowerCase().includes(term.toLowerCase());
})
}
}
41 changes: 41 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"compilerOptions": {
"noImplicitAny": false,
"module": "commonjs",
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"declaration": true,
"sourceMap": true,
"moduleResolution": "node",
"rootDir": ".",
"outDir": "./dist/",
"typeRoots": [
"node_modules/@types",
"node_modules"
],
"types": [
"core-js",
"jasmine",
"selenium-webdriver",
"node",
"protractor",
"systemjs"
]
},
"files": [
"index.ts"
],
"exclude": [
"node_modules",
"dist",
"example",
"examples",
"typings",
"aot"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : false
}
}
Loading

0 comments on commit f2bffad

Please sign in to comment.